pub struct Consumer<E = ()> { /* private fields */ }Expand description
Reads typed catalog roots from a catalog track, subscribing to it at catalog priority.
Implementations§
Source§impl<E: DeserializeOwned + Default> Consumer<E>
impl<E: DeserializeOwned + Default> Consumer<E>
Sourcepub fn new(track: Consumer, delay: Duration) -> Self
pub fn new(track: Consumer, delay: Duration) -> Self
Read a catalog track, compressed or not, for a reader playing delay behind the live edge.
Subscribes to it at the catalog’s priority, as Catalog::default_subscription does. A zero delay reads only
the newest catalog, for a reader that applies each on arrival. A reader that holds each update
until its media reaches the update’s timestamp passes its playout delay instead, and reads
every update in order that it may still need: an update stays deliverable until it falls
delay behind the live edge. See [moq_json::snapshot::Consumer::new].
Sourcepub fn poll_info(&mut self, waiter: &Waiter) -> Poll<Result<Info>>
pub fn poll_info(&mut self, waiter: &Waiter) -> Poll<Result<Info>>
Wait for the consumer’s subscription to resolve, returning the catalog track’s info.
Fails with Error::Moq if the catalog is refused or missing, on the
same subscription the reads use; see [moq_json::snapshot::Consumer::poll_info].
Sourcepub fn poll_next(
&mut self,
waiter: &Waiter,
) -> Poll<Result<Option<Timed<Catalog<E>>>>>
pub fn poll_next( &mut self, waiter: &Waiter, ) -> Poll<Result<Option<Timed<Catalog<E>>>>>
Get the next catalog update and its timestamp, or None when the track ends.
The update takes effect at at on the broadcast’s media timeline, so a caller holds one it
reads before its media reaches at, and applies one read late, or the first it reads, at
once. On a scale-less catalog track at is a group key with no time, so the update applies on
arrival.
Fails with Error::EscapingBroadcast if any rendition’s
broadcast reference, include, or echo prefix walks above the root. Such a reference names no broadcast, and the
root is the consumer’s authorized subtree, so it is an attempt to reference content the
consumer cannot name. The whole catalog is rejected rather than the one rendition: a
publisher that emits one has a bug (or is hostile), and silently serving the rest hides
that from the operator while the missing rendition surfaces much later as a track that
never fills.