Skip to main content

Module data_stream

Module data_stream 

Source
Expand description

Draft-18 data stream header encoding and decoding.

Subgroup header type byte, draft-18 Section 11.4.2: the form is 0b0XX1XXXX, so bit 7 is clear and bit 4 is set, giving the ranges 0x10..0x1F, 0x30..0x3F, 0x50..0x5F, 0x70..0x7F.

  • bit 0 (0x01): PROPERTIES
  • bits 1-2 (0x06): SUBGROUP_ID_MODE (0=zero, 1=first_obj, 2=explicit, 3=reserved)
  • bit 3 (0x08): END_OF_GROUP
  • bit 5 (0x20): DEFAULT_PRIORITY (no priority byte)
  • bit 6 (0x40): FIRST_OBJECT (new in draft-18)

Datagram type byte, draft-18 Section 11.3.1: the form is 0b00X0XXXX, so bits 7, 6 and 4 are clear, giving the ranges 0x00..0x0F and 0x20..0x2F.

  • bit 0 (0x01): PROPERTIES
  • bit 1 (0x02): END_OF_GROUP
  • bit 2 (0x04): ZERO_OBJECT_ID (object_id=0, field omitted)
  • bit 3 (0x08): DEFAULT_PRIORITY (no priority byte)
  • bit 5 (0x20): STATUS (status byte replaces payload)

Both sections then list the Type values inside those ranges that are nonetheless invalid, and answer each with “MUST close the session with a PROTOCOL_VIOLATION”: SUBGROUP_ID_MODE 0b11 on a stream header, and STATUS together with END_OF_GROUP on a datagram. Both decoders refuse them, and so do SubgroupHeader::encode_checked and DatagramHeader::encode_checked, which write only what those decoders accept.

Fetch header: stream type 0x05 + request_id, then objects whose fields are selected by a Serialization Flags varint and resolved against the object before them (Section 11.4.4). FetchObjectHeader is the wire frame and FetchObjectReader resolves it.

Padding, Section 11.5, is a stream type and a datagram type of its own — PADDING_STREAM_TYPE and PADDING_DATAGRAM_TYPE — carrying no Objects. Neither is a subgroup header or a datagram header, and this module’s decoders refuse both rather than reading a padding frame’s leading bytes as header fields.

Structs§

DatagramHeader
FetchHeader
FetchObject
One frame from a FETCH stream with its delta-encoded fields resolved.
FetchObjectHeader
One frame on a draft-18 FETCH stream, exactly as it sits on the wire.
FetchObjectReader
Resolves the delta-encoded fields of the frames on one FETCH stream.
FetchObjectWriter
Re-encodes resolved fetch frames onto one FETCH stream.
SubgroupHeader
SubgroupObject
One object within a draft-18 subgroup stream. Object IDs are delta-encoded; whether a per-object “properties” block (the draft-18 equivalent of extension headers) is present depends on the PROPERTIES bit on the enclosing SubgroupHeader. Use SubgroupObjectReader to encode/decode.
SubgroupObjectMeta
The framing of one draft-18 subgroup object, without its payload.
SubgroupObjectReader

Enums§

EndOfRange
Which End of Range a fetch frame marks, draft-18 Section 11.4.4.2.
GroupOrder
The order a FETCH response’s Groups arrive in, which decides how a Group ID Delta is applied.
PayloadPermission
Whether an Object carrying a given status is permitted a non-empty payload.

Constants§

PADDING_DATAGRAM_TYPE
Datagram type for padding, draft-18 Section 11.5.2: “An endpoint MAY send a datagram with a type of 0x132B3E29 to send padding data. The datagram contains the type followed by zero or more bytes that MUST all be set to zero.”
PADDING_STREAM_TYPE
Unidirectional stream type for padding, draft-18 Section 11.5.1: “An endpoint MAY open a unidirectional stream with a stream type of 0x132B3E28 to send padding data. The stream begins with the stream type, followed by zero or more bytes that MUST all be set to zero.”