Skip to content

core(mailbox): rebuild from kameo reference — queue + Signal + backpressure #112

Description

@joeldsouzax

Part of the core-rebuild epic — follows the shared rigor contract there. First card.

Component

src/mailbox.rs (~1,151 LOC). The actor's in-memory queue: the Signal enum (message + control/stop/link-died), bounded vs unbounded, backpressure (block) vs drop. The run-loop pulls from it; ActorRef pushes to it. Everything else in the runtime stands on this.

Learning & discussion

Carries Box<dyn DynMessage> — typed, in-memory, zero-serialize: this is the local tier of the two-tier model (see #66 design note). Signals are heterogeneous; the loop selects over them. We keep the local typed queue; we rebuild the impl to the god-level bar on a vetted primitive + our own Signal layer.

Existing crates

tokio::sync::mpsc (bounded/unbounded base), flume, thingbuf (bounded lock-free ring / keep-latest), async-channel, crossbeam-channel; tokio-util CancellationToken for stop (#55). Decide the primitive for bounded-block vs ring/keep-latest.

Research — best algorithm/approach

Vyukov intrusive MPSC (1024cores), LMAX Disruptor ring-buffer + backpressure, thingbuf design. Capacity-hit returns Result, never panics (rule 4 / nexus #22). No commitment before the survey.

Testing — hard as fuck

Related

#19 (Zenoh channel-handler strategy — remote tier), #55 (stop/abort).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions