Skip to content
1 change: 0 additions & 1 deletion quest/m1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ per-frame CPU growth since #5926.
- [One Ed25519 public key type with one z-base-32 codec](/quest/m1/mesh-key-codec.md) - `moq_auth::mesh::EndpointId` is merged into `moq_crypto::sign::PublicKey`
- [Ordered reads can skip owed holes, and snapshot latest() does](/quest/m1/ordered-owed-holes.md) - moq-net's `Ordered` gains a read that skips past an owed hole to the newest buffered group, while keeping the reader's bounds
- [A Rust relay never replays from group 0 to a lite-03/04 subscriber](/quest/m1/relay-inflight-replay.md) - A Rust relay or publisher serving a lite-03 or lite-04 SUBSCRIBE from a track copy that is still resolving starts at the newest group once the copy resolves
- [Stats name the route instance's epoch with a type](/quest/m1/stats-epoch-type.md) - `GroupFrame::epoch` gets a dedicated type and tests stop mislabelling the instance

## Related

Expand Down
6 changes: 3 additions & 3 deletions quest/m1/cluster-routing/routes/session.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ changes the contract decided ship with it.
loop-free (RFC 8966 s2.7): a ring of same-epoch origins whose relays
prioritize different links, and nested wildcards where a relay has not
heard the specific claim, both cycle past requester exclusion; joining
another relay's subscription by path or epoch deadlocks; and without an
epoch a later hop splices another publisher under the requester's
another relay's subscription by path or instance deadlocks; and without an
instance a later hop splices another publisher under the requester's
announcement with no Restart (`local_priorities_loop_path_only_requests`,
`overlapping_wildcards_loop_where_specific_claims_are_unheard`,
`aggregation_cycles_starve_without_a_forwarding_constraint`,
`epochless_reselection_splices_another_publisher`,
`reselection_without_an_instance_splices_another_publisher`,
`sweep_forwarding_progress`). A relay therefore joins a forwarded request
only to a subscription following its route to the same identity. When that
identity becomes unreachable the forwarded request ends, and the first hop
Expand Down
15 changes: 0 additions & 15 deletions quest/m1/stats-epoch-type.md

This file was deleted.

2 changes: 1 addition & 1 deletion rs/moq-net/tests/integration/routing_contracts/handoff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ fn only_a_wildcard_claim_overlaps_an_interest_below_it() {
net.check().unwrap();
}

/// Two origins hold the same wildcard capability for one epoch, and a client
/// Two origins hold the same wildcard capability for one instance, and a client
/// watches a region below it. Withdrawing one origin's wildcard ends only that
/// origin's claim. The client's floor for `live/a/` certifies the wildcard above
/// it, so a lagging relay's older copy of the withdrawn wildcard is refused
Expand Down
12 changes: 6 additions & 6 deletions rs/moq-net/tests/integration/routing_contracts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ fn local_priorities_loop_path_only_requests() {

/// The same ring with every relay subscribing at once. Each forwarded request
/// joins the subscription its neighbor already opened, and no source feeds the
/// cycle. Joining by path or by epoch deadlocks; joining only a subscription to
/// cycle. Joining by path or by instance deadlocks; joining only a subscription to
/// the same identity, or one within the request's bound, does not.
#[test]
fn aggregation_cycles_starve_without_a_forwarding_constraint() {
Expand All @@ -445,7 +445,7 @@ fn aggregation_cycles_starve_without_a_forwarding_constraint() {
"live/x",
&all,
Forward::Pinned,
Aggregate::Epoch
Aggregate::Instance
)));
for (mode, aggregate) in [
(Forward::Pinned, Aggregate::Identity),
Expand All @@ -464,7 +464,7 @@ fn aggregation_cycles_starve_without_a_forwarding_constraint() {
/// publisher under the requester's announced one, with no Restart. Only a
/// request naming the identity keeps the instance the requester announced.
#[test]
fn epochless_reselection_splices_another_publisher() {
fn reselection_without_an_instance_splices_another_publisher() {
let (edge, core, first, second) = (0, 1, 2, 3);
let mut net = Net::new(Config::default(), 4);
net.join(edge, core, 1);
Expand Down Expand Up @@ -526,7 +526,7 @@ fn overlapping_wildcards_loop_where_specific_claims_are_unheard() {
}

/// A deterministic sweep over small random meshes: priorities, overlapping
/// wildcards, epochs, and claims some nodes have not heard. Pinned and bounded
/// wildcards, instances, and claims some nodes have not heard. Pinned and bounded
/// requests never loop or deadlock; path-only requests and the wire-free
/// downstream condition do. A pinned request always arrives, while a bounded
/// one stalls where a transit hop has not heard the claim.
Expand Down Expand Up @@ -621,8 +621,8 @@ fn random_mesh(rng: &mut XorShift) -> Net {
net.join(origin, rng.next(RELAYS as u64) as usize, 1);
net.originate(origin, origin as u64, 0);
let prefix = prefixes[rng.next(3) as usize];
let epoch = if rng.chance(50) { Some(1) } else { None };
let claim = net.claim(origin as u64, prefix, rng.next(3), epoch);
let instance = if rng.chance(50) { Some(1) } else { None };
let claim = net.claim(origin as u64, prefix, rng.next(3), instance);
for relay in 0..RELAYS {
if rng.chance(20) {
net.hide(relay, claim);
Expand Down
46 changes: 23 additions & 23 deletions rs/moq-net/tests/integration/routing_contracts/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//! order on each directed session and can be held to replay them late.
//!
//! Claims come in two forms. The forwarding fixtures use global claims (an
//! identity serving a prefix, at a seed cost and optional epoch) known
//! identity serving a prefix, at a seed cost and optional instance) known
//! everywhere unless a fixture hides one from a node, which stands in for
//! scoping, interest, or a claim that has not arrived yet. The handoff fixtures
//! use announcements instead: an origin versions its own claims, and they travel
Expand Down Expand Up @@ -290,7 +290,7 @@ struct Pending {
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct Item {
pub seed: Metric,
pub epoch: Option<u32>,
pub instance: Option<u32>,
pub since: Rev,
}

Expand Down Expand Up @@ -437,7 +437,7 @@ impl View {
fn a_suffix_costs_the_same_however_its_interest_is_spelled() {
let item = Item {
seed: 0,
epoch: None,
instance: None,
since: 1,
};
let view = View {
Expand Down Expand Up @@ -592,7 +592,7 @@ pub struct Claim {
/// A trailing `/` claims the subtree; otherwise only the exact path.
pub prefix: &'static str,
pub seed: Metric,
pub epoch: Option<u32>,
pub instance: Option<u32>,
}

impl Claim {
Expand Down Expand Up @@ -621,7 +621,7 @@ pub enum Forward {
struct Carried {
pinned: Option<Id>,
bound: Option<Metric>,
epoch: Option<u32>,
instance: Option<u32>,
}

#[derive(Clone, Debug, PartialEq, Eq)]
Expand All @@ -636,8 +636,8 @@ pub enum Outcome {
pub enum Aggregate {
/// Any subscription for the path, as today.
Path,
/// One serving the same explicit epoch.
Epoch,
/// One serving the same explicit instance.
Instance,
/// One following a route to the same identity.
Identity,
/// One whose total is within the request's bound.
Expand All @@ -654,7 +654,7 @@ struct Candidate {
draining: bool,
priority: i8,
prefix: usize,
epoch: Option<u32>,
instance: Option<u32>,
down_only: bool,
}

Expand All @@ -670,7 +670,7 @@ enum Up {
struct Front {
node: Node,
id: Id,
epoch: Option<u32>,
instance: Option<u32>,
total: Metric,
/// Whether the route it follows is down-only.
down_only: bool,
Expand Down Expand Up @@ -903,7 +903,7 @@ impl Net {
let claims = state.views.remove(&old).map(|view| view.items).unwrap_or_default();
self.originate(node, fnv("rotate", &[old]) & !QUALIFIED, 0);
for (claim, item) in claims {
self.change(node, claim, Some((item.seed, item.epoch)));
self.change(node, claim, Some((item.seed, item.instance)));
}
for peer in peers {
self.connect(node, peer);
Expand Down Expand Up @@ -934,8 +934,8 @@ impl Net {
}

/// The origin at `node` starts or updates a claim, advancing its revision.
pub fn announce(&mut self, node: Node, claim: &'static str, seed: Metric, epoch: Option<u32>) {
self.change(node, claim, Some((seed, epoch)));
pub fn announce(&mut self, node: Node, claim: &'static str, seed: Metric, instance: Option<u32>) {
self.change(node, claim, Some((seed, instance)));
}

/// The origin at `node` withdraws a claim, advancing its revision.
Expand All @@ -952,9 +952,9 @@ impl Net {
return self.change(node, claim, attrs);
}
view.floors.insert("", rev);
let item = attrs.map(|(seed, epoch)| Item {
let item = attrs.map(|(seed, instance)| Item {
seed,
epoch,
instance,
since: view.items.get(claim).map_or(rev, |item| item.since),
});
match item {
Expand Down Expand Up @@ -1041,12 +1041,12 @@ impl Net {
self.nodes[node].fd.remove(&id);
}

pub fn claim(&mut self, id: Id, prefix: &'static str, seed: Metric, epoch: Option<u32>) -> usize {
pub fn claim(&mut self, id: Id, prefix: &'static str, seed: Metric, instance: Option<u32>) -> usize {
self.claims.push(Claim {
id,
prefix,
seed,
epoch,
instance,
});
self.claims.len() - 1
}
Expand Down Expand Up @@ -2053,7 +2053,7 @@ impl Net {
draining: route.next.is_some_and(|next| self.draining.contains(&(node, next))),
priority: route.next.map_or(0, |next| self.side(node, next).priority),
prefix: claim.prefix.len(),
epoch: claim.epoch,
instance: claim.instance,
down_only: route.down_only,
});
}
Expand All @@ -2077,7 +2077,7 @@ impl Net {
};
(
Reverse(c.prefix),
Reverse(c.epoch),
Reverse(c.instance),
c.draining,
Reverse(c.priority),
c.total,
Expand All @@ -2099,7 +2099,7 @@ impl Net {
draining: false,
priority: 0,
prefix: 0,
epoch: carried.epoch,
instance: carried.instance,
down_only: route.down_only,
});
}
Expand Down Expand Up @@ -2135,7 +2135,7 @@ impl Net {
Carried {
pinned: (mode == Forward::Pinned).then_some(chosen.id),
bound: (mode == Forward::Bounded).then_some(chosen.advertised + chosen.seed),
epoch: chosen.epoch,
instance: chosen.instance,
}
} else {
carried
Expand Down Expand Up @@ -2190,15 +2190,15 @@ impl Net {
None => Front {
node,
id: 0,
epoch: None,
instance: None,
total: 0,
down_only: false,
up: Up::Stalled,
},
Some(chosen) => Front {
node,
id: chosen.id,
epoch: chosen.epoch,
instance: chosen.instance,
total: chosen.total,
down_only: chosen.down_only,
up: match chosen.next {
Expand Down Expand Up @@ -2226,7 +2226,7 @@ impl Net {
&& !(exports_only && front.down_only)
&& match aggregate {
Aggregate::Path => true,
Aggregate::Epoch => carried.epoch.is_some() && front.epoch == carried.epoch,
Aggregate::Instance => carried.instance.is_some() && front.instance == carried.instance,
Aggregate::Identity => carried.pinned == Some(front.id),
Aggregate::Bound => carried.bound.is_some_and(|bound| front.total <= bound),
}
Expand Down
9 changes: 9 additions & 0 deletions rs/moq-stats/MIGRATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ How to update your code for each breaking change, newest first.

## Unreleased

### Group counters have their own epoch type

`GroupFrame::epoch` is `moq_stats::Epoch` instead of `moq_net::Instance`.
Use `Epoch` for stored group epochs; parse their text with `str::parse` or
`Epoch::try_from(String)`, and read it with `as_str` or `Display`.
Epochs are opaque identities with equality and hashing, without a temporal order.
Broadcast routes still use `moq_net::Instance`. Group JSON is unchanged:
producers mint UUIDv7 strings, and readers accept any nonempty epoch string.

### `moq_net::Path` has no lifetime

Functions that took `impl AsPath` take `impl Into<Path>`, so pass a `Path` rather than a string, and fields and returns that were `PathOwned` are `moq_net::Path`. See moq-net's migration for the rest.
Expand Down
10 changes: 5 additions & 5 deletions rs/moq-stats/benches/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ struct Body {
/// default-tier egress.
struct Node {
source: moq_net::origin::Publication,
epoch: Instance,
instance: Instance,
group: moq_json::snapshot::Producer<Body>,
frame: Body,
}

impl Node {
fn new(origin: &origin::Producer, name: &str) -> Self {
let source = origin.create_broadcast(format!(".stats/node/{name}").as_str()).unwrap();
let epoch = Instance::random();
let instance = Instance::random();
source
.announce(origin::Route::default().with_instance(epoch.clone(), 0))
.announce(origin::Route::default().with_instance(instance.clone(), 0))
.unwrap();
let track = source
.create_track(
Expand All @@ -71,7 +71,7 @@ impl Node {
};
Self {
source,
epoch,
instance,
group: moq_json::snapshot::Producer::new(track, config),
frame,
}
Expand Down Expand Up @@ -144,7 +144,7 @@ async fn measure(live: usize, departed: usize, grace: Duration, state: State) ->
}
}
node.source
.announce(origin::Route::default().with_instance(node.epoch.clone(), 0))
.announce(origin::Route::default().with_instance(node.instance.clone(), 0))
.unwrap();
node.publish(1);
total += 1;
Expand Down
Loading
Loading