Skip to main content

Module protocol

Module protocol 

Source
Expand description

The daemon wire protocol: length-prefixed binary frames (ADR 0011).

A request is u32 (big-endian) body length, then the body: one operation byte, then its payload.

OpPayloadResponse
1 HELLOHello JSON (path and mode)0, u32 len, identity JSON; or 1, u32 len, error text
2 GET32-byte key0 (miss); or 1, u32 len, reply bytes, then optionally u32 len, effort JSON
3 PUT32-byte key, u32 meta len, meta JSON, reply bytes0
4 STATSempty0, u32 len, StatsSnapshot JSON
5 INFOempty0, u32 len, Info JSON

Operations 4 and 5 are read-only and additive: they kept the original version (ADR 0012, ADR 0015). Version 4 requires silent-session publication (ADR 0022) and negotiates the mode in HELLO (ADR 0020). A daemon that predates one rejects it by closing that connection; nothing else changes.

Version 5 requires exactly one successful HELLO before GET or PUT. Missing, failed or repeated handshakes close the connection without reading further requests. STATS and INFO remain available without a handshake.

Frames larger than MAX_FRAME are rejected.

Structs§

Effort
Solver effort recorded with a check-sat reply (ADR 0009).
Hello
A solver handshake, including the cache namespace.
Identity
Solver identity as the daemon reports it (see sail_key::SolverIdentity).
Info
The daemon’s configuration and state (the INFO operation).
MemoryInfo
The in-memory tier’s state, as INFO reports it.
PutMeta
Metadata sent with a PUT.
QueueInfo
The write-behind queue’s state, as INFO reports it.
RemoteInfo
Sanitized optional HTTP transport state, with no credentials or response bodies.
SharedInfo
The shared tier’s configuration, as INFO reports it.
StatsSnapshot
The daemon’s counters since it started (the STATS operation). Benchmarks read them before and after a run and report the difference.

Enums§

Request
A decoded request.
VerificationMode
A cache namespace negotiated for one solver connection.

Constants§

MAX_FRAME
Largest accepted frame body, in bytes.
PROTOCOL_VERSION
The protocol version. Bump on any incompatible change; the daemon reports it in HELLO, clients refuse a mismatch, and the default socket name includes it, so an upgraded client never talks to a stale daemon.

Functions§

get_effort_trailer
The effort trailer of a GET hit body, if present.
read_response
Reads one response frame body.
split_status_payload
Splits a status, u32 len, payload response body.
write_get_response
Writes a GET response.
write_hello_response
Writes a HELLO response.
write_info_response
Writes an INFO response.
write_put_response
Writes a PUT acknowledgement.
write_stats_response
Writes a STATS response.