pub struct FetchObjectReader {
group_order: GroupOrder,
prior_location: Option<(u64, u64)>,
prior_subgroup_id: Option<u64>,
prior_publisher_priority: Option<u8>,
gaps: FetchGaps,
}Expand description
Resolves the delta-encoded fields of the entries on one FETCH stream.
Section 11.4.2.2 keeps two kinds of prior state apart. After an End of Range indicator, “Prior Group ID and prior Object ID: The decoded values from the End of Range indicator”, while the prior Subgroup ID and Priority come from “the last actual Object before the End of Range indicator”. After End of Group or End of Track, “The prior Object ID becomes 2^64-1”.
Fields§
§group_order: GroupOrder§prior_location: Option<(u64, u64)>Group ID and Object ID the next entry resolves against.
prior_subgroup_id: Option<u64>Subgroup ID of the last actual Object that had one.
prior_publisher_priority: Option<u8>Publisher Priority of the last actual Object.
gaps: FetchGapsThe Prior gap conditions the stream’s Objects show.
Implementations§
Source§impl FetchObjectReader
impl FetchObjectReader
Sourcepub fn new(group_order: GroupOrder) -> Self
pub fn new(group_order: GroupOrder) -> Self
A reader for a stream whose Groups arrive in group_order.
Sourcepub fn read_object_header(
&mut self,
buf: &mut impl Buf,
) -> Result<FetchObject, CodecError>
pub fn read_object_header( &mut self, buf: &mut impl Buf, ) -> Result<FetchObject, CodecError>
Decode the next entry’s header and resolve its fields.
Consumes the header only; the Object Payload stays in buf.
CodecError::MalformedObject for an entry that references a prior
Object that does not exist. Section 11.4.1.1: “If the first Object in
the FETCH response uses a flag that references fields in the prior
Object, the Subscriber MUST close the session with MALFORMED_OBJECT.”
End of Group or End of Track as the first entry names a prior Object
too, and is refused the same way.
CodecError::DeltaDecodingOverflow for an ID below 0 or above
2^64-1 (Section 11.4.1.1 and Section 11.4.2.1).
Refuses, with CodecError::MalformedTrack, the Prior gap conditions an
Object shows alone or after the Objects before it on the stream, as
FetchGaps does, and a property block that does not parse as
crate::object_properties::parse_object_properties does.
Sourcepub(crate) fn read_frame_header(
&mut self,
buf: &mut impl Buf,
) -> Result<FetchObject, CodecError>
pub(crate) fn read_frame_header( &mut self, buf: &mut impl Buf, ) -> Result<FetchObject, CodecError>
Self::read_object_header without the Prior gap conditions and without reading
inside the property block, for the facade’s frame and meta reads, which
a forwarder uses.
Sourcefn object_location(
&self,
header: &FetchObjectHeader,
) -> Result<(u64, u64), CodecError>
fn object_location( &self, header: &FetchObjectHeader, ) -> Result<(u64, u64), CodecError>
An Object’s Location, Section 11.4.1.1.
Sourcefn range_location(
&self,
header: &FetchObjectHeader,
) -> Result<(u64, u64), CodecError>
fn range_location( &self, header: &FetchObjectHeader, ) -> Result<(u64, u64), CodecError>
An End of Range indicator’s Location, Section 11.4.2.1.