Skip to main content

Module stream

Module stream 

Source
Expand description

Append-log JSON publishing over moq-net tracks.

The counterpart to snapshot mode: instead of one JSON value updated over time, a stream is an ordered log of self-contained records. Every Producer::append writes one JSON object as one frame, and a Consumer yields every record in order.

The whole log rides a single group that is never rolled: with ProducerConfig::compression on, that one group is one DEFLATE window, so every record compresses against all the earlier ones. There is deliberately no group rolling (and so no catch-up machinery): the only reason to roll would be moq-net’s per-group frame cap, which isn’t worth working around here. A caller that wants to bound the record rate throttles at the source (e.g. the timeline’s granularity); a consumer that finds a gap can fetch or extrapolate.

That single group is what bounds the log’s history. moq-net caps a group’s cached bytes, and a consumer always starts at frame 0, so once the log outgrows that budget and the earliest frames are evicted a new consumer fails with moq_net::Error::Lagged rather than reading a partial log. (With compression the retained suffix would be undecodable anyway, since its DEFLATE window depends on the evicted prefix.) The live stream is therefore bounded history by design; deep history is served from a recording.

§Choosing a layer

Producer and Consumer own a track. Encoder and Decoder are the same logic without it, for when something else is already in charge of the track; they carry the shared DEFLATE window and nothing else, since a log has no group boundaries to report.

Structs§

Consumer
Consumes an ordered log of JSON records from a track, yielding every record in order.
ConsumerConfig
Configuration for a Decoder, and so for the Consumer wrapping one.
Decoder
Decodes JSON records from frame payloads, sharing one DEFLATE window across the log.
Encoder
Encodes JSON records into frame payloads, sharing one DEFLATE window across the log.
Pending
An encoded record the caller has not yet acknowledged writing.
Producer
Publishes an ordered log of JSON records over a track, one record per frame in a single group.
ProducerConfig
Configuration for an Encoder, and so for the Producer wrapping one.