Documentation
¶
Overview ¶
Package queue provides a sequential, non-blocking, unbounded task execution queue. It mimics Node.js's event loop and is deeply inspired by Kubernetes workqueue.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue serializes function execution through a single goroutine. It uses an unbounded slice backed by a condition variable to ensure Enqueue never blocks the caller.
func (*Queue) Close ¶
func (q *Queue) Close()
Close shuts down the Queue gracefully. It waits for all previously enqueued tasks to complete before returning.
func (*Queue) Enqueue ¶
func (q *Queue) Enqueue(task func())
Enqueue adds a task to the queue for sequential execution. It returns nil on success, or ErrQueueFull if a max size is set and the queue is at capacity. It returns immediately and NEVER blocks.