Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion quest/m1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ removed).
- [A job's exact route continues its claim's readers](/quest/m1/announce-takeover.md) - a job's route inherits its claim's identity, replacing the ANNOUNCE_TAKEOVER predecessor design
- [Subscribe ranges](/quest/m1/subscribe-ranges/README.md) - a lite-07 SUBSCRIBE asks for past and live ranges with absolute or relative ends, in either order, and replaces FETCH; merged ranges never starve a subscriber; relays fill misses by range, including over moq-transport
- [Drop set](/quest/m1/drop-set.md) - each cursor judges missing groups against its own budget, so a narrow reader drops promptly and a widening re-offers groups already reported dropped on lite-07
- [A tightened SUBSCRIBE keeps the start's budget honest](/quest/m1/start-budget-update.md) - a relay copy records the delay its start was resolved under, so a SUBSCRIBE_UPDATE tightening cannot make later readers skip fillable history
- [Broadcast archives](/quest/m1/archive/README.md) - ANNOUNCE, TRACKS, and a SUBSCRIBE per track record every track under a prefix to any object_store, a host serves a stored broadcast back, and the catalog drops its archive pointer for a per-rendition `hls` field
- [Finalize moq-lite-07](/quest/m1/lite07-finalize.md) - when the maintainer cuts it, lite-07 negotiates as `moq-lite-07` and the next release ships it
- [Smoke token subject](/quest/m1/smoke-token-subject.md) - condition: grant subject ships; then the release smoke test signs with `--subject`
Expand Down
54 changes: 0 additions & 54 deletions quest/m1/start-budget-update.md

This file was deleted.

11 changes: 1 addition & 10 deletions rs/moq-net/src/lite/subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2140,7 +2140,6 @@ mod tests {
.unwrap(),
id: 0,
max_delay: Duration::ZERO,
requested_max_delay: Duration::ZERO,
start: None,
priority: 0,
requested: None,
Expand Down Expand Up @@ -2316,7 +2315,6 @@ mod tests {
.unwrap(),
id: 0,
max_delay: Duration::ZERO,
requested_max_delay: Duration::ZERO,
start: Some(floor),
priority: 0,
requested: Some(floor),
Expand Down Expand Up @@ -2773,7 +2771,6 @@ mod tests {
stream,
id: 0,
max_delay: Duration::ZERO,
requested_max_delay: Duration::ZERO,
start: Some(2),
priority: 0,
requested: Some(2),
Expand Down Expand Up @@ -6741,9 +6738,6 @@ struct SubStream {
/// start sits elsewhere the request-tracked floor stands instead, and demand
/// returning here makes the declaration valid again.
requested: Option<u64>,
/// The max delay the SUBSCRIBE itself carried, fixed for the stream's life: a lite-06+
/// SUBSCRIBE_START resolves the start from it, skipping older groups as stale.
requested_max_delay: Duration,
/// The groups received for this subscription, shared with its [`TrackEntry`].
tail: kio::Producer<Tail>,
/// The first group the publisher serves (SUBSCRIBE_START), once declared.
Expand Down Expand Up @@ -7516,7 +7510,6 @@ impl Establish {
stream,
id: self.id,
max_delay: wire_max_delay(self.subscription.max_delay),
requested_max_delay: wire_max_delay(self.subscription.max_delay),
start: self.subscription.start(),
ranges: self.ranges.clone(),
priority: self.subscription.priority,
Expand Down Expand Up @@ -8517,9 +8510,7 @@ impl ServeLoop {
// request-tracked floor stands rather than a guess.
if active.start == active.requested {
let _ = match (serve.subscriber.version.resolves_start(), served) {
(true, Some(served)) => {
self.serving.start_resolved(served, active.requested_max_delay)
}
(true, Some(served)) => self.serving.start_resolved(served),
_ => self.serving.start_at(served),
};
}
Expand Down
40 changes: 19 additions & 21 deletions rs/moq-net/src/model/track.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,9 @@ pub(crate) struct TrackState {
// [`Subscriber::poll_start`]) wait on it; everything else treats the floor as usual.
start_pending: bool,

// The budget the publisher resolved `start_sequence` from (a lite-06+ SUBSCRIBE_START),
// skipping every older group as stale under it. Cleared by any other declaration.
start_budget: Option<Duration>,
// Whether the publisher resolved `start_sequence` (a lite-06+ SUBSCRIBE_START), which
// may sit above history a reader can still fill. Cleared by any other declaration.
start_resolved: bool,

// A copy received from a remote publisher, whose declared end waits for groups still
// in flight below it (see `tail`), and whose readers' relative and time anchors are
Expand Down Expand Up @@ -2496,7 +2496,7 @@ impl TrackState {
self.latch_settled();
self.start_sequence = start_sequence;
self.start_pending = pending;
self.start_budget = None;
self.start_resolved = false;
if let Some(start) = start_sequence {
self.cache.wakes().arrived(..start);
let now = self.cache.pool().now_wall();
Expand Down Expand Up @@ -3493,13 +3493,14 @@ impl Producer {
Ok(())
}

/// [`Self::start_at`] a start the publisher resolved from `budget`: every older group
/// is stale under it, so a reader whose budget is no looser gives them up unasked.
/// [`Self::start_at`] a start the publisher resolved from its subscriber's budget. An
/// update can cross the response, so that budget is unknown: every older group stays
/// fillable, and a fill that finds none ends empty.
#[cfg_attr(not(feature = "async"), allow(dead_code, reason = "async-only"))]
pub(crate) fn start_resolved(&mut self, sequence: u64, budget: Duration) -> Result<()> {
pub(crate) fn start_resolved(&mut self, sequence: u64) -> Result<()> {
let mut state = self.modify()?;
state.set_start(Some(sequence), false);
state.start_budget = Some(budget);
state.start_resolved = true;
Ok(())
}

Expand Down Expand Up @@ -18807,29 +18808,26 @@ mod test {
assert!(dynamic.poll_requested_fill(&waiter).is_pending());
}

/// Below a start its publisher resolved from a budget, a reader no looser than it gives
/// every group up unasked, while a looser one may still reach some, so it asks.
/// Below a start its publisher resolved, a reader asks for the history its budget
/// reaches: an update may have crossed the start, so the copy cannot tell which budget
/// skipped those groups, and a fill that finds none ends empty.
#[test]
#[cfg(feature = "async")]
fn below_a_start_resolved_from_a_budget_only_a_looser_reader_asks() {
fn below_a_resolved_start_a_reader_asks() {
let mut producer = track_producer("test", Info::timed());
let dynamic = producer.requests();
let mut narrow = producer.subscribe(replay());
let mut wide = producer.subscribe(Subscription::default().with_max_delay(Duration::from_secs(60)));
producer.start_resolved(2, Duration::from_secs(30)).unwrap();
let mut reader = producer.subscribe(replay());
producer.start_resolved(2).unwrap();
write_group(&producer, 2);
write_group(&producer, 3);
let waiter = kio::Waiter::noop();
assert_eq!(drain_groups(&mut narrow), [2, 3]);
assert_eq!(drained_drops(&mut narrow), [(0, 2)]);
assert_eq!(drain_groups(&mut reader), [2, 3]);
assert!(
dynamic.poll_requested_fill(&waiter).is_pending(),
"the narrow reader asks nothing"
drained_drops(&mut reader).is_empty(),
"nothing below the start is given up unasked"
);

assert_eq!(drain_groups(&mut wide), [2, 3]);
let Poll::Ready(Ok(fill)) = dynamic.poll_requested_fill(&waiter) else {
panic!("the wide reader asks below the start");
panic!("the reader asks below the start");
};
assert_eq!((fill.start().group, fill.end()), (0, 2));
}
Expand Down
26 changes: 8 additions & 18 deletions rs/moq-net/src/model/track/miss.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,20 +663,12 @@ impl Misses {
self.judged.insert(run.clone());
}
let start = state.start_sequence.unwrap_or(0);
let (stale_below, unasked) = match state.start_budget {
// Its publisher skipped every older group as stale under a budget no tighter
// than this reader's, so they are stale for it too.
Some(budget) if drift.budget <= budget => (start, false),
// Such a copy cannot tell a group a looser reader's budget reaches, so it leaves
// them to the feed's re-offer.
Some(_) => (0, state.fills_from_start),
// The feed began at the live edge or the floor the copy asked for, so older
// groups are history only a reader naming them asked for.
None => (
0,
state.fills_from_start || state.received && named.is_none_or(|named| named >= start),
),
};
// Below a start its publisher resolved from a budget, which an update may have changed
// in flight, every older group is history a fill may still find. A feed that began at
// the live edge or the floor the copy asked for leaves older groups as history only a
// reader naming them asked for.
let unasked = state.fills_from_start
|| !state.start_resolved && state.received && named.is_none_or(|named| named >= start);
if unasked && start > 0 {
candidates.remove(0..start);
}
Expand Down Expand Up @@ -740,10 +732,8 @@ impl Misses {
// budget is stale throughout.
let stale: Vec<ops::Range<u64>> = asks
.iter()
.filter_map(|run| match state.drifted(run.end - 1, &drift.edge, drift.budget) {
true => Some(run.clone()),
false => Some(run.start..run.end.min(stale_below)).filter(|run| !run.is_empty()),
})
.filter(|run| state.drifted(run.end - 1, &drift.edge, drift.budget))
.cloned()
.collect();
for run in stale {
asks.remove(run.clone());
Expand Down
20 changes: 17 additions & 3 deletions rs/moq-net/tests/integration/support/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl MockSendStream {
&& size > 0
{
if let Some(types) = self.first_byte.take() {
types.lock().unwrap().push(first.expect("non-empty write"));
types.lock().push(first.expect("non-empty write"));
}
self.line.arrivals.lock().unwrap().push_back(self.conn.arrival());
}
Expand Down Expand Up @@ -427,7 +427,7 @@ impl Drop for MockChunks {
type Resets = Arc<Mutex<Vec<u32>>>;

/// The first byte of each bidi stream one side has opened.
type StreamTypes = Arc<Mutex<Vec<u8>>>;
type StreamTypes = Arc<kio::Shared<Vec<u8>>>;

/// One side's knobs.
struct Side {
Expand Down Expand Up @@ -832,7 +832,21 @@ impl MockSession {
/// The first byte, the stream type, of every bidi stream this side has written to,
/// in the order each was first written.
pub fn bidi_types(&self) -> Vec<u8> {
self.side.bidi_types.lock().unwrap().clone()
self.side.bidi_types.read().clone()
}

/// Wait for `count` streams of `kind` to reach the wire.
pub async fn bidi_count(&self, kind: u8, count: usize) {
kio::wait(|waiter| {
self.side.bidi_types.poll(waiter, |types| {
if types.iter().filter(|&&byte| byte == kind).count() >= count {
Poll::Ready(())
} else {
Poll::Pending
}
})
})
.await;
}

/// Every code this side has reset a stream with, in order.
Expand Down
Loading