Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrStop = errors.New("push failed: queue is stopped") ErrFull = errors.New("push failed: queue is full") )
Functions ¶
This section is empty.
Types ¶
type MemoryQueue ¶
type MemoryQueue struct {
// contains filtered or unexported fields
}
MemoryQueue is an implementation of the AsyncQueue interface using a channel to process functions.
func NewMemoryQueue ¶
func NewMemoryQueue(workerCount int, bufferSize int) *MemoryQueue
func (*MemoryQueue) BatchPushCtx ¶ added in v1.1.0
func (mq *MemoryQueue) BatchPushCtx(ctx context.Context, tasks ...func()) (int, error)
func (*MemoryQueue) NotWaitPush ¶ added in v1.1.0
func (mq *MemoryQueue) NotWaitPush(task func()) error
func (*MemoryQueue) Push ¶
func (mq *MemoryQueue) Push(task func()) error
Push submits a function to the queue. Returns an error if the queue is stopped or if the queue is full.
func (*MemoryQueue) PushCtx ¶ added in v1.1.0
func (mq *MemoryQueue) PushCtx(ctx context.Context, task func()) error
func (*MemoryQueue) Stop ¶
func (mq *MemoryQueue) Stop()
Stop is used to terminate the internal goroutines and close the channel.
Click to show internal directories.
Click to hide internal directories.