Documentation
¶
Overview ¶
Package queue implements a non-blocking message queue.
Index ¶
Constants ¶
View Source
const Unbounded int = -1
Unbounded indicates the Queue does not have a limit.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue implements a multi-producer, single consumer event queue.
func (*Queue) Close ¶
Close the queue, preventing any more messages from being sent. Dequeue will return io.EOF.
func (*Queue) Dequeue ¶
Dequeue blocks until ctx is canceled or an item can be dequeued. Dequeue will panic if there are multiple concurrent callers.
func (*Queue) Enqueue ¶
func (q *Queue) Enqueue(v interface{})
Enqueue queues an item. Messages are guaranteed to be dequeued in call order. If the queue has reached its limit, the oldest message will be discarded.
func (*Queue) TryDequeue ¶
TryDequeue will return an element from q if one exists.
Click to show internal directories.
Click to hide internal directories.