Skip to main content

TrackObjects

Struct TrackObjects 

Source
pub struct TrackObjects {
    locations: Arc<Mutex<TrackLocations>>,
    namespace: TrackNamespace,
    name: Vec<u8>,
    alias: u64,
}
Expand description

One track’s record, held by whatever is reading that track’s objects.

§Why the stream holds this and not the endpoint

The objects are read one at a time off a stream handle the caller owns, and that handle has no way back to the session — the same shape trap the close table has, and the reason Connection::close_for_data_stream exists. A record reachable only from the endpoint would leave the rule enforceable only by a caller that remembered to ask, which for a conformance crate is not enforcement. So the endpoint hands one of these to each stream it opens for a track it can name, the stream measures every object it decodes against it, and a stream nobody handed one to behaves exactly as it did before.

The clone is of the handle, not of the record: every stream on a session measures against the same TrackLocations, which is what makes the largest group a property of the track rather than of one stream.

Fields§

§locations: Arc<Mutex<TrackLocations>>§namespace: TrackNamespace§name: Vec<u8>§alias: u64

The Track Alias this handle was resolved from.

Carried for the report only, so it can name the track the way the wire did. Nothing is keyed on it — see the module documentation for why the record itself is keyed on the track.

Implementations§

Source§

impl TrackObjects

Source

pub fn new( locations: Arc<Mutex<TrackLocations>>, namespace: TrackNamespace, name: Vec<u8>, alias: u64, ) -> Self

Bind a record to the track an alias resolved to.

Source

pub fn alias(&self) -> u64

The Track Alias this handle was resolved from.

Source

pub fn note( &self, at: ObjectLocation, role: ObjectRole, ) -> Result<(), EndOfTrackPlacement>

Record or judge one object, by what its status makes of it.

The one entry point both data paths use, so a subgroup object and a datagram cannot come to disagree about which statuses count.

Source

pub fn note_with_final_object( &self, at: ObjectLocation, role: ObjectRole, ) -> Result<(), TrackFault>

Self::note, and the final-object rule with it, for the drafts that state one.

The two rules are checked in the order that gives each the objects it is about. Where the track ended is asked first, because an object past the end is one this endpoint is giving up the track over and there is nothing to be gained by writing it into the record on the way past.

§Every object, and not only the produced ones

The sentence names an Object without qualifying it, and this reads it that way: a second end-of-track object naming a later place, or an End of Group beyond where the track stopped, is as much a track that carried on after its end as an ordinary object would be. That is the opposite of how TrackLocations::observe treats a status, and the two are not in tension — a status is not a produced object, which is what that record counts, but it is still an object received, which is what this one asks about.

Source

pub fn note_past_final( &self, at: ObjectLocation, role: ObjectRole, ) -> Result<(), ObjectLocation>

The final-object rule on its own, for the drafts that state no rule about where an end-of-track object may be placed.

The same rule Self::note_with_final_object applies, and a different set of answers: a draft that judges nothing about placement has one fault to report and not two, so its callers are handed the one rather than an enum with an arm they cannot reach. Which entry point a draft uses is the whole of what it says about the rule beside this one.

An end-of-track object settles where the track ended whatever form its status names, because the form only says how to judge a placement and this judges none.

Source

pub fn note_final_object(&self, at: ObjectLocation)

Write down where an end-of-track object says the track ended. See TrackLocations::note_final_object.

Source

pub fn check_not_past_final( &self, at: ObjectLocation, ) -> Result<(), ObjectLocation>

Judge an object against where the track ended. See TrackLocations::check_not_past_final.

Source

pub fn observe(&self, at: ObjectLocation)

Record an object this track produced. See TrackLocations::observe.

Source

pub fn check_end_of_track( &self, at: ObjectLocation, form: EndOfTrackForm, ) -> Result<(), EndOfTrackPlacement>

Judge an end-of-track object’s placement. See TrackLocations::check_end_of_track.

Source

fn locked(&self) -> MutexGuard<'_, TrackLocations>

The record, with a poisoned lock recovered rather than propagated.

Nothing here can leave the record in a state a later reader is misled by: every mutation is one field of one entry, and a panic between the read and the write leaves the entry as it was.

Trait Implementations§

Source§

impl Clone for TrackObjects

Source§

fn clone(&self) -> TrackObjects

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

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.

§

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> 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.
§

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