Expand description
sui-daemon-frame — async frame codec for the rkyv-over-UDS local protocol.
§Wire format
[magic : 4B = "SUI1"] [len : 4B u32 LE] [body : N bytes of rkyv-archived WireFrame]The magic + length prefix is what lets a misaligned reader fail fast.
rkyv’s own validation pass (rkyv::access) catches body-shape errors;
this codec only enforces the framing envelope.
§Scope
This crate is transport-agnostic: it codes against tokio::io::Async{Read,Write},
so the same primitives work for UnixStream, TcpStream, in-memory
DuplexStream (great for tests), or any future Bytes-stream abstraction.
§Reuse surface
sui-daemon::graph_server— reads frames from each accepted client.sui-daemon-client— writes requests + reads responses on a single multiplexed connection.- Tests across the workspace — drive
DuplexStreamend-to-end without touching the filesystem. - Future fuzzers — call
read_frameon arbitrary bytes and assert only framing-level invariants (rkyv validation is downstream).
Structs§
- Frame
Codec - Stateful codec wrapper. Caches the body-length cap so per-call arguments stay small.
Enums§
- Frame
Error - Errors from the framing layer. rkyv body-shape failures bubble up as
FrameError::Decode; transport failures (closed socket, partial read) bubble up asFrameError::Io. - Wire
Frame - One frame on the wire. All inter-process communication on the local link is one or more of these.
Constants§
- MAX_
FRAME_ BODY_ BYTES - Default maximum body length the codec will accept. 64 MiB — enough
for a batched closure-info response, small enough to catch a runaway
peer before it OOMs the daemon. Callers wanting a different cap can
build a
FrameCodecexplicitly and override.
Functions§
- read_
frame - Free-function reader. Used directly by tests and by the stateful
FrameCodec. - write_
frame - Free-function writer.