mailbox

package
v0.0.0-...-126e8e4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mailbox

type Mailbox interface {
	// Enqueue places a new message to the Mailbox. If Mailbox is full
	// method returns errors.MailboxFull. Mailboxes are unbounded unless
	// SetLimit was called with a value of `limit` > 0.
	Enqueue(message actor.Message) error

	// Enqueue places a new message in the front of the messages queue. The
	// message will be Dequeued before any messages placed using Enqueue.
	EnqueueFront(message actor.Message) error

	// Dequeue gets a next message from the Mailbox. If Mailbox is empty,
	// Dequeue blocks until someone places a message to the Mailbox. There
	// should be only one goroutine that uses this method.
	Dequeue() actor.Message

	// Stash places a message to the separate queue of delayed messages.
	// This method should be called from the same single goroutine that calls Dequeue.
	Stash(message actor.Message)

	// Unstash places all previously Stash'ed messages in the front of the message queue.
	// The original order of Stash'ed messages is preserved. This method should be called
	// from the same single goroutine that calls Dequeue.
	Unstash()

	// SetLimit sets the maximum capacity of the Mailbox. This limit doesn't affect
	// stashed and priority messages - the amount of these messages is always unlimited.
	SetLimit(limit int)
}

Mailbox is a queue of messages sent to a given actor.

func New

func New() Mailbox

New creates a new Mailbox

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL