Skip to main content

TrackLocations

Struct TrackLocations 

Source
pub struct TrackLocations {
    tracks: Vec<TrackRecord>,
}
Expand description

How far each track’s objects have reached, so far.

A list rather than a map, and for the same reason the endpoint’s own table of track aliases is one: a session holds a handful of tracks, and TrackNamespace has no Hash.

Fields§

§tracks: Vec<TrackRecord>

Implementations§

Source§

impl TrackLocations

Source

pub fn new() -> Self

An empty record, for a session that has carried no objects yet.

Source

pub fn observe( &mut self, namespace: &TrackNamespace, name: &[u8], at: ObjectLocation, )

Record an object a track produced.

Only status Normal reaches here; see the module documentation for why an End of Group object would raise the largest object by one and refuse the End of Track object that follows it.

Source

pub fn check_end_of_track( &self, namespace: &TrackNamespace, name: &[u8], at: ObjectLocation, form: EndOfTrackForm, ) -> Result<(), EndOfTrackPlacement>

Judge where an end-of-track object says the track ended.

Ok when the track has carried nothing yet: there is no group for the object to be behind, and a receiver that refused it would be enforcing an ordering against an empty record.

Source

pub fn note_final_object( &mut self, namespace: &TrackNamespace, name: &[u8], at: ObjectLocation, )

Write down where an end-of-track object says the track ended.

Called only after Self::check_end_of_track has accepted it, so a location this record would refuse never becomes the one later objects are measured against.

The first one is kept. A second end-of-track object on a track that has already ended is itself past the final object on every ordering, so letting it move the mark would answer the fault by adopting it.

Source

pub fn check_not_past_final( &self, namespace: &TrackNamespace, name: &[u8], at: ObjectLocation, ) -> Result<(), ObjectLocation>

Judge an ordinary object against where the track ended.

Ok on a track no end-of-track object has been seen for: there is no final object for this one to be past, and a receiver that refused it would be giving up a track for arriving.

The comparison is the drafts’ own Location ordering — Group first, and the Object only where the Groups are equal — so an object in a later group is past the end whatever its Object ID.

Source

fn record( &self, namespace: &TrackNamespace, name: &[u8], ) -> Option<&TrackRecord>

Source

fn record_mut( &mut self, namespace: &TrackNamespace, name: &[u8], ) -> Option<&mut TrackRecord>

Trait Implementations§

Source§

impl Default for TrackLocations

Source§

fn default() -> TrackLocations

Returns the “default value” for a type. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more