Skip to main content

Module header

Module header 

Source
Expand description

CBOR frame headers.

The codecs are written by hand rather than derived. Three reasons:

  • the strictness rules (duplicate-key rejection, non-uint key rejection, per-field string caps, depth-limited skipping) are protocol requirements, not serialization defaults;
  • the exact byte layout is normative — see the golden vectors in docs/PROTOCOL.md §8 — and a derive macro’s field ordering is not a contract we control;
  • every decoder here is a hostile-input boundary, so its allocation behaviour has to be readable.

All decode failures are protocol violations that close the connection.

No field of a DATA header is required by the decoder. A header no longer carries the stream’s role, so the decoder cannot know which fields the context demands; endpoint-on-initiating-streams is enforced by the transport’s dispatch, which does know (docs/PROTOCOL.md §6.2).

Modules§

filter
The topic filter grammar of docs/PROTOCOL.md §6.4.
limits
Decoder limits. The string caps are normative (docs/PROTOCOL.md §6); the list and depth caps are defensive implementation limits documented in the same section.

Structs§

CreditHeader
CREDIT header (kind 5).
CursorHeader
CURSOR head frame (kind 6).
DataHeader
DATA header: one transfer.
ErrorHeader
ERROR header.
GuaranteeSet
One level per guarantee dimension, as declared in HELLO keys 5 and 6 (docs/PROTOCOL.md §6.5).
Hello
HELLO header: connection negotiation input.
SubscriptionHeader
SUBSCRIBE and UNSUBSCRIBE header.

Enums§

Acknowledgement
Acknowledgement/completion dimension. A ladder; the durability axes of Durability and replicas are not part of it.
Backpressure
Backpressure dimension. Not ordered: these are behaviours, not strengths, so two peers state the same one or fail to negotiate.
CursorLevel
A level a cursor can name: one weida defines, or one the application does.
Deduplication
Deduplication dimension. A ladder: later is stronger.
Delivery
Delivery dimension (GUARANTEES.md §3). A ladder: later is stronger.
Durability
Persistence axis of Stored/Replicated (decisions/0004 §4.1).
HeaderError
Why a header was rejected. Every variant is a protocol violation.
OrderingMode
Ordering dimension. A ladder: later is stronger.
ProducerNaming
How a producer is named for the sequence field of decisions/0001 §7.3. Not ordered: two peers state the same one or fail.
ReportMode
How often a reporter emits a record (docs/PROTOCOL.md §6.2, key 11).

Constants§

MAX_CURSOR_RECORD_LEN
Longest possible cursor record: two 8-byte QUIC varints.

Functions§

decode_cursor_record
Decodes one record from the front of input.
encode_cursor_record
Appends one (level, offset) record to out.