Skip to main content

FetchObjectReader

Struct FetchObjectReader 

Source
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: FetchGaps

The Prior gap conditions the stream’s Objects show.

Implementations§

Source§

impl FetchObjectReader

Source

pub fn new(group_order: GroupOrder) -> Self

A reader for a stream whose Groups arrive in group_order.

Source

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.

Source

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.

Source

fn object_location( &self, header: &FetchObjectHeader, ) -> Result<(u64, u64), CodecError>

An Object’s Location, Section 11.4.1.1.

Source

fn range_location( &self, header: &FetchObjectHeader, ) -> Result<(u64, u64), CodecError>

An End of Range indicator’s Location, Section 11.4.2.1.

Trait Implementations§

Source§

impl Clone for FetchObjectReader

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FetchObjectReader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.