memamq

package
v0.0.50-alpha.23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

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

func (mq *MemoryQueue) BatchPushCtx(ctx context.Context, tasks ...func()) (int, error)

func (*MemoryQueue) NotWaitPush

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL