Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mailbox ¶
type Mailbox[T any] struct { // contains filtered or unexported fields }
Mailbox contains a notify channel, a mutual exclusive lock, a queue of interfaces, and a queue capacity.
func New ¶
New creates a new mailbox instance. If name is non-empty, it must be unique and calling Start will launch prometheus metric monitor that periodically reports mailbox load until Close() is called.
func NewHighCapacity ¶
NewHighCapacity create a new mailbox with a capacity that is better able to handle e.g. large log replays.
func (*Mailbox[T]) Deliver ¶
Deliver appends to the queue and returns true if the queue was full, causing a message to be dropped.
func (*Mailbox[T]) Notify ¶
func (m *Mailbox[T]) Notify() <-chan struct{}
Notify returns the contents of the notify channel
func (*Mailbox[T]) RetrieveAll ¶
func (m *Mailbox[T]) RetrieveAll() []T
RetrieveAll fetches all elements from the queue.
func (*Mailbox[T]) RetrieveLatestAndClear ¶
func (m *Mailbox[T]) RetrieveLatestAndClear() (t T)
RetrieveLatestAndClear fetch the latest value (or nil), and clears the rest of the queue (if any).
type Monitor ¶
type Monitor struct { services.StateMachine // contains filtered or unexported fields }