Crate spt_msg

Crate spt_msg 

Source
Expand description

spt-msg — the local-messaging layer for spt-core.

Third layer of the acyclically-layered crate stack (R-ARCH-1): depends only on spt-proto (wire) and spt-store (persistence), one layer down — never the reverse. The spt binary is the top consumer.

Per ADR-0001 the only stable, copy-verbatim wire format is the <EVENT> envelope grammar in spt-proto::event (composed at the delivery edge by emit); the wire TCP frame is an internal length-prefixed (from, body) record — not a sister-interop contract (ADR-0020 retired the mis-elevated legacy reply-to framing). The delivery routing, listener lifecycle, and ready/ring orchestration are clean-room, re-expressed against the spt-core spt-store API (path-aware spool, perch resolver, registry).

M1 is loopback-only: every address is 127.0.0.1:<ephemeral>. Cross-node delivery is M4; the consolidated daemon that owns all listeners is M3. M1 ships the messaging mechanism on the proven M0 substrate.

Modules§

deliver
Message delivery: TCP-first, spool-fallback, with registry routing and reply routing.
emit
Delivery-edge EVENT rendering: the structural (from, body) pair → the <EVENT …> envelope every arriving-message surface emits (ADR-0020).
listener
PollListener — a loopback TCP accept listener with registry lifecycle.
ready
Ready-agent lifecycle: register a perch, listen, drain backlog, tear down.
ring
ring — blocking send-and-wait-for-reply.
wire
TCP length-prefixed message framing.