pub struct FetchObjectHeader {
pub serialization_flags: VarInt,
pub group_id_delta: Option<VarInt>,
pub subgroup_id: Option<VarInt>,
pub object_id_delta: Option<VarInt>,
pub publisher_priority: Option<u8>,
pub properties: Option<Vec<u8>>,
pub payload_length: VarInt,
}Expand description
One entry on a draft-23 fetch stream, up to but not including its payload.
{
Serialization Flags (vi64),
[Group ID Delta (vi64),]
[Subgroup ID (vi64),]
[Object ID Delta (vi64),]
[Publisher Priority (8),]
[Properties (..),]
Object Payload Length (vi64),
[Object Payload (..),]
}This holds what is on the wire: the deltas, not the IDs they resolve to.
FetchObjectReader resolves them (Section 11.4.1.1 and Section 11.4.2.1).
An entry may be an indicator rather than an Object: Self::end_of_range
and Self::end_marker say which.
Fields§
§serialization_flags: VarIntThe raw Serialization Flags value, kept whole because it also names an indicator and because re-encoding must reproduce the publisher’s value.
group_id_delta: Option<VarInt>Group ID Delta, present when the flags set 0x08 and on every End of Range indicator.
subgroup_id: Option<VarInt>An explicit Subgroup ID, present only when the two low flag bits are 0b11 and the Datagram bit is clear.
object_id_delta: Option<VarInt>Object ID Delta, present when the flags set 0x04 and on every End of Range indicator.
publisher_priority: Option<u8>Publisher Priority, present when the flags set 0x10.
properties: Option<Vec<u8>>Raw properties bytes, excluding their length prefix, and None when
the flags leave 0x20 clear.
payload_length: VarIntObject Payload Length. Zero, and not on the wire, for End of Group and End of Track.
Implementations§
Source§impl FetchObjectHeader
impl FetchObjectHeader
Sourcepub fn end_of_range(&self) -> Option<FetchEndOfRange>
pub fn end_of_range(&self) -> Option<FetchEndOfRange>
Which End of Range indicator this is, or None for anything else.
Sourcepub fn end_marker(&self) -> Option<FetchEndMarker>
pub fn end_marker(&self) -> Option<FetchEndMarker>
Which of End of Group and End of Track this is, or None for anything
else.
Sourcepub fn is_indicator(&self) -> bool
pub fn is_indicator(&self) -> bool
true for any Table 8 indicator, false for an Object.
Sourcepub fn subgroup_id_mode(&self) -> u8
pub fn subgroup_id_mode(&self) -> u8
The two-bit Subgroup ID mode, flags & 0x03 (Section 11.4.1.1,
Table 9). Meaningless when Self::is_datagram is true.
Sourcepub fn is_datagram(&self) -> bool
pub fn is_datagram(&self) -> bool
true when the flags set 0x40, marking an Object whose Delivery Mode
is Datagram, which has no Subgroup ID.
Sourcefn layout(flags: u64) -> Result<FetchObjectLayout, CodecError>
fn layout(flags: u64) -> Result<FetchObjectLayout, CodecError>
Which fields flags puts on the wire.
Values below 128 are flags. Table 8 defines six values above that, and Section 11.4.1: “If an endpoint receives any other value greater than 127, it MUST close the session with MALFORMED_OBJECT.”
Section 11.4.2: on an End of Range indicator “the Group ID Delta and Object ID Delta fields are always present. Subgroup ID, Priority and Properties are not present.” Figure 29 makes Object Payload Length mandatory and Section 11.4.2 does not list it among the absent fields, so it is present, and written as 0. On End of Group and End of Track “no other fields are present”, so there is no Object Payload Length either.
Sourcepub fn decode(buf: &mut impl Buf) -> Result<Self, CodecError>
pub fn decode(buf: &mut impl Buf) -> Result<Self, CodecError>
Decode one fetch entry’s header, leaving the payload in buf.
The flags are validated before any field is read, because they are what says where the fields are.
Sourcepub fn encode(&self, buf: &mut impl BufMut) -> Result<(), CodecError>
pub fn encode(&self, buf: &mut impl BufMut) -> Result<(), CodecError>
Serialize the header, refusing one whose fields disagree with its own Serialization Flags.
CodecError::InvalidField when an optional field is present while its
flag says absent or the reverse, and for an End of Group or End of
Track with a non-zero payload length. Checked before any byte is
written.