Skip to main content

Module protocol

Module protocol 

Source
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.
DataRowEmitter
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.
FatalExit
Final frame the child writes before it tears down on an unrecoverable failure.
Frame
Versioned envelope around a single protocol Message.
ProgressTick
Intermediate progress frame emitted by the child during a long-running request.
StreamSummary
Terminal stream-completion summary returned alongside a streaming response.

Enums§

HostSessionMode
How the worker child should load host-session capabilities.
Message
One protocol message exchanged over the worker boundary.
ProtocolError
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 message as a length-delimited JSON frame to writer.