Expand description
Local protocol — daemon ↔ same-host CLI (and atticd).
Hot path. Sub-millisecond budget for warm-cache lookups. rkyv 0.8
over a length-prefixed multiplex frame, transported via
tokio::net::UnixStream. The transport itself lives in the future
sui-daemon crate; this module ships the typed wire shapes those
transport layers will consume.
§Wire shape
Every byte on the wire belongs to a WireFrame. The framing is:
[magic : 4B = "SUI1"] [length : 4B u32 LE] [body : N bytes of rkyv-archived WireFrame]The magic + length prefix is what lets a misaligned reader fail fast (the rkyv access itself validates the body, so a corrupted body never gets cast to a typed reference). Length includes only the body — not the 8 prefix bytes. Max body length is bounded by daemon configuration; defaults to 64 MiB to comfortably hold a batched closure-info request without runaway.
§Request / response model
Bidirectional multiplexed: each frame carries a RequestId (u64)
so multiple in-flight requests share one stream without
head-of-line blocking. Heartbeats are first-class frames so a long
idle connection doesn’t NAT-time-out. The daemon may push
unsolicited events (eval-cache invalidations) under request_id = 0, which clients route to a subscription handler.
Structs§
- Archived
Heartbeat - An archived
Heartbeat - Archived
Local Error - An archived
LocalError - Archived
Stats Snapshot - An archived
StatsSnapshot - Heartbeat
- Heartbeat
Resolver - The resolver for an archived
Heartbeat - Local
Error - Daemon-side errors. Codes are stable IDs; messages are operator- readable strings (English; not localized).
- Local
Error Resolver - The resolver for an archived
LocalError - Stats
Snapshot - Stats
Snapshot Resolver - The resolver for an archived
StatsSnapshot
Enums§
- Archived
Error Code - An archived
ErrorCode - Archived
Local Request - An archived
LocalRequest - Archived
Local Response - An archived
LocalResponse - Archived
Wire Frame - An archived
WireFrame - Error
Code - Stable error codes. Append-only.
- Error
Code Resolver - The resolver for an archived
ErrorCode - Local
Request - Every request the local protocol can carry today. Append new variants at the bottom — rkyv tag stability rule.
- Local
Request Resolver - The resolver for an archived
LocalRequest - Local
Response - Every response the local protocol can carry today.
- Local
Response Resolver - The resolver for an archived
LocalResponse - Wire
Frame - One frame on the wire. All inter-process communication on the local link is one or more of these.
- Wire
Frame Resolver - The resolver for an archived
WireFrame
Constants§
- FRAME_
MAGIC - Magic bytes at the start of every frame on the local protocol.
Bumping requires a
MAX_LOCAL_PROTOCOL_VERSIONbump too.
Type Aliases§
- Request
Id - Multiplex correlation id.
0is reserved for unsolicited server pushes (cache invalidations, progress events).