Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrQueueClosed = errors.New("the queue is closed for reading and writing")
Functions ¶
This section is empty.
Types ¶
type MessageQueue ¶
type MessageQueue struct {
// contains filtered or unexported fields
}
MessageQueue represents a threadsafe message queue to be used to retrieve or write messages to.
func NewMessageQueue ¶
func NewMessageQueue() *MessageQueue
NewMessageQueue returns a new MessageQueue.
func (*MessageQueue) Close ¶
func (mq *MessageQueue) Close()
Close closes the queue for future writes or reads. Any attempts to read or write from the queue after close will return ErrQueueClosed. This is safe to call multiple times.
func (*MessageQueue) Dequeue ¶ added in v0.9.4
func (mq *MessageQueue) Dequeue() (interface{}, error)
Dequeue will read a value from the queue and remove it. If the queue is empty, this will block until the queue is closed or a value gets enqueued.
func (*MessageQueue) Enqueue ¶ added in v0.9.4
func (mq *MessageQueue) Enqueue(msg interface{}) error
Enqueue writes `msg` to the queue.
func (*MessageQueue) Size ¶ added in v0.9.4
func (mq *MessageQueue) Size() int
Size returns the size of the queue.
Click to show internal directories.
Click to hide internal directories.