Skip to main content

Module message

Module message 

Source
Expand description

Draft-19 control message encoding and decoding.

Key differences from draft-18:

  • Request ID field removed from GOAWAY entirely; the control-stream and request-stream forms are now identical.
  • New Range Filter parameters (length-prefixed): SUBGROUP_FILTER (0x25), OBJECTID_FILTER (0x26), PRIORITY_FILTER (0x27), OBJECT_PROPERTY_FILTER (0x28) and TRACK_PROPERTY_FILTER (0x29).
  • New Setup Options MAX_FILTER_RANGES (0x06) and MAX_REQUEST_UPDATES (0x08); both are even KVP types carrying a varint value.
  • GROUP_ORDER (0x22) moves from PUBLISH_OK to SUBSCRIBE_TRACKS (the wire encoding of the parameter is unchanged).
  • PUBLISH_BLOCKED renamed to PUBLISH_SKIPPED (still type 0x0F; wire identical).
  • SUBSCRIPTION_FILTER renamed to LOCATION_FILTER (still parameter 0x21).
  • REQUEST_ERROR adds CONFLICTING_FILTERS (0x35) and INVALID_FILTER (0x36); DUPLICATE_SUBSCRIPTION (0x19) is removed.
  • The framing field after Message Length is named Message Body (draft-19 Section 10, Figure 3); earlier drafts called it Message Payload. The change is editorial, so the bytes are unchanged, but this module uses the new name.

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 with dedicated meaning.

Structs§

Fetch
FetchOk
FETCH_OK (0x18). end_of_track is uint8.
GoAway
GOAWAY (0x10). Draft-19’s GOAWAY has no Request ID field, so the control-stream and request-stream forms are identical on the wire. Draft-18 is the one draft that carries the field, and only when the message is sent on the control stream.
Namespace
NamespaceDone
Publish
PublishDone
PUBLISH_DONE (0x0B). Status codes 0x5/0x6 are swapped vs draft-17.
PublishNamespace
PublishSkipped
PUBLISH_SKIPPED (0x0F). Drafts 17 and 18 name the same codepoint PUBLISH_BLOCKED, with the same two fields.
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 (Section 10.2.17), which on drafts 15 through 17 may appear on SUBSCRIBE_NAMESPACE instead.
TrackStatus

Enums§

ControlMessage
FetchPayload
FetchType
MessageType
ParamEncoding 🔒
How a parameter value is encoded on the wire.

Constants§

AUTHORIZATION_TOKEN 🔒
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 LOCATION_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-19 lets Message Parameter key appear in message.
parameter_may_repeat 🔒
Whether a message may carry key more than once.
track_property_value_in_range 🔒
Whether value is inside the range draft-19 allows for a Track Property type that restricts one.
uint8_value_in_range 🔒
Whether value is inside the range draft-19 allows for a uint8-valued parameter.