Documentation ¶
Index ¶
Constants ¶
const ( // EnqueueTimeout is the timeout for enqueueing an operation. If an // operation can't be processed in the time, a ErrDeadlineExceeded is // returned. EnqueueTimeout time.Duration = time.Second * 3 // EnqueueBatchSize dictates how many operations can be processed at any // one time. EnqueueBatchSize = 64 )
Variables ¶
var ( // ErrDeadlineExceeded is a sentinel error for all exceeded deadlines for // operations. ErrDeadlineExceeded = deadlineExceededErr("enqueueing deadline exceeded") // ErrCanceled is a sentinel error for when the operation has been stopped. ErrCanceled = canceledErr("enqueueing canceled") )
Functions ¶
func IsCanceled ¶
IsCanceled checks to see if the underlying error is a canceled error.
func IsDeadlineExceeded ¶
IsDeadlineExceeded checks to see if the underlying error is a deadline exceeded error.
Types ¶
type OpQueue ¶
type OpQueue struct {
// contains filtered or unexported fields
}
OpQueue holds the operations in a blocking queue. The purpose of this queue is to allow the backing off of operations at the source of enqueueing, and not at the consuming of the queue.
func (*OpQueue) Enqueue ¶
Enqueue will add an operation to the queue. As this is a blocking queue, any additional enqueue operations will block and wait for subsequent operations to be completed. The design of this is to ensure that people calling this will have to correctly handle backing off from enqueueing.
func (*OpQueue) Kill ¶
Kill puts the tomb in a dying state for the given reason, closes the Dying channel, and sets Alive to false.