Repository navigation
Description
Context: we run a moq-net/moq-tokio server that serves many viewers from one shared upstream producer and must enforce per-viewer policy (revocation, slow-viewer isolation, bounded queues). References are pinned to release @ c636e03 (identical to moq-net 0.3.22 for these files).
Related: this is one of three small, independent proposals (lifecycle observer, selective request cancel, serving reservations). We are carrying prototypes locally and are happy to open PRs if the direction is welcome.
Cache capacity and media max-age are useful policies but do not enforce strict
viewer queue bytes or wall-clock residence. cache::Pool explicitly converges
toward a target and may exceed it (moq-net/src/model/cache.rs 120–127);
media timestamp age stops advancing during a source stall
(moq-net/src/model/track.rs 91–102). Lite serving retains child group tasks,
frame batches, pending chunks and ACK-waiting writers
(moq-net/src/lite/publisher.rs 2319–2347, 2563–2579, 2601–2617).
IETF additionally prebuffers fetched frames
(moq-net/src/ietf/publisher.rs 57–65, 1502–1537).
There are existing ingress safeguards: 32 MiB/group and 8192 frames/group
(moq-net/src/model/group.rs 29–40) and a private 16 MiB speculative frame
allocation budget that falls back to incremental growth when exhausted
(moq-net/src/model/frame.rs 132–163). Those do not provide the requested
hard serving reservations; the proposal must preserve their existing protection.
Could serving expose a generic reservation seam and monotonic pending-time
notifications so applications can implement strict multi-level limits?
Proposed API sketch
trait ServeBudget {
fn try_reserve(&self, ctx: &ReadContext, bytes: u64,
since: Instant) -> Result<Reservation, Error>;
}
// Reservation releases on Drop; explicit transfer changes the owner domain.
// A pending request registers a wakeable deadline, even without media progress.Land the RAII seam and one Lite group admission/write path first. Add remaining
Lite paths and IETF prebuffering as independently reviewable follow-ups. The
hook defaults to disabled and does not reinterpret existing cache capacity as a
hard cap. Surface unsupported/uninstrumented paths explicitly to applications
requiring full accounting.
Admission occurs before allocation or new payload retention, including a batch
fill and a blocked stream open. Incremental frames reserve declared size or
bounded increments before growth; oversized objects fail before allocation.
Keep logical reader debt distinct from physical shared allocation ownership;
the latter remains charged until the last clone releases it. Transport
acceptance transfers ownership into a separately bounded transport domain and
does not mean delivery. Reset/error/EOF must return reservations exactly once.
Headers/control/metadata need separate finite bounds rather than being hidden
in payload counters. The host implements atomic track/broadcast/process budget
checks; library code does not hard-code tenant policy or application thresholds.
Tests we would expect: simultaneous limits across tracks/sessions,
partial frames, detached fetch batches, datagrams, pending opens, FIN/ACK wait,
error/reset cleanup and silent publishers under blocked transport. A clock
deadline must fire without unrelated polling activity. Verify preallocation
refusal and reconcile held references/copies against counters. Our application needs
1 MiB/track, 4 MiB/broadcast, 64 MiB/process and 50 ms pending age, with selective
cancel ≤100 ms; those are application requirements, not proven library promises.
Activity
scottgreen129 commentedon Nov 18, 2026
Related proposals: #9093 (serving lifecycle observer), #9094 (selective request cancel), #9095 (serving reservations). Each is independent and additive; disabled by default.
coderabbitai commentedon Nov 18, 2026
🔗 Related PRs
#7388 - feat(net): pace relay ingest by the group's fastest reader [merged]
📝 Issue Planner
Check the box below or use the
@coderabbitai plancommand to generate an implementation plan and prompts that you can use with your favorite coding assistant.🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord!