Documentation
¶
Index ¶
- Variables
- func NewBatchQueue(queue Queue, batchSize, capacity int) *batchQueue
- func NewDelayedQueue(capacity int) *delayedQueue
- func NewFIFOQueue(capacity int) *fifoQueue
- func NewPriorityQueue(capacity int) *priorityQueue
- func NewRateLimitQueue(queue Queue, rate time.Duration, capacity int) *rateLimitQueue
- type DeadLetterQueue
- func (q *DeadLetterQueue) Add(ctx context.Context, task worker.Task) error
- func (q *DeadLetterQueue) Clear(ctx context.Context) error
- func (q *DeadLetterQueue) Get(ctx context.Context) (worker.Task, error)
- func (q *DeadLetterQueue) List(ctx context.Context) ([]worker.Task, error)
- func (q *DeadLetterQueue) Peek(ctx context.Context) (worker.Task, error)
- func (q *DeadLetterQueue) Remove(ctx context.Context, taskID string) error
- func (q *DeadLetterQueue) Size(ctx context.Context) (int, error)
- type Queue
- type QueueType
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrQueueFull = errors.New("queue is full") ErrQueueEmpty = errors.New("queue is empty") ErrTaskNotFound = errors.New("task not found") ErrTaskNotReady = errors.New("task is not ready for execution") ErrRateLimitExceeded = errors.New("rate limit exceeded") ErrBatchNotReady = errors.New("batch is not ready for processing") )
Error definitions
Functions ¶
func NewBatchQueue ¶
NewBatchQueue creates a new batch queue
func NewDelayedQueue ¶
func NewDelayedQueue(capacity int) *delayedQueue
NewDelayedQueue creates a new delayed queue
func NewFIFOQueue ¶
func NewFIFOQueue(capacity int) *fifoQueue
NewFIFOQueue creates a new FIFO queue
func NewPriorityQueue ¶
func NewPriorityQueue(capacity int) *priorityQueue
NewPriorityQueue creates a new priority queue
Types ¶
type DeadLetterQueue ¶
type DeadLetterQueue struct {
// contains filtered or unexported fields
}
DeadLetterQueue implements a queue for permanently failed tasks
func NewDeadLetterQueue ¶
func NewDeadLetterQueue(capacity int) *DeadLetterQueue
NewDeadLetterQueue creates a new dead letter queue
func (*DeadLetterQueue) Clear ¶
func (q *DeadLetterQueue) Clear(ctx context.Context) error
Clear removes all tasks from the queue
type Queue ¶
type Queue interface {
// Add adds a task to the queue
Add(ctx context.Context, task worker.Task) error
// Get retrieves the next task from the queue
Get(ctx context.Context) (worker.Task, error)
// Remove removes a task from the queue
Remove(ctx context.Context, taskID string) error
// Size returns the number of tasks in the queue
Size(ctx context.Context) (int, error)
// Clear removes all tasks from the queue
Clear(ctx context.Context) error
}
Queue defines the interface for task queues
Click to show internal directories.
Click to hide internal directories.