Documentation
¶
Index ¶
- type TaskHandler
- type TaskWorkerPool
- type WorkerPool
- func (w *WorkerPool) HeartbeatListener(ctx context.Context)
- func (w *WorkerPool) ListenForCancelledTasks(ctx context.Context)
- func (w *WorkerPool) RegisterHandler(taskType string, handler TaskHandler)
- func (w *WorkerPool) RequeueFailedTasks(ctx context.Context)
- func (w *WorkerPool) StartWorkerPool(ctx context.Context)
- func (w *WorkerPool) StartWorkers(ctx context.Context)
- func (w *WorkerPool) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TaskHandler ¶
type TaskWorkerPool ¶
type TaskWorkerPool interface {
// StartWorkerPool starts background processes and workers
// Should be run as a go routine.
StartWorkerPool(ctx context.Context)
// StartWorkers Starts workers up to number numWorkers defined in config.
StartWorkers(ctx context.Context)
// Stop Gracefully stops all workers
Stop()
// HeartbeatListener requeues tasks of workers whose heartbeats do not refresh within heartbeat duration
HeartbeatListener(ctx context.Context)
// ListenForCancelledTasks listens for task cancellation notifications
ListenForCancelledTasks(ctx context.Context)
// RequeueFailedTasks requeues failed tasks at regular intervals
RequeueFailedTasks(ctx context.Context)
// RegisterHandler assigns a function of type TaskHandler to a typename.
// This function is the action performed to tasks of typename taskType.
RegisterHandler(taskType string, handler TaskHandler)
}
func NewTaskWorkerPool ¶
func NewTaskWorkerPool(queue queue.Queue, metrics *m.Metrics) TaskWorkerPool
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
func (*WorkerPool) HeartbeatListener ¶
func (w *WorkerPool) HeartbeatListener(ctx context.Context)
func (*WorkerPool) ListenForCancelledTasks ¶
func (w *WorkerPool) ListenForCancelledTasks(ctx context.Context)
func (*WorkerPool) RegisterHandler ¶
func (w *WorkerPool) RegisterHandler(taskType string, handler TaskHandler)
func (*WorkerPool) RequeueFailedTasks ¶
func (w *WorkerPool) RequeueFailedTasks(ctx context.Context)
func (*WorkerPool) StartWorkerPool ¶
func (w *WorkerPool) StartWorkerPool(ctx context.Context)
func (*WorkerPool) StartWorkers ¶
func (w *WorkerPool) StartWorkers(ctx context.Context)
func (*WorkerPool) Stop ¶
func (w *WorkerPool) Stop()
Click to show internal directories.
Click to hide internal directories.