Expand description
Length-delimited frame codec and message payload types for the parent ↔ child worker process boundary.
§Additive evolution
Every public enum here is #[non_exhaustive] so the wire format can gain
a new request, response, or message kind without forcing a semver-major
bump on consumers. Most structs are also #[non_exhaustive] and expose
pub fn new(...) constructors so the shapes can grow fields without
breaking external builders. The exception is DataRow, which is built
so frequently with struct-literal syntax (tests, harnesses, fakes) that
the ergonomic cost of #[non_exhaustive] outweighs the additive-evolution
benefit; the wire schema for a data row is also already fixed by the
stream contract.
Structs§
- DataRow
- One row in a streaming response.
- Data
RowEmitter - Stateful emitter that assigns per-stream sequence numbers and tracks the
running row count for the terminal
StreamSummary. - Diagnostic
- Intermediate diagnostic frame emitted by the child during a request.
- Fatal
Exit - Final frame the child writes before it tears down on an unrecoverable failure.
- Frame
- Versioned envelope around a single protocol
Message. - Progress
Tick - Intermediate progress frame emitted by the child during a long-running request.
- Stream
Summary - Terminal stream-completion summary returned alongside a streaming response.
Enums§
- Host
Session Mode - How the worker child should load host-session capabilities.
- Message
- One protocol message exchanged over the worker boundary.
- Protocol
Error - Failure modes the codec can produce while reading or writing a frame.
- Request
- Parent-issued worker request body.
- Response
- Child-issued terminal response body for one
Request.
Constants§
- MAX_
FRAME_ BYTES - Default per-frame size limit applied by the parent when no explicit cap is configured on the capability builder.
- MAX_
FRAME_ BYTES_ HARD_ CAP - Ceiling on the configurable frame cap. Prevents callers from defeating the memory-safety policy by passing an absurdly large value.
- MIN_
FRAME_ BYTES - Floor on the configurable frame cap. Trivial requests and the handshake itself must fit inside this; callers cannot configure smaller.
- PROTOCOL_
VERSION - Wire protocol version negotiated between parent and child during the handshake frame. Bump only on a breaking wire change.
Functions§
- read_
frame - Read one length-delimited JSON frame from
reader. - write_
frame - Serialise
messageas a length-delimited JSON frame towriter.