Documentation ¶
Overview ¶
Package parallelwork implements pallel work queue with fixed number of workers that concurrently process and add work items to the queue.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallbackFunc ¶
type CallbackFunc func() error
CallbackFunc is a callback function.
func OnNthCompletion ¶ added in v0.7.3
func OnNthCompletion(n int, callback CallbackFunc) CallbackFunc
OnNthCompletion invokes the provided callback once the returned callback function has been invoked exactly n times.
type Queue ¶
type Queue struct { ProgressCallback func(ctx context.Context, enqueued, active, completed int64) // contains filtered or unexported fields }
Queue represents a work queue with multiple parallel workers.
func (*Queue) EnqueueBack ¶
func (v *Queue) EnqueueBack(ctx context.Context, callback CallbackFunc)
EnqueueBack adds the work to the back of the queue.
func (*Queue) EnqueueFront ¶
func (v *Queue) EnqueueFront(ctx context.Context, callback CallbackFunc)
EnqueueFront adds the work to the front of the queue.
Click to show internal directories.
Click to hide internal directories.