Skip to main content

Module message

Module message 

Source
Expand description

Draft-18 control message encoding and decoding.

Key differences from draft-17:

  • Required Request ID Delta field removed from every request message.
  • SUBSCRIBE_NAMESPACE renumbered to 0x50 and subscribe_options removed.
  • New SUBSCRIBE_TRACKS message (0x51); FORWARD parameter belongs here.
  • PUBLISH_OK collapsed into REQUEST_OK (0x07); REQUEST_OK gains a trailing Track Properties block (length implicit from message length).
  • GOAWAY gains an optional request_id (control stream only).
  • REQUEST_ERROR gains REDIRECT (0x34) carrying a Redirect structure (connect_uri, track_namespace, track_name) appended after reason_phrase.
  • PUBLISH_DONE status codes 0x5/0x6 swapped: 0x5 = TOO_FAR_BEHIND, 0x6 = EXPIRED.
  • DELIVERY_TIMEOUT (0x02) renamed to OBJECT_DELIVERY_TIMEOUT; new SUBGROUP_DELIVERY_TIMEOUT (0x06) and FILL_TIMEOUT (0x0A).
  • New TRACK_NAMESPACE_PREFIX parameter (0x34) for REQUEST_UPDATE, carrying a bare Track Namespace (Section 2.4.1) with no length ahead of it.

Re-exportsΒ§

pub use crate::error::CodecError;
pub use crate::error::MAX_GOAWAY_URI_LENGTH;
pub use crate::error::MAX_MESSAGE_LENGTH;
pub use crate::error::MAX_NAMESPACE_TUPLE_SIZE;
pub use crate::error::MAX_REASON_PHRASE_LENGTH;

ModulesΒ§

publish_done_codes
Numeric values for the PublishDone::status_code field.
request_error_codes
REQUEST_ERROR error codes that gain dedicated meaning in draft-18.

StructsΒ§

Fetch
FetchOk
FETCH_OK (0x18). end_of_track is uint8.
GoAway
GOAWAY (0x10). Sent on the control stream (with request_id) or on an individual request stream (without request_id).
Namespace
NamespaceDone
Publish
PublishBlocked
PublishDone
PUBLISH_DONE (0x0B). Status codes 0x5/0x6 are swapped vs draft-17.
PublishNamespace
Redirect
Optional Redirect structure carried in REQUEST_ERROR with code 0x34.
RequestError
REQUEST_ERROR (0x05). Adds an optional Redirect structure when error_code is REDIRECT (0x34).
RequestOk
REQUEST_OK (0x07). Used as a generic OK response and as the alias for PUBLISH_OK / REQUEST_UPDATE_OK / TRACK_STATUS_OK / SUBSCRIBE_NAMESPACE_OK / PUBLISH_NAMESPACE_OK.
RequestUpdate
Setup
Unified SETUP (0x2F00).
Subscribe
SubscribeNamespace
SUBSCRIBE_NAMESPACE (0x50). Subscribes to NAMESPACE / NAMESPACE_DONE advertisements for namespaces matching namespace_prefix. The subscribe_options byte from draft-17 is removed; namespace subscriptions only produce NAMESPACE / NAMESPACE_DONE.
SubscribeOk
SUBSCRIBE_OK (0x04).
SubscribeTracks
SUBSCRIBE_TRACKS (0x51, new in draft-18). Subscribes to PUBLISH messages for tracks whose namespace matches namespace_prefix. Carries the FORWARD parameter (which previously lived on SUBSCRIBE_NAMESPACE).
TrackStatus

EnumsΒ§

ControlMessage
FetchPayload
FetchType
MessageType
ParamEncoding πŸ”’
How a parameter value is encoded on the wire.

ConstantsΒ§

AUTHORIZATION_TOKEN πŸ”’
The one parameter type draft-18 lets a message carry more than once.
IMMUTABLE_PROPERTIES πŸ”’
Immutable Properties, Property Type 0xB.
KNOWN_SETUP_OPTIONS πŸ”’
The Setup Option types this draft defines.
REPEATABLE_SETUP_OPTION πŸ”’
The one Setup Option whose definition allows more than one instance.

FunctionsΒ§

add_delta πŸ”’
Add a delta to the previous delta-encoded key.
check_authorization_tokens πŸ”’
Hold every AUTHORIZATION TOKEN parameter to the Token structure it names.
check_discriminators πŸ”’
Refuse a message whose discriminator disagrees with the fields beside it.
check_full_track_name πŸ”’
Hold a namespace-plus-name pair to the Full Track Name cap.
check_parameter_scope πŸ”’
Refuse a message carrying a Message Parameter its own definition does not place there.
check_ranges πŸ”’
Refuse a FETCH whose range ends before it starts.
check_subscription_filters πŸ”’
Hold every SUBSCRIPTION_FILTER parameter to the filter structure it names.
check_track_property_values πŸ”’
Refuse a Track Property whose value falls outside the range its type allows, wherever in the list it is carried.
decode_kvp_delta πŸ”’
Decode delta-encoded KVPs with even/odd convention (for setup options and track properties). Read until buffer is exhausted.
decode_parameters πŸ”’
Decode a count-prefixed list of parameters with delta-encoded types.
decode_setup_options πŸ”’
Decode the Setup Options of a SETUP message.
decode_track_properties πŸ”’
Decode the Track Properties that fill the tail of a control message.
encode_kvp_delta πŸ”’
Encode delta-encoded KVPs with even/odd convention.
encode_parameters πŸ”’
Encode a count-prefixed list of parameters with delta-encoded types.
encode_setup_options πŸ”’
Encode the Setup Options of a SETUP message.
encode_track_properties πŸ”’
Encode a control message’s Track Properties.
is_location_value πŸ”’
Whether bytes is exactly the wire form of a Location β€” two consecutive varints and nothing after them.
is_track_namespace_value πŸ”’
Whether bytes is exactly the wire form of a Track Namespace, with nothing after it. The same reasoning as is_location_value: the value goes out verbatim, so it has to be something this draft can read back.
param_encoding πŸ”’
parameter_in_scope πŸ”’
Whether draft-18 lets Message Parameter key appear in message.
track_property_value_in_range πŸ”’
Whether value is inside the range draft-18 allows for a Track Property type that restricts one.
uint8_value_in_range πŸ”’
Whether value is inside the range draft-18 allows for a uint8-valued parameter.