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
- Namespace
Done - Publish
- Publish
Blocked - Publish
Done - PUBLISH_DONE (0x0B). No request_id in draft-17.
- Publish
Namespace - Publish
Ok - PUBLISH_OK (0x1E). No request_id in draft-17.
- Request
Error - REQUEST_ERROR (0x05). No request_id in draft-17.
- Request
Ok - REQUEST_OK (0x07). No request_id in draft-17.
- Request
Update - Setup
- Unified SETUP (0x2F00). Replaces ClientSetup/ServerSetup.
- Subscribe
- Subscribe
Namespace - Subscribe
Ok - SUBSCRIBE_OK (0x04). No request_id in draft-17. Gains track_properties.
- Track
Status
EnumsΒ§
- Control
Message - Fetch
Payload - Fetch
Type - Message
Type - Param
Encoding π - 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
bytesis 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
keyappear inmessage. - track_
property_ πvalue_ in_ range - Whether
valueis inside the range draft-17 allows for a Track Property type that restricts one. - uint8_
value_ πin_ range - Whether
valueis inside the range draft-17 allows for a uint8-valued parameter.