package queue

import "github.com/Microsoft/hcsshim/internal/queue"

Index

Variables

var ErrQueueClosed = errors.New("the queue is closed for reading and writing")

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

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

func (mq *MessageQueue) Enqueue(msg interface{}) error

Enqueue writes `msg` to the queue.

func (*MessageQueue) Size

func (mq *MessageQueue) Size() int

Size returns the size of the queue.

Source Files

mq.go

Version
v0.12.9 (latest)
Published
Oct 30, 2024
Platform
linux/amd64
Imports
2 packages
Last checked
14 hours ago

Tools for package owners.