Documentation
¶
Index ¶
- Constants
- type DispatcherConfig
- type IQueuedWorker
- type IndexJobPool
- type Job
- type JobDispatcher
- func (j *JobDispatcher) BuildWorkers(count int)
- func (j *JobDispatcher) EnqueueJob(w Job)
- func (j *JobDispatcher) EnqueueJobList(w *[]Job)
- func (j *JobDispatcher) SetRetryTimeout(timeout time.Duration)
- func (j *JobDispatcher) SetWorkerConstructor(w *WorkerConstructor)
- func (j *JobDispatcher) Start()
- func (j *JobDispatcher) Stop()
- type PoolConfig
- type QueuedWorker
- type WorkQueue
- type WorkerConstructor
Constants ¶
View Source
const DefaultRetryTimeout = 30 * time.Second
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DispatcherConfig ¶
type IQueuedWorker ¶
type IQueuedWorker interface {
Start()
DoWork(Job)
}
type IndexJobPool ¶
type IndexJobPool struct {
// contains filtered or unexported fields
}
func NewJobPool ¶
func NewJobPool() *IndexJobPool
func (*IndexJobPool) EnqueueJob ¶
func (j *IndexJobPool) EnqueueJob(job Job)
func (*IndexJobPool) EnqueueJobList ¶
func (j *IndexJobPool) EnqueueJobList(jobs *[]Job)
func (*IndexJobPool) GetNewJob ¶
func (j *IndexJobPool) GetNewJob() Job
type JobDispatcher ¶
type JobDispatcher struct {
EmptyQueueChan chan bool // channel to communicate that queue was consumed
// contains filtered or unexported fields
}
func NewJobDispatcher ¶
func NewJobDispatcher(cfg DispatcherConfig) *JobDispatcher
func (*JobDispatcher) BuildWorkers ¶
func (j *JobDispatcher) BuildWorkers(count int)
func (*JobDispatcher) EnqueueJob ¶ added in v1.2.0
func (j *JobDispatcher) EnqueueJob(w Job)
func (*JobDispatcher) EnqueueJobList ¶ added in v1.2.0
func (j *JobDispatcher) EnqueueJobList(w *[]Job)
func (*JobDispatcher) SetRetryTimeout ¶
func (j *JobDispatcher) SetRetryTimeout(timeout time.Duration)
func (*JobDispatcher) SetWorkerConstructor ¶
func (j *JobDispatcher) SetWorkerConstructor(w *WorkerConstructor)
func (*JobDispatcher) Start ¶
func (j *JobDispatcher) Start()
func (*JobDispatcher) Stop ¶
func (j *JobDispatcher) Stop()
type PoolConfig ¶
type QueuedWorker ¶
type QueuedWorker struct {
Worker IQueuedWorker
}
type WorkQueue ¶
type WorkQueue struct {
ID string
WorkersChan chan chan Job // used to communicate between dispatcher and workers
JobsChan chan Job
End chan bool
}
func (WorkQueue) ListenForJobs ¶
type WorkerConstructor ¶
type WorkerConstructor func(string, chan chan Job) QueuedWorker
Click to show internal directories.
Click to hide internal directories.