Documentation ¶
Overview ¶
Package worker provides worker processes
Package worker provides worker processes ¶
Package worker provides worker processes ¶
Package worker provides worker processes
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Queue ¶
type Queue interface { Start(ctx context.Context) (<-chan error, error) Push(ctx context.Context, job JobFunc) error Pop(ctx context.Context) (JobFunc, error) Len() uint64 }
func NewQueue ¶
func NewQueue(opts ...QueueOption) (Queue, error)
type QueueOption ¶
type QueueOption func(q *queue) error
func WithQueueBuffer ¶
func WithQueueBuffer(buffer int) QueueOption
func WithQueueCheckDuration ¶ added in v0.0.30
func WithQueueCheckDuration(dur string) QueueOption
func WithQueueErrGroup ¶
func WithQueueErrGroup(eg errgroup.Group) QueueOption
type Worker ¶
type Worker interface { Start(ctx context.Context) (<-chan error, error) Pause() Resume() IsRunning() bool Name() string Len() uint64 TotalRequested() uint64 TotalCompleted() uint64 Dispatch(ctx context.Context, f JobFunc) error }
func New ¶
func New(opts ...WorkerOption) (Worker, error)
type WorkerOption ¶
type WorkerOption func(w *worker) error
func WithErrGroup ¶
func WithErrGroup(eg errgroup.Group) WorkerOption
func WithLimitation ¶
func WithLimitation(limit int) WorkerOption
func WithName ¶
func WithName(name string) WorkerOption
func WithQueueOption ¶ added in v0.0.30
func WithQueueOption(opts ...QueueOption) WorkerOption
Click to show internal directories.
Click to hide internal directories.