Documentation
¶
Index ¶
- Constants
- type Action
- type Entry
- type Queue
- func (q *Queue) Close() error
- func (q *Queue) Each(visitor func(entry *Entry))
- func (q *Queue) Enqueue(action Action, args ...interface{})
- func (q *Queue) Len() int
- func (q *Queue) MaxRetries() int
- func (q *Queue) MaxWorkItems() int
- func (q *Queue) NumWorkers() int
- func (q *Queue) Recover() bool
- func (q *Queue) Running() bool
- func (q *Queue) SetMaxRetries(maxRetries int)
- func (q *Queue) SetMaxWorkItems(workItems int)
- func (q *Queue) SetNumWorkers(workers int)
- func (q *Queue) SetRecover(shouldRecover bool)
- func (q *Queue) Start()
- func (q *Queue) String() string
- func (q *Queue) WithMaxRetries(maxRetries int) *Queue
- func (q *Queue) WithMaxWorkItems(workItems int) *Queue
- func (q *Queue) WithNumWorkers(workers int) *Queue
- func (q *Queue) WithRecover(shouldRecover bool) *Queue
- type Worker
Constants ¶
const ( // DefaultMaxRetries is the maximum times a process queue item will be retried before being dropped. DefaultMaxRetries = 10 // DefaultMaxWorkItems is the default entry buffer length. // Currently the default is 2^18 or 256k. // WorkItems maps to the initialized capacity of a buffered channel. // As a result it does not reflect actual memory consumed. DefaultMaxWorkItems = 1 << 18 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action func(args ...interface{}) error
Action is an action that can be dispatched by the process queue.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue is the container for work items, it dispatches work to the workers.
func NewWithOptions ¶
NewWithOptions returns a new queue with customizable options.
func NewWithWorkers ¶
NewWithWorkers returns a new work queue with a given number of workers.
func (*Queue) MaxRetries ¶
MaxRetries returns the maximum number of retries.
func (*Queue) MaxWorkItems ¶
MaxWorkItems returns the maximum length of the work item queue.
func (*Queue) NumWorkers ¶
NumWorkers returns the number of worker routines.
func (*Queue) SetMaxRetries ¶
SetMaxRetries sets the maximum nummer of retries for a work item on error.
func (*Queue) SetMaxWorkItems ¶
SetMaxWorkItems sets the max work items.
func (*Queue) SetNumWorkers ¶
SetNumWorkers lets you set the num workers.
func (*Queue) SetRecover ¶
SetRecover sets if the queue workers should handle panics.
func (*Queue) Start ¶
func (q *Queue) Start()
Start starts the dispatcher workers for the process quere.
func (*Queue) WithMaxRetries ¶
WithMaxRetries calls `SetMaxRetries` and returns a reference to the queue.
func (*Queue) WithMaxWorkItems ¶
WithMaxWorkItems calls `SetMaxWorkItems` and returns a reference to the queue.
func (*Queue) WithNumWorkers ¶
WithNumWorkers calls `SetNumWorkers` and returns a reference to the queue.
func (*Queue) WithRecover ¶
WithRecover sets if the queue should recover panics.