Documentation
¶
Overview ¶
combiner package implements a combiner queue that allows pushing job items to a background worker that combines multiple job items into a single batch.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Combiner ¶
type Combiner[Job any] struct { // contains filtered or unexported fields }
Combiner combines multiple jobs for a single worker to process in batches.
func New ¶
New creates a new combiner queue.
Parent context is passed to the job processing as the context. process is used to process work items and fail is called for jobs when they need to be aborted, due to context cancellation. queueSize is used to create new queues, queueSize = -1 means the queue is unbounded.
type Options ¶
type Options[Job any] struct { Process ProcessFunc[Job] Fail ProcessFunc[Job] QueueSize int }
Options is for configuring the combiner queue.
type ProcessFunc ¶
ProcessFunc processes a queue of jobs.
type Queue ¶
type Queue[Job any] struct { // contains filtered or unexported fields }
Queue is a finalizable list of jobs with a limit to how many jobs it can handle.
func (*Queue[Job]) Batches ¶
Batches iterates over batches until all done.
The iterator slice should not be used outside of the loop.
func (*Queue[Job]) Completed ¶
Completed returns true when the queue does not accept any new jobs and all the jobs have been completed.