Skip to main content

Module message

Module message 

Source
Expand description

Draft-17 control message encoding and decoding.

Key differences from draft-16:

  • Framing: Type (varint) + Length (16-bit fixed) + Payload.
  • Unified SETUP (0x2F00) with delta-encoded KVP options (even/odd).
  • Parameters: count-prefixed, delta-encoded types, type-specific value encoding.
  • RequestOk/RequestError/PublishOk/PublishDone/FetchOk: no request_id.
  • Request messages gain required_request_id_delta.
  • New: PublishBlocked. FetchType gains AbsoluteJoining.
  • SubscribeOk/Publish/FetchOk gain track_properties after parameters.
  • Removed: ClientSetup, ServerSetup, MaxRequestId, RequestsBlocked, Unsubscribe, PublishNamespaceDone, PublishNamespaceCancel, FetchCancel.

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;

StructsΒ§

Fetch
FetchOk
FETCH_OK (0x18). No request_id in draft-17. end_of_track is uint8.
GoAway
Namespace
NamespaceDone
Publish
PublishBlocked
PublishDone
PUBLISH_DONE (0x0B). No request_id in draft-17.
PublishNamespace
PublishOk
PUBLISH_OK (0x1E). No request_id in draft-17.
RequestError
REQUEST_ERROR (0x05). No request_id in draft-17.
RequestOk
REQUEST_OK (0x07). No request_id in draft-17.
RequestUpdate
Setup
Unified SETUP (0x2F00). Replaces ClientSetup/ServerSetup.
Subscribe
SubscribeNamespace
SubscribeOk
SUBSCRIBE_OK (0x04). No request_id in draft-17. Gains track_properties.
TrackStatus

EnumsΒ§

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

ConstantsΒ§

AUTHORIZATION_TOKEN πŸ”’
The one parameter type draft-17 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_required_request_id_delta πŸ”’
Hold a request message’s Required Request ID Delta to the bound its own Request ID sets.
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.
param_encoding πŸ”’
parameter_in_scope πŸ”’
Whether draft-17 lets Message Parameter key appear in message.
track_property_value_in_range πŸ”’
Whether value is inside the range draft-17 allows for a Track Property type that restricts one.
uint8_value_in_range πŸ”’
Whether value is inside the range draft-17 allows for a uint8-valued parameter.