Skip to main content

Crate sui_daemon_frame

Crate sui_daemon_frame 

Source
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 DuplexStream end-to-end without touching the filesystem.
  • Future fuzzers — call read_frame on arbitrary bytes and assert only framing-level invariants (rkyv validation is downstream).

Structs§

FrameCodec
Stateful codec wrapper. Caches the body-length cap so per-call arguments stay small.

Enums§

FrameError
Errors from the framing layer. rkyv body-shape failures bubble up as FrameError::Decode; transport failures (closed socket, partial read) bubble up as FrameError::Io.
WireFrame
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 FrameCodec explicitly and override.

Functions§

read_frame
Free-function reader. Used directly by tests and by the stateful FrameCodec.
write_frame
Free-function writer.