class

X::Process::Mailbox

Inherits Reference / Object

Thread-safe mailbox for actor-style message passing Each process has its own isolated mailbox

Constants

Log = ::Log.for(self)

Constructors

new(capacity : Int32 = 100)
Source

Instance methods

acknowledgments

Acknowledgments for delivered/processed messages (if enabled)

Source
add_ack(acknowledgment : Message::Acknowledgment)

Store a message acknowledgment (delivery/processed)

Source
capacity

Maximum number of messages before full (configurable)

Source
cleanup_expired_messages

Remove all expired messages (based on TTL)

Source
clear
Source
empty?

Is the mailbox empty?

Source
mailbox_mutex

Mutex for thread-safe operations

Source
matches_pattern?(value : Value::Context, pattern : Value::Context) : Bool

Check if a message value matches a pattern Supports:

  • Null pattern → matches anything
  • Exact value match
  • Map pattern matching (partial map with null wildcards)
Source
messages

Regular messages waiting to be received

Source
peek

Return the oldest message without removing it

Source
push(message : Message::Context) : Bool

Add a message to the mailbox Returns true if successful, false if mailbox is full

Source
remove_at(index : Int32) : Message::Context | Nil

Remove message at specific index

Source
select(pattern : Value::Context) : Message::Context | Nil

Find and remove the first message matching the given pattern Used by RECEIVE_SELECT

Source
shift

Remove and return the oldest message (FIFO)

Source
size

Current number of messages

Source