Expand description
Framed stdio transport for bytes-only named component contracts.
An executable stays alive for its component’s lifetime. Stdin and stdout carry only frames:
a four-byte little-endian unsigned JSON byte length, followed by that JSON. Stderr is
inherited for diagnostics. Frames are bounded by MAX_FRAME_SIZE. Calls are serialized
across all contracts sharing the executable. A timeout or protocol failure terminates and
reaps the child; the connection is then respawned from the verified executable on a later
call, up to the manager’s restart budget, re-running the describe validation and the host’s
session setup (SidecarSessionSetup) each time. Producer status failures leave the
connection usable.
The first request is {"op":"describe"}. Its successful response payload contains JSON
matching StdioDescriptor, checked against the verified artifact’s manifest. Subsequent
requests use {"op":"call","contract":"name","method":"name","payload":[0,255]}.
Every response is {"status":0,"payload":[0,255]}. Status codes use AlefStatus semantics;
a nonzero status carries error message bytes. Payloads are JSON byte arrays, not base64.
This transport supports crate::LoadedComponent::invoke_bytes. Arbitrary generated C
function tables cannot be represented across a process boundary: typed table access and
typed instance creation return an explicit unsupported-transport error.
Structs§
- Sidecar
Session - One stdio connection as seen by a host’s session setup: a
SidecarSessionSetupreceives it once a sidecar child has started and passed describe validation, and callsSidecarSession::invoketo re-establish whatever session the host had built on the previous connection. - Stdio
Descriptor - Metadata returned as JSON inside the successful
describeresponse payload. - Stdio
Response - A response envelope, using the component ABI’s integer status codes.
Enums§
- Stdio
Request - A request envelope. A producer must answer exactly once for every request.
Constants§
Functions§
- read_
frame - Read one complete bounded frame. EOF, including between frames, is an error.
- write_
frame - Write and flush one bounded frame.
Type Aliases§
- Sidecar
Restart Event - Handler called with the component id and the new restart count after each successful stdio
respawn (see
crate::ComponentManager::with_sidecar_restart_event). - Sidecar
Session Setup - Host-provided setup for a stdio sidecar connection, replayed after the first spawn and after
every respawn of the connection (see
crate::ComponentManager::with_sidecar_session).