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
Config::compression set to crate::Compression::Deflate, 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 segment cadence); a consumer that finds a gap can fetch or
extrapolate.
A record that cannot be encoded or written therefore ends the track rather than continuing in a second group: a log missing a record is not lossless, and a gap dressed up as a complete log is worse than a visible failure. A publisher with more to say opens a new track.
That single group is what bounds the log’s history. moq-net caps a group’s cached bytes and
frame count, and a consumer always starts at frame 0, so a write that would outgrow the
budget aborts the group with moq_net::Error::GroupTooLarge rather than dropping a prefix
some readers missed. (With compression the retained suffix would be undecodable anyway,
since its DEFLATE window depends on the dropped 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.
Re-exports§
Modules§
- consumer
- Consuming an ordered log from a track: a
Decoderplus the track it reads from. - producer
- Publishing an ordered log over a track: an
Encoderplus the track it writes to.
Structs§
- Config
- Codec options for an
Encoder, and so for theProducerwrapping 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.