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
impl TrackLocations
Sourcepub fn observe(
&mut self,
namespace: &TrackNamespace,
name: &[u8],
at: ObjectLocation,
)
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.
Sourcepub fn check_end_of_track(
&self,
namespace: &TrackNamespace,
name: &[u8],
at: ObjectLocation,
form: EndOfTrackForm,
) -> Result<(), EndOfTrackPlacement>
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.
Sourcepub fn note_final_object(
&mut self,
namespace: &TrackNamespace,
name: &[u8],
at: ObjectLocation,
)
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.
Sourcepub fn check_not_past_final(
&self,
namespace: &TrackNamespace,
name: &[u8],
at: ObjectLocation,
) -> Result<(), ObjectLocation>
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.