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: u64The 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
impl TrackObjects
Sourcepub fn new(
locations: Arc<Mutex<TrackLocations>>,
namespace: TrackNamespace,
name: Vec<u8>,
alias: u64,
) -> Self
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.
Sourcepub fn note(
&self,
at: ObjectLocation,
role: ObjectRole,
) -> Result<(), EndOfTrackPlacement>
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.
Sourcepub fn note_with_final_object(
&self,
at: ObjectLocation,
role: ObjectRole,
) -> Result<(), TrackFault>
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.
Sourcepub fn note_past_final(
&self,
at: ObjectLocation,
role: ObjectRole,
) -> Result<(), ObjectLocation>
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.
Sourcepub fn note_final_object(&self, at: ObjectLocation)
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.
Sourcepub fn check_not_past_final(
&self,
at: ObjectLocation,
) -> Result<(), ObjectLocation>
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.
Sourcepub fn observe(&self, at: ObjectLocation)
pub fn observe(&self, at: ObjectLocation)
Record an object this track produced. See TrackLocations::observe.
Sourcepub fn check_end_of_track(
&self,
at: ObjectLocation,
form: EndOfTrackForm,
) -> Result<(), EndOfTrackPlacement>
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.
Sourcefn locked(&self) -> MutexGuard<'_, TrackLocations>
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
impl Clone for TrackObjects
Source§fn clone(&self) -> TrackObjects
fn clone(&self) -> TrackObjects
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more