pub struct MailboxRoute {
pub store: MailboxStore,
/* private fields */
}Expand description
What the loop and the send tool share: the store plus this run’s identity, learned after the agent is built — the session is created at run start, the route at setup, the same late-binding the outbox route has and for the same reason.
Fields§
§store: MailboxStoreImplementations§
Source§impl MailboxRoute
impl MailboxRoute
pub fn new(store: MailboxStore, deliver: bool) -> Self
pub fn delivers(&self) -> bool
Sourcepub fn set_identity(&self, producer: &str, session_id: &str)
pub fn set_identity(&self, producer: &str, session_id: &str)
This run’s producer and session id. Set by the front-end once the session exists; until then the run can neither send nor receive — an anonymous run has no mailbox and no return address.
pub fn identity(&self) -> Option<(String, String)>
Sourcepub fn attach(&self, producer: &str, session_id: &str)
pub fn attach(&self, producer: &str, session_id: &str)
Give this run its identity and announce it live, in one call — what
every front-end does at session start. The announce is best-effort:
a missing liveness marker only costs mecha msg agents a row, never
correctness, so it warns rather than failing the run.
Sourcepub fn detach(&self, session_id: &str)
pub fn detach(&self, session_id: &str)
Drop this run’s liveness marker at session end. Best-effort: a marker whose pid is gone already reads as absent, so a missed detach is cosmetic.
Sourcepub fn claim_pending(&self) -> Vec<MailboxMessage>
pub fn claim_pending(&self) -> Vec<MailboxMessage>
Claim this run’s pending messages. Empty when the run has no identity. Errors leave the messages safely pending, so they are logged rather than surfaced — delivery failing must not fail the run, and nothing is lost by trying again next turn.