Skip to main content

Module protocol

Module protocol 

Source
Expand description

Wire protocol message types and constants.

The codec is postcard over a length-prefixed framing layer (see crate::frame). The on-wire format of a single message is:

u32 frame_len   (little-endian; covers everything after this field)
u16 proto_version (little-endian)
[u8] postcard-encoded `Message`

The Message enum’s variant discriminant is encoded by postcard as part of the payload, so we don’t carry a separate msg_type byte on the wire.

Structs§

Capabilities
Reserved space for future feature negotiation flags.
HandoffId
Opaque per-handoff identifier. Generated by the supervisor in HelloAck.

Enums§

Message
One control-channel message. Variants correspond 1:1 to the rows of the wire-protocol table in ARCHITECTURE.md.
Side
The role a peer announces in Hello.

Constants§

PROTO_MAX
Maximum version this build can speak. Equal to PROTO_MIN until we ship a v2.
PROTO_MIN
Minimum version this build can speak.

Functions§

negotiate_version
Negotiate a single protocol version from two proto_min..=proto_max ranges. Returns the highest version both sides can speak, or [Error::VersionMismatch].
short_name
Short, stable name for a Message variant. Used in error messages and tracing where the full payload is noise. The name is the variant identifier, nothing more — callers that want “unexpected for state X” framing should compose it at the call site.

Type Aliases§

ProtoVersion
Wire-protocol version. Bumped on any breaking payload change.