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§
- Credit
Header - CREDIT header (kind
5). - Cursor
Header - CURSOR head frame (kind
6). - Data
Header - DATA header: one transfer.
- Error
Header - ERROR header.
- Guarantee
Set - One level per guarantee dimension, as declared in HELLO keys
5and6(docs/PROTOCOL.md§6.5). - Hello
- HELLO header: connection negotiation input.
- Subscription
Header - SUBSCRIBE and UNSUBSCRIBE header.
Enums§
- Acknowledgement
- Acknowledgement/completion dimension. A ladder; the durability axes of
Durabilityandreplicasare 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.
- Cursor
Level - 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). - Header
Error - Why a header was rejected. Every variant is a protocol violation.
- Ordering
Mode - Ordering dimension. A ladder: later is stronger.
- Producer
Naming - How a producer is named for the sequence field of decisions/0001 §7.3. Not ordered: two peers state the same one or fail.
- Report
Mode - How often a reporter emits a record (
docs/PROTOCOL.md§6.2, key11).
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 toout.