diff --git a/.claude/skills/verify-route/SKILL.md b/.claude/skills/verify-route/SKILL.md index 20f307cce39..de71ed64316 100644 --- a/.claude/skills/verify-route/SKILL.md +++ b/.claude/skills/verify-route/SKILL.md @@ -125,4 +125,4 @@ Sync commit: `857f2eea4ac4cc7a3fb821f7d250637eb464b248`, where [the switch](http SYNCED is left out: the router only records it per prefix (`Router::synced`, `Router::is_synced`), and nothing it decides reads it. So are scope regions: a relay asks for what it watches, and `interest.rs`'s `a_scope_with_several_regions_asks_for_each` and the sweeps cover a scope met with the interest. -One publisher, so routes for several publishers are left out, and so are the copies and copy rank of cache-aware routing, which `rs/moq-net/src/route/tests/cache.rs` sweeps; the DEAD message's per-publisher batching reduces to one route per prefix. Two prefixes, one nested in the other, so an edit adds, removes, widens, or narrows one prefix at a time: no wildcards, swaps of several prefixes for one, stream cancellation, grants, qualified keys, or hidden claims. Leaves out two sessions between one pair of nodes at once, as a GOAWAY migration has: the model keeps one per pair, and among equal routes the router stays on the next hop's node and takes its latest session there (`a_later_session_to_the_next_hop_takes_over_among_equals`). Leaves out restarts, priorities other than 0 and 1, a priority that differs between a link's two ends, costs other than 1 and 2, RTT, and the hop limit. Down-only routes appear only where every relay's best route is also its only exportable one, so the model never shows a down-only best route hiding an exportable alternative, a cost the routes epic's contract accepts, and a relay that accepted a request from an upstream link never ends it when its route turns down-only. The hold deadline (`HOLD`), the stalled-writer close, and a scoped session's DEAD (`fail_heard`, which doubts and remembers nothing) are left out: a hold that ends early only lets go sooner, and the model's sessions are all unscoped. So are the node's per-stream keys: lite-07 files each announce stream as its own router key, whose one edit is the prefix the stream opened with (`route/node.rs`), where the model has one neighbour per session and edits it in place; [the route stream](/quest/m2/cluster-routes/route-stream.md) joins them. Messages come only from honest routers: validation of an unrelated DEAD or its far node, and empty or overlong replacement paths, is outside the model's input domain. Rust fixtures cover those guards and exportable covering-source selection, including keeping a covering hold when every live source is unexportable. Interest-edit fixtures also cover a cancelled stream retaining its pending child replies; the model has no stream cancellation. A claims message carries the sender's whole view for its prefix, equal to applying its changes on a FIFO stream. A route is sent on every stream whether or not the publisher has a claim there. The publisher ignores what it hears. `Overlap.cfg` also simulates five relays with every session up. No exhaustive pass has more than four relays or two session changes; `Sim`'s sweeps on the path rule (`sweep_handoff`, `sweep_scoped_handoff`, `sweep_scoped_meshes_show_what_the_rule_says`, and `compare.rs`'s churn) cover larger meshes, grants, qualified keys, interest edits, restarts, and churn. +One publisher, so routes for several publishers are left out, and so are the copies and copy rank of cache-aware routing, which `rs/moq-net/src/route/tests/cache.rs` sweeps; the DEAD message's per-publisher batching reduces to one route per prefix. Two prefixes, one nested in the other, so an edit adds, removes, widens, or narrows one prefix at a time: no wildcards, swaps of several prefixes for one, stream cancellation, grants, qualified keys, or hidden claims. Leaves out two sessions between one pair of nodes at once, as a GOAWAY migration has: the model keeps one per pair, and among equal routes the router stays on the next hop's node and takes its latest session there (`a_later_session_to_the_next_hop_takes_over_among_equals`). Leaves out restarts, priorities other than 0 and 1, a priority that differs between a link's two ends, costs other than 1 and 2, and the hop limit. Down-only routes appear only where every relay's best route is also its only exportable one, so the model never shows a down-only best route hiding an exportable alternative, a cost the routes epic's contract accepts, and a relay that accepted a request from an upstream link never ends it when its route turns down-only. The hold deadline (`HOLD`), the stalled-writer close, and a scoped session's DEAD (`fail_heard`, which doubts and remembers nothing) are left out: a hold that ends early only lets go sooner, and the model's sessions are all unscoped. So are the node's per-stream keys: lite-07 files each announce stream as its own router key, whose one edit is the prefix the stream opened with (`route/node.rs`), where the model has one neighbour per session and edits it in place; [the route stream](/quest/m2/cluster-routes/route-stream.md) joins them. Messages come only from honest routers: validation of an unrelated DEAD or its far node, and empty or overlong replacement paths, is outside the model's input domain. Rust fixtures cover those guards and exportable covering-source selection, including keeping a covering hold when every live source is unexportable. Interest-edit fixtures also cover a cancelled stream retaining its pending child replies; the model has no stream cancellation. A claims message carries the sender's whole view for its prefix, equal to applying its changes on a FIFO stream. A route is sent on every stream whether or not the publisher has a claim there. The publisher ignores what it hears. `Overlap.cfg` also simulates five relays with every session up. No exhaustive pass has more than four relays or two session changes; `Sim`'s sweeps on the path rule (`sweep_handoff`, `sweep_scoped_handoff`, `sweep_scoped_meshes_show_what_the_rule_says`, and `compare.rs`'s churn) cover larger meshes, grants, qualified keys, interest edits, restarts, and churn. diff --git a/dart/moq/lib/src/aliases.dart b/dart/moq/lib/src/aliases.dart index f012ffbb44b..6a14b6ade77 100644 --- a/dart/moq/lib/src/aliases.dart +++ b/dart/moq/lib/src/aliases.dart @@ -74,7 +74,7 @@ typedef AnnounceConfig = MoqAnnounceConfig; typedef Following = MoqFollowing; /// The read-only facts on a received route: a static cost, the stream's instance, and -/// its informational `rtt` to the origin node. +/// whether a usable path reaches it. typedef RouteInfo = MoqRouteInfo; /// One continuous stream at a path: `Instance.parse` names one, and only a session mints one. diff --git a/dart/moq_ffi/lib/src/moq.dart b/dart/moq_ffi/lib/src/moq.dart index 2c5c866cab9..04ccb51223b 100644 --- a/dart/moq_ffi/lib/src/moq.dart +++ b/dart/moq_ffi/lib/src/moq.dart @@ -8,9 +8,7 @@ import "dart:ffi"; import "dart:io" show Platform, File, Directory; import "dart:isolate"; import "dart:typed_data"; - import "package:ffi/ffi.dart"; - import "uniffi_runtime.dart"; export "uniffi_runtime.dart"; @@ -3012,12 +3010,10 @@ class MoqRouteInfo { final int cost; final MoqInstance instance; final bool available; - final Duration? rtt; MoqRouteInfo({ required this.cost, required this.instance, required this.available, - this.rtt, }); } @@ -3043,18 +3039,8 @@ class FfiConverterMoqRouteInfo { ); final available = available_lifted.value; new_offset += available_lifted.bytesRead; - final rtt_lifted = FfiConverterOptionalDuration.read( - Uint8List.view(buf.buffer, new_offset), - ); - final rtt = rtt_lifted.value; - new_offset += rtt_lifted.bytesRead; return LiftRetVal( - MoqRouteInfo( - cost: cost, - instance: instance, - available: available, - rtt: rtt, - ), + MoqRouteInfo(cost: cost, instance: instance, available: available), new_offset - buf.offsetInBytes, ); } @@ -3064,7 +3050,6 @@ class FfiConverterMoqRouteInfo { FfiConverterUInt64.allocationSize(value.cost) + FfiConverterMoqInstance.allocationSize(value.instance) + FfiConverterBool.allocationSize(value.available) + - FfiConverterOptionalDuration.allocationSize(value.rtt) + 0; final buf = Uint8List(total_length); write(value, buf); @@ -3085,10 +3070,6 @@ class FfiConverterMoqRouteInfo { value.available, Uint8List.view(buf.buffer, new_offset), ); - new_offset += FfiConverterOptionalDuration.write( - value.rtt, - Uint8List.view(buf.buffer, new_offset), - ); return new_offset - buf.offsetInBytes; } @@ -3096,7 +3077,6 @@ class FfiConverterMoqRouteInfo { return FfiConverterUInt64.allocationSize(value.cost) + FfiConverterMoqInstance.allocationSize(value.instance) + FfiConverterBool.allocationSize(value.available) + - FfiConverterOptionalDuration.allocationSize(value.rtt) + 0; } } diff --git a/doc/bin/relay/cluster.md b/doc/bin/relay/cluster.md index e0d3d31f617..d40d6563326 100644 --- a/doc/bin/relay/cluster.md +++ b/doc/bin/relay/cluster.md @@ -228,20 +228,6 @@ itself, stays until that process closes it, and the relay redials only then. A route's price is the publisher's production cost plus the link costs it crosses. A live publisher seeds 0, and caching never changes it. -## Route latency - -A moq-lite-07-wip route also carries its RTT: each relay adds its link's -lowest smoothed RTT over the last 30 seconds to the sum it received, so an -application reads the round trip through any number of relays to the route's -origin node, the one the broadcast is published to, from the route it was -announced on (`RouteInfo::rtt`). The publisher's own connection to that node is -not included. The value is absent -while any link on the path has no RTT measurement, and on a route this node -serves itself, such as a broadcast published to it. It is informational and -never picks a route; the link cost does that. A link's value changes only -when its minimum moves past the larger of 5 ms and a quarter, so jitter and -short queues send no route updates. - ## LAN discovery On a LAN there may be no one to list. `[cluster.lan]` advertises this relay diff --git a/drafts/draft-lcurley-moq-lite.md b/drafts/draft-lcurley-moq-lite.md index 37e6584c5bb..459e2321b59 100644 --- a/drafts/draft-lcurley-moq-lite.md +++ b/drafts/draft-lcurley-moq-lite.md @@ -407,7 +407,7 @@ The subscriber creates the stream with an ANNOUNCE_REQUEST message. The publisher replies with a single ANNOUNCE_OK message followed by the matching routes and claims and any future changes: - ROUTE_START: the publisher reaches an origin node for a prefix. -- ROUTE_UPDATE: a route's path, drain, priority, metric, down-only bit, or RTT changed. +- ROUTE_UPDATE: a route's path, drain, priority, metric, or down-only bit changed. - ROUTE_HOLD: the publisher has no usable route but holds it while it recovers. - ROUTE_END: the publisher let go of a route and every claim under it. - DEAD: a session on the path of routes the publisher sent closed, or a node on it sent a GOAWAY. @@ -484,7 +484,7 @@ This specification marks each such value "refused"; the receiver skips the rest - A refused ANNOUNCE_START still assigns its Announce ID, and a refused ANNOUNCE_UPDATE or ANNOUNCE_RESTART keeps it; the claim goes offline at its route's next floor, which is not an ANNOUNCE_END. A claim whose path was refused stays refused; any other comes back with a later ANNOUNCE_RESTART the receiver can use. Its origin withdrew nothing, so while a route has a live claim the receiver refused, the receiver takes the route's floors as certifying nothing, and a relay forwards no withdrawal for the claim. - A refused WARM_START still assigns its Warm ID. -Only the publisher's own framing and stream state close the session: a message that does not decode within its Message Length, such as an RTT flag without its RTT, and a message naming an id that was never assigned or already retired, or breaking the stream's order, as above. +Only the publisher's own framing and stream state close the session: a message that does not decode within its Message Length, and a message naming an id that was never assigned or already retired, or breaking the stream's order, as above. A relay never forwards content a peer would refuse for the relay's own part in it: a route that arrives with 32 hops is unusable, so the relay's own hop never takes one past 32. #### Hidden Paths {#hidden} @@ -525,18 +525,6 @@ An origin's own route has a Path of its own hop alone, with Session Number 0, an A relay forwards the other hops unchanged and never qualifies them. A route that arrives with 32 hops is unusable, since the receiver's own hop would take it past 32. -A route may also carry an RTT: the round trip to its origin node in milliseconds, summed link by link. -It is informational: nothing ranks or selects a route by its RTT. -An origin advertises its own route with an RTT of 0. -A receiver adds its link min RTT for the session to the RTT of every route the peer sends; the sum is its RTT through that peer, which it advertises on the route it selects. -A link min RTT is the lowest smoothed RTT [RFC9002] the connection measured over the last 30 seconds, read once a second, in milliseconds rounded up. -A lifetime minimum never rises after a path change, so it is not a link min RTT. -A node SHOULD keep the link min RTT it adds until the lowest reading differs from it by more than the larger of 5 ms and a quarter of it, so jitter and short queues send no ROUTE_UPDATE and a lasting change sends one per route. -A node whose connection reports no RTT has no link min RTT, so it sends the routes it learned there without one, and a route without one stays without one past every later node. -A sum too large to encode is sent without one too. -An endpoint learns its round trip to an origin node by adding its own link min RTT to the RTT of the route it selected; without its own, the RTT alone covers every hop past its first. -Like the Metric, an RTT is unverified: a peer can misstate only what crosses it. - A route is draining when a node on its Path sent a GOAWAY, as the route's draining flag or a [DEAD](#dead) says, or when its session received one. Its priority is the lowest local priority of a session on its Path: a receiver takes the lower of the priority the route carries and its own local priority for the session, and an origin's own route carries the highest. A node ranks its usable routes to an origin node at a prefix: one that is not draining first, then the highest priority, then the lowest metric. @@ -1287,7 +1275,6 @@ Route Offer { Flags (8), Priority (8), Metric (i), - [RTT (i),] } Hop { @@ -1306,7 +1293,7 @@ A Hop ID of 0 is refused. The Path comes first, so a receiver that refuses the rest of the offer still learns the hops a later [DEAD](#dead) may name. **Flags**: -A bit field: 0x1 when the route is down-only, 0x2 when an RTT follows, and 0x4 when the route is draining (see [Routing](#routing)). +A bit field: 0x1 when the route is down-only and 0x2 when the route is draining (see [Routing](#routing)). Any other bit set is refused, rather than ignored: a later version may give a bit a meaning that changes the route, or a field ahead of the ones defined here. **Priority**: @@ -1315,9 +1302,6 @@ The route's priority, the lowest local priority of a session on its Path, as a u **Metric**: The publisher's metric to the origin node, 0 when it is the origin. -**RTT**: -The publisher's RTT to the origin node in milliseconds (see [Routing](#routing)), 0 when it is the origin. -Present only when Flags has 0x2 set, and absent when the publisher has none. ## ROUTE_UPDATE {#route-update} @@ -2549,8 +2533,7 @@ An application-specific payload. - A receiver mints an Instance for each announcement a session of an earlier version delivers, and a `Minted` field beside every Instance (ANNOUNCE_START, ANNOUNCE_RESTART, TRACK, TRACKS, SUBSCRIBE, FETCH, and DATAGRAMS) says whether a receiver minted it, so no Instance text is reserved for minting. - Added announce compression: ANNOUNCE_START gains `Path Base` and `Path Keep` to copy the head of a live claim's suffix. - Split routing into two layers on the Announce Stream. ROUTE_START (0x6), ROUTE_UPDATE (0x7), and ROUTE_END (0x8) advertise how the publisher reaches an origin node, named by a Node ID, for the paths under a prefix, with an additive metric and a down-only bit. Every ANNOUNCE_START names its route's Route ID in place of the Hop ID list, so a link change sends one ROUTE_UPDATE per origin and prefix rather than an update per claim. Removed the Hop ID list and ANNOUNCE_OK's Hop ID, and replaced the SETUP Hop parameter (0x5) with a [Node ID parameter](#node-id-parameter), so an endpoint that reaches itself detects it at setup. -- ROUTE_START and ROUTE_UPDATE carry Flags, whose 0x2 bit adds an optional RTT: the informational sum of each link's lowest smoothed RTT over the last 30 seconds to the origin node, which never selects a route. -- ROUTE_START and ROUTE_UPDATE carry a Route Offer that leads with the route's Path: one hop per node the route crossed, each a Hop ID and the Session Number that node learned the route on, at most 32. A node never uses a route whose Path names it. ROUTE_START also carries a Route Suffix naming the prefix the route covers, and the offer carries the route's drain (Flags 0x4) and priority, which rank before its metric. +- ROUTE_START and ROUTE_UPDATE carry a Route Offer that leads with the route's Path: one hop per node the route crossed, each a Hop ID and the Session Number that node learned the route on, at most 32. A node never uses a route whose Path names it. ROUTE_START also carries a Route Suffix naming the prefix the route covers, and the offer carries the route's drain (Flags 0x2) and priority, which rank before its metric. - Added ROUTE_HOLD (0xB), which holds a route while it may recover, for at most 10 seconds; ROUTE_END lets it go. Neither withdraws the origin's claims. - Added DEAD (0xF): a node that loses a session names that hop once to each neighbour it sent a route through it, listing the routes that moved, and every node drops every route through the hop and doubts the node at the far end for a second; a DRAIN names a node that sent a GOAWAY, whose routes rank draining. The path, the dead hop, holds, and the doubt keep routes free of loops and stale copies, with no distance, sequence number, route request, or echo. On a scoped session a DEAD applies only to the routes heard there. - A node closes a session whose peer leaves an Announce Stream undrained for 10 seconds, and the subscriber sends nothing on the stream after ANNOUNCE_REQUEST. diff --git a/go/wrapper/types.go b/go/wrapper/types.go index 4660e3fed5b..b85ebba95a4 100644 --- a/go/wrapper/types.go +++ b/go/wrapper/types.go @@ -29,7 +29,7 @@ type ( ProtocolKind = ffi.MoqProtocolKind // OriginConfig configures a new origin, such as its maximum cache size in bytes. OriginConfig = ffi.MoqOriginConfig - // RouteInfo is the read-only facts on a received route: the Instance of the stream it serves (routes with one instance are one continuous stream) and its static production and link cost (lower wins), and its informational Rtt to the origin node. + // RouteInfo is the read-only facts on a received route: the Instance of the stream it serves (routes with one instance are one continuous stream), its static production and link cost (lower wins), and whether a usable path reaches it (Available). RouteInfo = ffi.MoqRouteInfo // Instance names one continuous stream at a path. Compare two with Eq: a session mints one // for a route whose wire carries none, and it differs from a named instance with the same Text. diff --git a/js/net/api/index.api.md b/js/net/api/index.api.md index 5c776f3d18a..0a60027e0ec 100644 --- a/js/net/api/index.api.md +++ b/js/net/api/index.api.md @@ -530,7 +530,6 @@ export namespace Origin { readonly available: boolean; readonly cost: Origin.Cost; readonly instance?: Instance.Valid; - readonly rtt?: Clock.Duration; } export interface RouteOptions { auth?: Auth.Credential; diff --git a/js/net/src/announced.test.ts b/js/net/src/announced.test.ts index 762422c3efc..7315a1e32b8 100644 --- a/js/net/src/announced.test.ts +++ b/js/net/src/announced.test.ts @@ -65,7 +65,7 @@ test("a listing shows a route's facts, never its epoch, hops, credential, or dra captures: undefined, route: { instance, cost: 5n, available: true }, }); - expect(Object.keys(event?.route ?? {}).sort()).toEqual(["available", "cost", "instance", "rtt"]); + expect(Object.keys(event?.route ?? {}).sort()).toEqual(["available", "cost", "instance"]); }); test("a listing reports availability flips and tells an offline path from an absent one", async () => { diff --git a/js/net/src/hop.ts b/js/net/src/hop.ts index 02aacf8340e..f97911cdd37 100644 --- a/js/net/src/hop.ts +++ b/js/net/src/hop.ts @@ -7,7 +7,6 @@ * * @module */ -import type { Duration } from "@moq/clock"; import type { Credential } from "./auth.ts"; import type * as Instance from "./instance.ts"; import { isLeadingOnes, type StreamVersion } from "./stream.ts"; @@ -113,18 +112,6 @@ export interface RouteInfo { * it recovers: request again once it turns available. */ readonly available: boolean; - /** - * The round trip to the route's origin node over moq-lite-07, informational: it never ranks - * or selects a route. - * - * Each link on the path adds its min RTT, the lowest smoothed RTT it measured over the last - * 30 seconds, this session's own link included. Undefined on any other wire, on a route this - * origin serves itself, and while any link on the path has no measurement. - * - * A listing reports it as of the event that carries the route: a change to the RTT alone is - * no event. - */ - readonly rtt?: Duration; } /** @@ -138,7 +125,6 @@ export function routeInfo(route: WireRoute): RouteInfo { instance: route.instance, cost: route.cost, available: route.available ?? true, - rtt: route.rtt, }; } @@ -197,8 +183,6 @@ export interface WireRoute { * priority of a link no one set. Local, as `node` is. */ readonly priority?: number; - /** See {@link RouteInfo.rtt}. */ - readonly rtt?: Duration; } /** Constructors and helpers for {@link WireRoute}. @internal */ @@ -223,7 +207,6 @@ export const WireRoute = { node: route.node, depth: route.depth, priority: route.priority, - rtt: route.rtt, }; }, }; @@ -242,7 +225,7 @@ export function isAnonymous(route: WireRoute): boolean { /** * Whether two routes name the same instance, epoch, hop chain, cost, auth, drain state, - * availability, origin node, route depth and priority, and RTT. + * availability, origin node, and route depth and priority. * * @internal */ @@ -259,7 +242,6 @@ export function routesEqual(a: WireRoute | undefined, b: WireRoute | undefined): a.node === b.node && a.depth === b.depth && (a.priority ?? 0) === (b.priority ?? 0) && - (a.rtt === b.rtt || (!!a.rtt && !!b.rtt && a.rtt.eq(b.rtt))) && a.hops.length === b.hops.length && a.hops.every((hop, i) => hop === b.hops[i]) ); diff --git a/js/net/src/lite/announce.test.ts b/js/net/src/lite/announce.test.ts index 1374a58283f..8890309645c 100644 --- a/js/net/src/lite/announce.test.ts +++ b/js/net/src/lite/announce.test.ts @@ -13,7 +13,6 @@ import { decodeAnnounceBroadcastMaybe, encodeAnnounceBroadcast, type Offer, - ROUTE_MAX, ROUTE_MAX_HOPS, } from "./announce.ts"; import { Version } from "./version.ts"; @@ -383,7 +382,6 @@ test("the route layer round-trips on draft-07", async () => { priority: 0, metric: 5n, downOnly: true, - rtt: undefined, }; const one: Offer = { ...offer, path: [{ node: 7n, session: 0n }], downOnly: false, metric: 0n }; const cases: [AnnounceBroadcast, number[]][] = [ @@ -392,7 +390,7 @@ test("the route layer round-trips on draft-07", async () => { { status: "routeStart", node: 0x1234n, suffix: Path.empty(), offer }, [6, 11, 0x92, 0x34, 0, 2, 7, 0, 9, 2, 1, 128, 5], ], - // Flag 0x2: an RTT follows. Flag 0x4: a node on the path drains. + // Flag 0x2: a node on the path drains. [ { status: "routeUpdate", @@ -403,14 +401,9 @@ test("the route layer round-trips on draft-07", async () => { draining: true, priority: -3, downOnly: false, - rtt: 25n, }, }, - [7, 8, 1, 1, 7, 0, 6, 125, 5, 25], - ], - [ - { status: "routeUpdate", id: 1n, offer: { ...offer, rtt: ROUTE_MAX } }, - [7, 18, 1, 2, 7, 0, 9, 2, 3, 128, 5, ...Array(9).fill(0xff)], + [7, 7, 1, 1, 7, 0, 2, 125, 5], ], // As many hops as a route may carry. [ @@ -488,7 +481,6 @@ test("the route layer refuses Node ID 0, unknown flags, and too many hops", asyn priority: 0, metric: 0n, downOnly: false, - rtt: undefined, }; const encode = (msg: AnnounceBroadcast) => bytes((w) => encodeAnnounceBroadcast(w, msg, v), v); // No node sends an offer it would refuse. @@ -546,13 +538,14 @@ test("the route layer refuses Node ID 0, unknown flags, and too many hops", asyn reason: "node", }); expect(await decode(await start(1n, [0n], 0))).toMatchObject({ status: "refused", reason: "node" }); - // A flag no version defines is refused, and the RTT flag without its field is malformed. - expect(await decode(await start(1n, [1n], 8))).toEqual({ - status: "refused", - message: { kind: "routeStart", node: 1n, suffix: Path.empty(), path }, - reason: "flags", - }); - await expect(decode(await start(1n, [1n], 2))).rejects.toThrow(); + // A flag no version defines is refused. + for (const flags of [4, 8]) { + expect(await decode(await start(1n, [1n], flags))).toEqual({ + status: "refused", + message: { kind: "routeStart", node: 1n, suffix: Path.empty(), path }, + reason: "flags", + }); + } // More hops than a route may carry. const over = Array.from({ length: ROUTE_MAX_HOPS + 1 }, () => 1n); expect(await decode(await start(1n, over, 0))).toMatchObject({ status: "refused", reason: "hops" }); @@ -597,7 +590,7 @@ test("the route layer refuses Node ID 0, unknown flags, and too many hops", asyn { id: 3n, offer: { refused: "flags", path } }, { id: 4n, - offer: { path, draining: false, priority: 0, metric: 0n, downOnly: false, rtt: undefined }, + offer: { path, draining: false, priority: 0, metric: 0n, downOnly: false }, }, ], }, diff --git a/js/net/src/lite/announce.ts b/js/net/src/lite/announce.ts index 6decfbed045..3e8fe5d123c 100644 --- a/js/net/src/lite/announce.ts +++ b/js/net/src/lite/announce.ts @@ -65,15 +65,14 @@ export interface RouteHop { /** How a lite-07 publisher reaches a publisher node: the `path` it crossed, the publisher first and * the sender last, whether a node on it sent GOAWAY, the lowest link priority on it, the sender's - * metric to the publisher, whether it may only travel away from an upstream, and its informational - * RTT in milliseconds, `undefined` when unmeasured. Mirrors `route::path::Offer` in rs/moq-net. */ + * metric to the publisher, and whether it may only travel away from an upstream. Mirrors + * `route::path::Offer` in rs/moq-net. */ export interface Offer { path: RouteHop[]; draining: boolean; priority: number; metric: bigint; downOnly: boolean; - rtt: bigint | undefined; } /** A Route Offer this node refuses: the path it still names, which a later DEAD may match, and why. */ @@ -105,8 +104,7 @@ export const ROUTE_MAX_HOPS = 32; // Route Offer flags. const DOWN_ONLY = 0x1; -const RTT = 0x2; -const DRAINING = 0x4; +const DRAINING = 0x2; /** * A message on the publisher's side of the Announce Stream. @@ -307,7 +305,7 @@ async function decodeRouteCost(r: Reader, version: Version): Promise ROUTE_MAX_HOPS || offer.path.some((hop) => hop.node === 0n)) @@ -317,12 +315,9 @@ async function encodeOffer(w: Writer, offer: Offer) { await w.u62(hop.node); await w.u62(hop.session); } - await w.u8( - (offer.downOnly ? DOWN_ONLY : 0) | (offer.rtt === undefined ? 0 : RTT) | (offer.draining ? DRAINING : 0), - ); + await w.u8((offer.downOnly ? DOWN_ONLY : 0) | (offer.draining ? DRAINING : 0)); await w.u8(toWire(offer.priority)); await w.u62(offer.metric); - if (offer.rtt !== undefined) await w.u62(offer.rtt); } /** Decode a Route Offer. Its path comes first, so a node refusing the rest still learns the path a @@ -347,11 +342,10 @@ async function decodeOffer(r: Reader): Promise { if (count > BigInt(ROUTE_MAX_HOPS)) return refuse("hops"); if (path.some((hop) => hop.node === 0n)) return refuse("node"); const flags = await r.u8(); - if (flags & ~(DOWN_ONLY | RTT | DRAINING)) return refuse("flags"); + if (flags & ~(DOWN_ONLY | DRAINING)) return refuse("flags"); const priority = fromWire(await r.u8()); const metric = await r.u62(); - const rtt = flags & RTT ? await r.u62() : undefined; - return { path, draining: (flags & DRAINING) !== 0, priority, metric, downOnly: (flags & DOWN_ONLY) !== 0, rtt }; + return { path, draining: (flags & DRAINING) !== 0, priority, metric, downOnly: (flags & DOWN_ONLY) !== 0 }; } async function encodeDead(w: Writer, dead: Dead) { diff --git a/js/net/src/lite/link_rtt.test.ts b/js/net/src/lite/link_rtt.test.ts deleted file mode 100644 index 802fe466928..00000000000 --- a/js/net/src/lite/link_rtt.test.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { expect, test } from "bun:test"; -import { Duration } from "@moq/clock"; -import { LinkRtt } from "./link_rtt.ts"; - -// Mirrors the tests of `route/rtt.rs` in rs/moq-net. - -const ms = (n: number) => Duration.millis(n); -const asMs = (rtt: Duration | undefined) => rtt?.asMillis(); -const feed = (link: LinkRtt, reads: (Duration | undefined)[]) => reads.map((rtt) => asMs(link.read(rtt))); - -test("the first read reports at once", () => { - expect(asMs(new LinkRtt().read(ms(30)))).toBe(30); -}); - -test("a queue shorter than the window reports nothing", () => { - const link = new LinkRtt(); - link.read(ms(30)); - const queued = Array.from({ length: 29 }, (_, i) => ms(30 + (i + 1) * 3)); - expect(feed(link, queued).every((report) => report === 30)).toBe(true); - expect(asMs(link.read(ms(31)))).toBe(30); -}); - -test("a rise reports once the window passes it", () => { - const link = new LinkRtt(); - link.read(ms(30)); - const reports = feed(link, Array(30).fill(ms(55))); - expect(reports.slice(0, 29).every((report) => report === 30)).toBe(true); - expect(reports[29]).toBe(55); -}); - -test("a drop reports at once", () => { - const link = new LinkRtt(); - link.read(ms(80)); - expect(asMs(link.read(ms(40)))).toBe(40); -}); - -test("a change within the band reports nothing", () => { - let link = new LinkRtt(); - link.read(ms(10)); - expect(asMs(link.read(ms(5)))).toBe(10); - expect(asMs(link.read(ms(4)))).toBe(4); - link = new LinkRtt(); - link.read(ms(100)); - expect(asMs(link.read(ms(75)))).toBe(100); - expect(asMs(link.read(ms(74)))).toBe(74); -}); - -test("a transport without rtt reports none and starts over", () => { - const link = new LinkRtt(); - link.read(ms(80)); - expect(link.read(undefined)).toBeUndefined(); - expect(asMs(link.read(ms(90)))).toBe(90); -}); - -test("a window without rtt stops reading", () => { - const link = new LinkRtt(); - feed(link, Array(29).fill(undefined)); - expect(link.reading).toBe(true); - link.read(undefined); - expect(link.reading).toBe(false); -}); - -test("a fraction of a millisecond rounds up", () => { - expect(asMs(new LinkRtt().read(Duration.micros(300)))).toBe(1); -}); diff --git a/js/net/src/lite/link_rtt.ts b/js/net/src/lite/link_rtt.ts deleted file mode 100644 index 122675f1a53..00000000000 --- a/js/net/src/lite/link_rtt.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { Duration } from "@moq/clock"; - -/** How many reads the minimum covers. */ -const WINDOW = 30; -/** The smallest change reported. */ -const FLOOR = Duration.millis(5); - -/** - * A link's min RTT, as the route layer adds it to the routes learned over the link. - * Mirrors `route::LinkRtt` in rs/moq-net. - * - * Reads a link's smoothed RTT once per {@link LinkRtt.INTERVAL} and reports the lowest of - * the last 30 reads in whole milliseconds, changed only once it moves past the larger of - * 5 ms and a quarter of the value reported. - * - * The smoothed RTT follows every queue, and a lifetime minimum never rises after a path - * change; a windowed minimum ignores a queue shorter than the window and turns a path - * change into one new value. - * - * @internal - */ -export class LinkRtt { - /** How often to {@link read} the smoothed RTT. */ - static readonly INTERVAL = Duration.secs(1); - - #reads: Duration[] = []; - #reported: Duration | undefined; - /** Reads in a row that found no RTT. */ - #misses = 0; - - /** The min RTT last reported. */ - get reported(): Duration | undefined { - return this.#reported; - } - - /** - * Whether to keep reading: false once a window of reads found no RTT, since a transport - * that reports none that long, past a first ping, never will. - */ - get reading(): boolean { - return this.#misses < WINDOW; - } - - /** - * Take one read of the smoothed RTT, `undefined` when the transport reports none, and - * return the min RTT to report. - */ - read(rtt: Duration | undefined): Duration | undefined { - if (rtt === undefined) { - this.#reads = []; - this.#reported = undefined; - this.#misses += 1; - return undefined; - } - this.#misses = 0; - if (this.#reads.length === WINDOW) this.#reads.shift(); - this.#reads.push(rtt); - const lowest = this.#reads.reduce((a, b) => a.min(b)); - const min = Duration.millis(Math.ceil(Math.floor(lowest.asMicros()) / 1000)); - const reported = this.#reported; - if (!reported || min.absDiff(reported).gt(reported.div(4).max(FLOOR))) this.#reported = min; - return this.#reported; - } -} diff --git a/js/net/src/lite/publisher.test.ts b/js/net/src/lite/publisher.test.ts index ef86760488d..a4f33c9dc93 100644 --- a/js/net/src/lite/publisher.test.ts +++ b/js/net/src/lite/publisher.test.ts @@ -4010,7 +4010,6 @@ test("a lite-07 answer carries this origin's claims under its own route", async priority: 127, metric: 0n, downOnly: false, - rtt: 0n, }; try { await ok(); diff --git a/js/net/src/lite/publisher.ts b/js/net/src/lite/publisher.ts index 51783294295..46907be77a6 100644 --- a/js/net/src/lite/publisher.ts +++ b/js/net/src/lite/publisher.ts @@ -925,7 +925,6 @@ export class Publisher { priority: 127, metric: 0n, downOnly: false, - rtt: 0n, }); // What the peer decodes for a claim: lite-07 carries its instance, epoch, and cost. const onWire = (route: WireRoute): WireRoute => ({ ...route, auth: undefined }); diff --git a/js/net/src/lite/subscriber.test.ts b/js/net/src/lite/subscriber.test.ts index 5a8ed3a9954..13e5d65d3cc 100644 --- a/js/net/src/lite/subscriber.test.ts +++ b/js/net/src/lite/subscriber.test.ts @@ -205,7 +205,6 @@ function offer(node: bigint, extra: Partial = {}): Offer { priority: 0, metric: 0n, downOnly: false, - rtt: 20n, ...extra, }; } @@ -4315,10 +4314,9 @@ test("a cancelled legacy datagram lookup cannot refuse a stream answer arriving // A lite-07 peer's announce stream, after the request: what the peer writes, and the replies // the subscriber sends back. `another` opens a further one on the session as its `index`th stream. -async function routedStream(options?: RouteOptions, getStats?: () => Promise) { +async function routedStream(options?: RouteOptions) { const version = Version.DRAFT_07; const { quic, opened } = fakeSession(); - if (getStats) Object.assign(quic, { getStats }); const subscriber = new Subscriber(quic, version, toHop(1n)); const another = async (index: number, scope?: Path.Pattern) => { const announced = subscriber.routes(scope, options); @@ -5129,34 +5127,6 @@ test("a lite-07 consume pinned to an instance names its route's node", async () await info; }); -// A route's RTT is the relay's sum plus this link's own min RTT, unknown while either is, and it -// moves no pick: it only updates the route reported. -test("a lite-07 route reports its rtt as the relay's sum plus this link's", async () => { - // The link's first read answers only after the route's first batch is on the stream. - const stats = Promise.withResolvers<{ smoothedRtt: number }>(); - const { subscriber, announced, send } = await routedStream(undefined, () => stats.promise); - const x = Path.from("x"); - await send({ status: "routeStart", node: NODE_A, suffix: Path.empty(), offer: offer(NODE_A) }); - await send({ status: "active", suffix: x, route: 0n, instance: Instance.parse("a") }); - await send({ status: "floor", id: 0n, revision: 0n }); - const first = announced.next(); - stats.resolve({ smoothedRtt: 10.2 }); - // The claim waits for that read, so the path is first reported with the sum: a listing shows - // a route when its path turns present, and not again for an RTT. - let next = (await first) as { kind: string; route: WireRoute }; - expect(next).toMatchObject({ kind: "start", route: { node: NODE_A } }); - expect(next.route.rtt?.asMillis()).toBe(31); - - // The relay could not measure a link on the path: the sum is unknown. - await send({ status: "routeUpdate", id: 0n, offer: offer(NODE_A, { rtt: undefined }) }); - next = (await announced.next()) as { kind: string; route: WireRoute }; - expect(next).toMatchObject({ kind: "update", route: { node: NODE_A } }); - expect(next.route.rtt).toBeUndefined(); - - announced.close(); - subscriber.close(); -}); - // Forwarding code asks for each origin node's claim at a path as its own route. test("a lite-07 stream reports each node's claim with claims", async () => { const { subscriber, announced, send } = await routedStream({ claims: true }); @@ -5208,10 +5178,8 @@ test("a lite-07 batch applies at its floor, and a held route turns unavailable", kind: "update", route: { available: true, cost: 8n }, }); - // Nothing ranks by RTT, so a change to it alone reports nothing. - await send({ status: "routeUpdate", id: 0n, offer: offer(NODE_A, { metric: 5n, rtt: 90n }) }); - // Nor by its path, until the route crossed as many nodes as one may, or crossed us: then it is - // no route at all, until it is usable again. + // Nothing ranks by its path, so a change to it alone reports nothing, until the route crossed + // as many nodes as one may, or crossed us: then it is no route at all, until it is usable again. const longer = [{ node: NODE_A, session: 0n }, { node: 3n, session: 1n }, ...offer(NODE_A).path.slice(1)]; await send({ status: "routeUpdate", id: 0n, offer: offer(NODE_A, { metric: 5n, path: longer }) }); const full = Array.from({ length: ROUTE_MAX_HOPS }, (_, i) => ({ node: BigInt(i + 1), session: 0n })); diff --git a/js/net/src/lite/subscriber.ts b/js/net/src/lite/subscriber.ts index 9e2e6a8251f..8f50880f246 100644 --- a/js/net/src/lite/subscriber.ts +++ b/js/net/src/lite/subscriber.ts @@ -1,11 +1,11 @@ -import { Duration, sleep, yieldNow } from "@moq/clock"; +import { Duration, yieldNow } from "@moq/clock"; import { type Dispose, Effect, type GetPromise, type Getter, Once, race, Signal } from "@moq/signals"; import * as announce from "../announced.ts"; import type { Grant } from "../auth.ts"; import type { AuthSession } from "../auth_session.ts"; import * as broadcast from "../broadcast.ts"; import type { Drain } from "../connection/goaway.ts"; -import { type Probe as ProbeStats, transportStats } from "../connection/stats.ts"; +import type { Probe as ProbeStats } from "../connection/stats.ts"; import { BroadcastCache } from "../consume.ts"; import type * as datagram from "../datagram.ts"; import * as DatagramStream from "../datagram_stream.ts"; @@ -83,7 +83,6 @@ import { Fetch as FetchMessage } from "./fetch.ts"; import { dropped, passing, RangeFills, type RecoveryHandle, type Refusal, type Refused, refuseRun } from "./fills.ts"; import { type Carrier, type Claim, Floors } from "./floors.ts"; import { type Group as GroupMessage, type Ingest, readFrames } from "./group.ts"; -import { LinkRtt } from "./link_rtt.ts"; import { Probe } from "./probe.ts"; import { ProbeLevel, type Setup } from "./setup.ts"; import { StreamId } from "./stream.ts"; @@ -1093,55 +1092,6 @@ export class Subscriber { let synced = false; // Set once the stream lets go of its routes, which then show nothing anew. let closing = false; - // This link's min RTT, read once a second while the peer has a route, as Rust's - // `Routed::sample`: no route, no timer, and a pause restarts the window. - let link = new LinkRtt(); - let linkRtt: Duration | undefined; - let sampler: AbortController | undefined; - // The running sampler's first read, settled once it landed or the sampler stopped. - let firstRead = Promise.resolve(); - // Returns whether it started a sampler. - const sample = (): boolean => { - if (routes.size === 0 && sampler) { - sampler.abort(); - sampler = undefined; - link = new LinkRtt(); - linkRtt = undefined; - } else if (routes.size > 0 && !sampler) { - const ctrl = new AbortController(); - sampler = ctrl; - const first = Promise.withResolvers(); - firstRead = first.promise; - void readLink(ctrl.signal, link, first.resolve); - return true; - } - return false; - }; - const readLink = async (signal: AbortSignal, window: LinkRtt, read: () => void) => { - try { - while (!signal.aborted && window.reading) { - const rtt = (await transportStats(this.#quic)).rtt; - if (signal.aborted || closing || announced.closed.peek() !== undefined) return; - // A transport reporting 0 has not measured one. - const now = window.read(rtt?.isZero() ? undefined : rtt); - if (now !== linkRtt) { - linkRtt = now; - // RTT never selects a route, so the consume cache keeps its picks: only the - // reported routes change, each path once. - const paths = new Set(); - for (const wire of routes.values()) for (const path of wire.view.claims.keys()) paths.add(path); - for (const path of paths) refresh(path, false); - } - read(); - await sleep(LinkRtt.INTERVAL, { signal }); - } - } catch { - // Aborted: the routes went or the stream ended. - } finally { - read(); - } - }; - const route = (id: bigint): Route => { const found = routes.get(id); if (!found) throw new ProtocolViolation(`unknown route ${id}`); @@ -1187,11 +1137,6 @@ export class Subscriber { priority: Math.min(0, wire.offer.priority), draining: wire.offer.draining || wire.drain || undefined, available: !wire.held, - // The relay's sum plus this link's own, unknown while either is. - rtt: - wire.offer.rtt !== undefined && linkRtt !== undefined - ? linkRtt.checkedAdd(Duration.millis(Number(wire.offer.rtt))) - : undefined, }), ); @@ -1286,7 +1231,7 @@ export class Subscriber { // The peer started a route to `node` with the next Route ID, covering the requested prefix // joined with `suffix`, along `offer`, or along `path` when this node refuses the offer. - const startRoute = async ( + const startRoute = ( node: bigint, suffix: Path.Valid | undefined, offer: Offer | undefined, @@ -1325,15 +1270,9 @@ export class Subscriber { owner: {}, }; routes.set(id, wire); - const started = sample(); if (named_ !== undefined) named.set(named_, id); // A refused route's floors stay its own, as Rust's node never holds the route. if (joined(wire)) this.#floors.join(node, wire.carrier); - // The link's first read lands before the route's first claims show, as Rust - // reads the link before it serves them: a listing reports a path's route when - // it turns present and not again for an RTT, so a read landing after would - // never reach it. - if (started) await race([firstRead, announced.closed]); }; // The peer let go of the route and every claim under it: offline, not withdrawn. @@ -1343,7 +1282,6 @@ export class Subscriber { claims.delete(id); } routes.delete(wire.id); - sample(); const named_ = key(wire.node, wire.prefix); if (named_ !== undefined && named.get(named_) === wire.id) named.delete(named_); // Unindexed first: leaving its floors reshows another carrier at once, which @@ -1517,7 +1455,7 @@ export class Subscriber { switch (msg.status) { case "routeStart": - await startRoute(msg.node, msg.suffix, msg.offer, msg.offer.path); + startRoute(msg.node, msg.suffix, msg.offer, msg.offer.path); break; case "routeUpdate": move(route(msg.id), msg.offer); @@ -1635,7 +1573,6 @@ export class Subscriber { } finally { stopDrain?.(); closing = true; - sampler?.abort(); for (const wire of routes.values()) { this.#floors.leave(wire.node, wire.carrier); for (const path of wire.view.claims.keys()) this.#consumes.withdraw(path, wire.owner); diff --git a/kt/moq/src/jvmAndAndroidMain/kotlin/dev/moq/Aliases.kt b/kt/moq/src/jvmAndAndroidMain/kotlin/dev/moq/Aliases.kt index 740f510eb8d..6910e31b919 100644 --- a/kt/moq/src/jvmAndAndroidMain/kotlin/dev/moq/Aliases.kt +++ b/kt/moq/src/jvmAndAndroidMain/kotlin/dev/moq/Aliases.kt @@ -204,9 +204,8 @@ typealias Instance = uniffi.moq.MoqInstance typealias RouteOptions = uniffi.moq.MoqRouteOptions /** - * The read-only facts on a received route: the [Instance] of the stream it serves, relay hop ids - * (oldest first), static production and link cost (lower wins), and its informational `rtt` to the - * origin node. + * The read-only facts on a received route: the [Instance] of the stream it serves, static + * production and link cost (lower wins), and whether a usable path reaches it. */ typealias RouteInfo = uniffi.moq.MoqRouteInfo diff --git a/quest/m0/test-flakes-3/py-socket-abort.md b/quest/m0/test-flakes-3/py-socket-abort.md new file mode 100644 index 00000000000..0a812ac15fd --- /dev/null +++ b/quest/m0/test-flakes-3/py-socket-abort.md @@ -0,0 +1,24 @@ +# [S] A closed endpoint ends its streams as Closed, never unroutable + +## Goal + +`py/moq-rs/tests/test_socket.py::test_abort_and_endpoint_close_are_errors` +passes every run. + +## Plan + +Found 2026-11-15 by `just check` on +[moq-dev/moq#8838](https://github.com/moq-dev/moq/pull/8838), whose change does +not reach a local origin's socket. Run alone, it fails about 1 run in 3 at line +90: after `a.close()`, `server.consumer.read_frame()` raises +`moq.Error.Protocol: unroutable` instead of `moq.Error.Closed`, so closing an +endpoint races its route's withdrawal against its streams' ending. Fix the +endpoint at the cause, as the epic's rules ask. + +First check whether it still reproduces after +[moq-dev/moq#8825](https://github.com/moq-dev/moq/pull/8825), which makes every +ending of a socket endpoint run its cleanup and likely fixes it: run the test +alone in a loop on a base that includes it. If it no longer fails, delete this +quest; if it does, the cause lies elsewhere. + +Public API: none. Wire: none. diff --git a/quest/m2/lite07-finalize.md b/quest/m2/lite07-finalize.md index 4a583a77797..eead02aad34 100644 --- a/quest/m2/lite07-finalize.md +++ b/quest/m2/lite07-finalize.md @@ -160,7 +160,6 @@ would need a breaking release had it landed right after the cut: - [Lite-07 by start](/quest/m2/time-addressing/lite07.md) - lite-07 carries group starts, previous-start links, GROUP_END, and time bounds instead of sequence numbers - [@moq/net by start](/quest/m2/time-addressing/js.md) - JS speaks the same lite-07 wire - [Warm routes on the wire](/quest/m2/warm-routes-wire.md) - removes WARM_* and SUBSCRIBE's `Warm` byte from lite-07 -- [ROUTE's RTT](/quest/m2/route-rtt.md) - removes ROUTE's informational RTT - [FETCH Start Byte](/quest/m2/fetch-start-byte.md) - removes FETCH's byte offset into a half-read frame - [Yield on relay links](/quest/m2/yield-relay-links.md) - narrows YIELDED from `ietf` sessions to tracks carrying moq-transport records - [Subscriber Min Age](/quest/m2/subscriber-min-age.md) - removes SUBSCRIBE's minimum age, which nothing reads diff --git a/quest/m2/route-rtt.md b/quest/m2/route-rtt.md deleted file mode 100644 index d9e0807bcc0..00000000000 --- a/quest/m2/route-rtt.md +++ /dev/null @@ -1,31 +0,0 @@ -# [S] ROUTE drops its informational RTT - -## Goal - -lite-07's ROUTE_START and ROUTE_UPDATE carry no RTT, and `RouteInfo::rtt` is -gone from Rust, JS, and the bindings, with the `js/net` sampler that fed it. - -## Plan - -Found 2026-11-14 by the [feature review](/quest/m3/release/feature-review.md). -[moq-dev/moq#8458](https://github.com/moq-dev/moq/pull/8458) and -[moq-dev/moq#8553](https://github.com/moq-dev/moq/pull/8553) carry a summed -RTT because, per the deleted route-latency quest, a lite-07 route "cannot name -its path, so a sum is all the wire can carry". Since -[moq-dev/moq#8487](https://github.com/moq-dev/moq/pull/8487) every route -carries its hops. In `path::Router::rtt` (`rs/moq-net/src/route/path.rs`), one -link's RTT change past max(5 ms, 25%) recomputes every identity heard through -that neighbour and sends one ROUTE_UPDATE per publisher on every downstream -stream, repeating at each relay down; nothing ranks or selects by it, the -sizing covered chain length for one origin only (AGENTS.md asks for a sweep -over both axes), the "a node may withhold it" requirement never shipped, and -its in-repo consumer, link quality, moved downstream -([moq-dev/moq#8756](https://github.com/moq-dev/moq/pull/8756)). `js/net` -polls `getStats()` every second while a route exists, and nothing in JS reads -`RouteInfo.rtt`. - -Decided 2026-11-14 (maintainer, pick on [moq-dev/moq#8764](https://github.com/moq-dev/moq/pull/8764)): ✅ (a) drop the field and `RouteInfo::rtt` in Rust, JS, and the bindings, and the `js/net` `getStats()` sampler that fills it (rejected: (b) keep it after a sweep; (c) per-session link RTT summed along the path). - -Public API: (a) removes `RouteInfo::rtt` in Rust, JS, and the bindings. -Wire: lite-07-wip ROUTE_START/ROUTE_UPDATE lose the field. - diff --git a/rs/moq-ffi/src/origin.rs b/rs/moq-ffi/src/origin.rs index 29b3e4a8ee4..42dc439d23c 100644 --- a/rs/moq-ffi/src/origin.rs +++ b/rs/moq-ffi/src/origin.rs @@ -94,9 +94,6 @@ pub struct MoqRouteInfo { pub instance: Arc, /// Whether a usable path reaches the route's origin; requests may fail while it is not. pub available: bool, - /// The round trip to the route's origin node over moq-lite-07, absent while any link - /// has no measurement. Informational; it never ranks a route. - pub rtt: Option, } impl From for MoqRouteInfo { @@ -105,7 +102,6 @@ impl From for MoqRouteInfo { cost: route.cost().value(), instance: MoqInstance::wrap(route.instance().clone()), available: route.available(), - rtt: route.rtt(), } } } diff --git a/rs/moq-net/benches/routes.rs b/rs/moq-net/benches/routes.rs index b3c35f9f339..764bdef077c 100644 --- a/rs/moq-net/benches/routes.rs +++ b/rs/moq-net/benches/routes.rs @@ -30,9 +30,6 @@ //! a route per session sent to each stream it answers. Swept over the leaving //! node's sessions and the streams: both axes are expected to grow, since each //! stream is re-sent each route ranked draining, and no faster than their product. -//! - path/drained: after the drain, an RTT change on a session with no routes. Swept -//! over the same grid: the streams axis is expected to grow, since each stream's -//! DRAIN notice is kept; the sessions axis is not. //! //! The route layer is crate-private, so this reaches it through the `fuzz` module. //! @@ -266,23 +263,6 @@ fn bench_path_drain(c: &mut Criterion) { group.finish(); } -fn bench_path_drained(c: &mut Criterion) { - let mut group = c.benchmark_group("routes/path/drained"); - for (sessions, streams) in DRAINING { - let id = BenchmarkId::from_parameter(format!("{sessions}n_{streams}s")); - let mut fixture = None; - group.bench_function(id, |b| { - let node = fixture.get_or_insert_with(|| { - let mut node = fuzz::PathRouteDrain::new(sessions, streams); - node.drain(); - node - }); - b.iter(|| node.idle()); - }); - } - group.finish(); -} - criterion_group!( benches, bench_watched, @@ -298,7 +278,6 @@ criterion_group!( bench_path_received, bench_path_teardown, bench_path_refollow, - bench_path_drain, - bench_path_drained + bench_path_drain ); criterion_main!(benches); diff --git a/rs/moq-net/fixtures/lite.json b/rs/moq-net/fixtures/lite.json index 70177e3067a..9015a1caf0b 100644 --- a/rs/moq-net/fixtures/lite.json +++ b/rs/moq-net/fixtures/lite.json @@ -56,26 +56,19 @@ "expect": "decoded" }, { - "name": "a ROUTE_START's suffix extends the requested prefix, and its 0x2 flag carries an RTT in milliseconds", + "name": "a ROUTE_START's suffix extends the requested prefix", "version": "moq-lite-07-wip", "message": "announce", - "hex": "060b9234016101090002ff0019", + "hex": "060a9234016101090000ff00", "expect": "decoded" }, { - "name": "a Route Offer's 0x4 flag marks a path through a draining node", + "name": "a Route Offer's 0x2 flag marks a path through a draining node", "version": "moq-lite-07-wip", "message": "announce", - "hex": "0609923400010900047f03", + "hex": "0609923400010900027f03", "expect": "decoded" }, - { - "name": "a Route Offer's RTT flag without its RTT is refused", - "version": "moq-lite-07-wip", - "message": "announce", - "hex": "0609923400010900028003", - "expect": "refused" - }, { "name": "a Route Offer flag no version defines is withdrawn, with whatever field it adds", "version": "moq-lite-07-wip", diff --git a/rs/moq-net/src/fuzz.rs b/rs/moq-net/src/fuzz.rs index b6a50cca9c9..b616f3dbc96 100644 --- a/rs/moq-net/src/fuzz.rs +++ b/rs/moq-net/src/fuzz.rs @@ -587,7 +587,6 @@ fn route_offer(node: u64) -> crate::route::path::Offer { priority: i8::MAX, metric: 0, down_only: false, - rtt: None, } } @@ -964,7 +963,6 @@ impl PathRouteRelay { priority: i8::MAX, metric: 0, down_only: false, - rtt: None, })), ); let snapshot = (0..claims) @@ -1049,7 +1047,6 @@ impl PathRouteFollower { priority: i8::MAX, metric: 0, down_only: false, - rtt: None, })), ); let changes = (0..self.claims) @@ -1096,8 +1093,6 @@ impl PathRouteFollower { pub struct PathRouteDrain { router: crate::route::path::Router, recipients: usize, - idle: usize, - rtt: u64, } impl PathRouteDrain { @@ -1131,7 +1126,6 @@ impl PathRouteDrain { priority: i8::MAX, metric: 1, down_only: false, - rtt: None, })), ); let claim = Path::new(&format!("live/{i}/x")).unwrap(); @@ -1153,14 +1147,7 @@ impl PathRouteDrain { ) .unwrap(); } - let idle = sessions + recipients; - router.connect(idle, 9_000, crate::route::Link::default()).unwrap(); - let mut node = Self { - router, - recipients, - idle, - rtt: 0, - }; + let mut node = Self { router, recipients }; node.flush(); node } @@ -1189,14 +1176,6 @@ impl PathRouteDrain { out.len() } - /// An RTT change on a session with no routes, which changes nothing it was sent. - pub fn idle(&mut self) { - self.rtt = self.rtt % 8 + 1; - self.router - .rtt(self.idle, Some(std::time::Duration::from_millis(self.rtt))); - assert_eq!(self.flush(), 0); - } - fn flush(&mut self) -> usize { let sent = self.router.drain().len(); self.router.events(); diff --git a/rs/moq-net/src/lite/announce.rs b/rs/moq-net/src/lite/announce.rs index 0d286c82de4..a0010adbc64 100644 --- a/rs/moq-net/src/lite/announce.rs +++ b/rs/moq-net/src/lite/announce.rs @@ -276,10 +276,8 @@ fn decode_warm_start(r: &mut Decoder<'_>) -> Content<(Path, Instance, Warm)> { /// Route Offer flag: an upstream link is on the path, so the route is down-only. const DOWN_ONLY: u8 = 0x1; -/// Route Offer flag: an RTT follows. -const RTT: u8 = 0x2; /// Route Offer flag: a node on the path sent GOAWAY. -const DRAINING: u8 = 0x4; +const DRAINING: u8 = 0x2; /// News on DEAD about the routes the sender offered. #[derive(Clone, Debug, PartialEq, Eq)] @@ -312,9 +310,8 @@ pub(crate) struct Unusable { pub reason: Refusal, } -/// Encode a Route Offer: the path, then flags, priority, metric, and RTT in -/// milliseconds. No node offers an empty path or one past the hop limit, nor names Node -/// ID 0 in one. +/// Encode a Route Offer: the path, then flags, priority, and metric. No node offers an +/// empty path or one past the hop limit, nor names Node ID 0 in one. fn encode_offer(w: &mut Encoder<'_>, offer: &Offer) -> Result<(), EncodeError> { if offer.path.is_empty() || offer.path.len() > route::MAX_HOPS || offer.path.iter().any(|hop| hop.node == 0) { return Err(EncodeError::InvalidState); @@ -324,24 +321,16 @@ fn encode_offer(w: &mut Encoder<'_>, offer: &Offer) -> Result<(), EncodeError> { w.varint(hop.node)?; w.varint(hop.session)?; } - // A sum past the field's range, which only a peer's absurd value reaches, is unknown. - let rtt = offer.rtt.and_then(|rtt| u64::try_from(rtt.as_millis()).ok()); let mut flags = 0; if offer.down_only { flags |= DOWN_ONLY; } - if rtt.is_some() { - flags |= RTT; - } if offer.draining { flags |= DRAINING; } w.u8(flags); w.u8(super::priority::to_wire(offer.priority)); w.varint(offer.metric)?; - if let Some(rtt) = rtt { - w.varint(rtt)?; - } Ok(()) } @@ -387,22 +376,17 @@ fn decode_offer(r: &mut Decoder<'_>) -> Result { return refuse(r, Refusal::Node); } let flags = r.u8()?; - if flags & !(DOWN_ONLY | RTT | DRAINING) != 0 { + if flags & !(DOWN_ONLY | DRAINING) != 0 { return refuse(r, Refusal::Flags(flags)); } let priority = super::priority::from_wire(r.u8()?); let metric = r.varint()?; - let rtt = match flags & RTT { - 0 => None, - _ => Some(std::time::Duration::from_millis(r.varint()?)), - }; Ok(Ok(Offer { path, draining: flags & DRAINING != 0, priority, metric, down_only: flags & DOWN_ONLY != 0, - rtt, })) } @@ -2154,7 +2138,6 @@ mod tests { priority: 0, metric, down_only, - rtt: None, } } @@ -2202,17 +2185,13 @@ mod tests { node: 0x7a40, suffix: Path::empty(), offer: Offer { - rtt: Some(std::time::Duration::ZERO), priority: i8::MAX, ..offer(&[(5, 0), (route::MAX, 7), (9, 2)], 0, false) }, }, AnnounceBroadcast::RouteUpdate { id: 1, - offer: Offer { - rtt: Some(std::time::Duration::from_millis(u64::MAX)), - ..offer(&long, 3, true) - }, + offer: offer(&long, 3, true), }, AnnounceBroadcast::RouteHold { id: 3 }, AnnounceBroadcast::RouteEnd { id: 0 }, @@ -2266,22 +2245,6 @@ mod tests { assert_eq!(buf[7], 0x7f); } - /// A peer's largest RTT plus a link goes past the field: it is forwarded as - /// unknown, never an error that would end the stream. - #[test] - fn an_rtt_past_the_field_is_unknown() { - let msg = |rtt| AnnounceBroadcast::RouteUpdate { - id: 1, - offer: Offer { - rtt, - ..offer(&[(1, 0)], 3, false) - }, - }; - let past = std::time::Duration::from_millis(u64::MAX).checked_add(std::time::Duration::from_millis(1)); - assert!(past.is_some()); - assert_eq!(broadcast_round_trip(&msg(past), Version::Lite07), msg(None)); - } - /// A floor is a marker: the Route ID and the revision plus one, 0 when it certifies /// nothing. #[test] @@ -2510,11 +2473,7 @@ mod tests { // No hops at all, and fewer than it counts. start(1, Box::new(path(0, 0, 0, 1))), start(1, Box::new(path(0, 3, 1, 1))), - // An RTT flag without its field, and a byte past a usable offer. - forge(ROUTE_UPDATE, |w| { - w.varint(0u64).unwrap(); - path(RTT, 1, 1, 1)(w); - }), + // A byte past a usable offer. forge(ROUTE_UPDATE, |w| { w.varint(0u64).unwrap(); path(0, 1, 1, 1)(w); diff --git a/rs/moq-net/src/lite/publisher.rs b/rs/moq-net/src/lite/publisher.rs index 5dbaab1f90e..eb08189bf84 100644 --- a/rs/moq-net/src/lite/publisher.rs +++ b/rs/moq-net/src/lite/publisher.rs @@ -3868,7 +3868,6 @@ mod announce_test { priority: 0, metric: 1, down_only: false, - rtt: None, }; let dead = |moved: std::ops::Range, more| lite::Dead::Closed { hop: Hop { node: 7, session: 1 }, diff --git a/rs/moq-net/src/lite/subscriber.rs b/rs/moq-net/src/lite/subscriber.rs index 913db2c7b00..42856fea2bc 100644 --- a/rs/moq-net/src/lite/subscriber.rs +++ b/rs/moq-net/src/lite/subscriber.rs @@ -10136,7 +10136,6 @@ mod tests { priority: i8::MAX, metric: 0, down_only: false, - rtt: None, }; lite::AnnounceBroadcast::RouteStart { node, diff --git a/rs/moq-net/src/lite/subscriber/routed.rs b/rs/moq-net/src/lite/subscriber/routed.rs index 01bdfa9cecf..990175fc0b5 100644 --- a/rs/moq-net/src/lite/subscriber/routed.rs +++ b/rs/moq-net/src/lite/subscriber/routed.rs @@ -19,7 +19,6 @@ use crate::{ self, node, path::{Dead, Hop, Moved, Offer, Reach}, }, - transport::{Metrics as _, poll::Session as _}, }; use super::{AnnouncedRoute, Subscriber}; @@ -157,12 +156,6 @@ pub(super) struct Routed { drained: bool, /// A DEAD whose next part the peer sends next. continued: Option, - /// The link's min RTT, which the peer's routes add. - rtt: route::LinkRtt, - /// When to read the link's RTT next, or `None` once it stopped reading. - read_rtt: Option, - /// Whether the peer has a route here, so the link's RTT is read. - sampling: bool, /// Counts what this node refuses of the peer's routes and claims. stats: crate::stats::Session, } @@ -224,9 +217,6 @@ impl Routed { ready: Default::default(), drained: false, continued: None, - rtt: Default::default(), - read_rtt: None, - sampling: false, stats: subscriber.origin.stats().clone(), }) } @@ -718,7 +708,6 @@ impl Routed { .receive(self.peer, scoped(&self.link, &self.root, permit, key)) .map_err(refused)? .with_clock(subscriber.runtime.clone()); - stream.rtt(self.rtt.reported()); // What the old stream served stays in the origin until the new one serves it // again, or lets go after. let previous = std::mem::take(&mut self.served); @@ -752,7 +741,6 @@ impl Routed { /// Act on everything the node queued for the stream: serve the claims it hands /// over. pub(super) fn outputs(&mut self, subscriber: &Subscriber) { - self.sample(subscriber); while let Some(output) = self.stream.try_output() { self.output(subscriber, output); } @@ -843,8 +831,7 @@ impl Routed { .with_node(Some(*id)) .with_lane(lane) .with_draining(self.drained || served.draining) - .with_available(served.available) - .with_rtt(served.rtt); + .with_available(served.available); if let Some(entry) = self.previous.remove(&key) { self.served.insert(key.clone(), entry); } @@ -880,46 +867,8 @@ impl Routed { } } - /// Start or stop reading the link's min RTT as the peer's routes come and go. - /// - /// Only a route the peer sent adds the link's min RTT, so a peer sending none costs - /// no timer. Starting reads at once, so the first claims served already carry it, - /// and in a fresh window, so a pause never keeps a reading older than the window. - fn sample(&mut self, subscriber: &Subscriber) { - match (self.routes.is_empty(), self.sampling) { - (true, true) => { - self.sampling = false; - self.rtt = Default::default(); - self.read_rtt = None; - self.stream.rtt(None); - } - (false, false) => { - self.sampling = true; - self.read_link(subscriber); - } - _ => {} - } - } - - /// Read the link's smoothed RTT once and schedule the next read. - fn read_link(&mut self, subscriber: &Subscriber) { - let last = self.rtt.reported(); - let now = self.rtt.read(subscriber.session.metrics().rtt()); - if now != last { - self.stream.rtt(now); - } - self.read_rtt = - (self.rtt.reading()).then(|| crate::time::Deadline::after(&subscriber.runtime, route::LinkRtt::INTERVAL)); - } - /// Serve requests on every claim whose queue woke. pub(super) fn poll(&mut self, subscriber: &Subscriber, waiter: &kio::Waiter) -> Result<(), Error> { - self.sample(subscriber); - while let Some(read_rtt) = &mut self.read_rtt - && read_rtt.poll(waiter).is_ready() - { - self.read_link(subscriber); - } while let Poll::Ready(output) = self.stream.poll_output(waiter) { self.output(subscriber, output); } diff --git a/rs/moq-net/src/lite/subscriber/routed/tests.rs b/rs/moq-net/src/lite/subscriber/routed/tests.rs index 5f66675fa58..25e52c8b20b 100644 --- a/rs/moq-net/src/lite/subscriber/routed/tests.rs +++ b/rs/moq-net/src/lite/subscriber/routed/tests.rs @@ -13,7 +13,6 @@ fn offer() -> Offer { priority: i8::MAX, metric: 0, down_only: false, - rtt: None, } } @@ -275,92 +274,6 @@ async fn a_handover_caps_the_old_request() { ); } -/// A transport that reports its first RTT only after the stream opened, such as -/// qmux before its first ping returns, still gets its link measured. -#[kio::test] -async fn a_late_rtt_is_still_read() { - let session = SinkSession::new(Default::default()); - let (subscriber, _consumer) = super::super::tests::restart_subscriber(session.clone()); - let prefix = Path::empty(); - let mut routed = super::Routed::new(&subscriber, &prefix, 1, &Default::default()).unwrap(); - let mut decoder = AnnounceDecoder::default(); - feed(&mut routed, &mut decoder, &[]).unwrap(); - let waiter = kio::Waiter::noop(); - routed.poll(&subscriber, &waiter).unwrap(); - kio::clock::sim::advance(crate::route::LinkRtt::INTERVAL).await; - routed.poll(&subscriber, &waiter).unwrap(); - assert_eq!(routed.rtt.reported(), None); - - let rtt = std::time::Duration::from_millis(20); - session.set_stats(crate::lite::test_transport::SinkStats::default().with_rtt(rtt)); - kio::clock::sim::advance(crate::route::LinkRtt::INTERVAL).await; - routed.poll(&subscriber, &waiter).unwrap(); - assert_eq!(routed.rtt.reported(), Some(rtt)); -} - -/// Claims served when the peer reports Synced, before the stream is first polled, -/// already carry the link's RTT. -#[kio::test] -async fn the_first_claims_served_carry_the_rtt() { - use crate::lite::test_transport::SinkStats; - let ms = std::time::Duration::from_millis; - let session = SinkSession::new(Default::default()).with_stats(SinkStats::default().with_rtt(ms(10))); - let (subscriber, _consumer) = super::super::tests::restart_subscriber(session); - let prefix = Path::empty(); - let mut routed = super::Routed::new(&subscriber, &prefix, 1, &Default::default()).unwrap(); - let mut decoder = AnnounceDecoder::default(); - let route = Msg::RouteStart { - node: 7, - suffix: Path::empty(), - offer: Offer { - rtt: Some(ms(5)), - ..offer() - }, - }; - let floor = Msg::Floor { - id: 0, - revision: Some(0), - }; - for msg in [route, start("live"), floor] { - routed.receive(&prefix, msg, &mut decoder).unwrap(); - } - routed.outputs(&subscriber); - let rtts: Vec<_> = routed.served.values().map(|entry| entry.route.route.rtt()).collect(); - assert_eq!(rtts, [Some(ms(15))]); -} - -/// A stream whose peer ends every route stops reading, and starts a fresh window -/// once one returns, so a reading from before the pause never stays reported. -#[kio::test] -async fn a_pause_restarts_the_window() { - use crate::lite::test_transport::SinkStats; - let ms = std::time::Duration::from_millis; - let session = SinkSession::new(Default::default()).with_stats(SinkStats::default().with_rtt(ms(10))); - let (subscriber, _consumer) = super::super::tests::restart_subscriber(session.clone()); - let prefix = Path::empty(); - let mut routed = super::Routed::new(&subscriber, &prefix, 1, &Default::default()).unwrap(); - let mut decoder = AnnounceDecoder::default(); - let waiter = kio::Waiter::noop(); - feed(&mut routed, &mut decoder, &[]).unwrap(); - routed.poll(&subscriber, &waiter).unwrap(); - assert_eq!(routed.rtt.reported(), Some(ms(10))); - - routed.receive(&prefix, Msg::RouteEnd { id: 0 }, &mut decoder).unwrap(); - routed.poll(&subscriber, &waiter).unwrap(); - assert!(routed.read_rtt.is_none(), "no route, no timer"); - session.set_stats(SinkStats::default().with_rtt(ms(100))); - kio::clock::sim::advance(std::time::Duration::from_secs(60)).await; - - let route = Msg::RouteStart { - node: 7, - suffix: Path::empty(), - offer: offer(), - }; - routed.receive(&prefix, route, &mut decoder).unwrap(); - routed.poll(&subscriber, &waiter).unwrap(); - assert_eq!(routed.rtt.reported(), Some(ms(100))); -} - /// What the stream keeps between floors is the net change to its committed claims, /// however many messages the peer sends without one. #[kio::test] diff --git a/rs/moq-net/src/model/origin.rs b/rs/moq-net/src/model/origin.rs index dd5c6ca9784..f9c41bae2da 100644 --- a/rs/moq-net/src/model/origin.rs +++ b/rs/moq-net/src/model/origin.rs @@ -519,10 +519,6 @@ pub struct RouteInfo { /// Whether a usable path reaches the route's origin; see [`Self::available`]. pub(crate) available: bool, - - /// The round trip to the route's origin node; see [`Self::rtt`]. Never forwarded: - /// each node measures its own link. - pub(crate) rtt: Option, } impl RouteInfo { @@ -541,7 +537,6 @@ impl RouteInfo { lane: Lane::default(), draining: false, available: true, - rtt: None, } } } @@ -610,17 +605,6 @@ impl RouteInfo { self.cost } - /// The round trip to the route's origin node over moq-lite-07, informational: it - /// never ranks or selects a route. - /// - /// Each link on the path adds its min RTT, the lowest smoothed RTT it measured over - /// the last 30 seconds, this session's own link included. `None` on any other wire, - /// on a route this origin serves itself, and while any link on the path has no - /// measurement. - pub fn rtt(&self) -> Option { - self.rtt - } - /// Whether a usable path reaches the route's origin. An unavailable route is held: /// the network lost every path to it but may recover one, so the announcement stays. /// It ranks with a draining route, below every available one, and requests through @@ -697,13 +681,6 @@ impl RouteInfo { self } - /// Set the round trip to the route's origin node; see [`Self::rtt`]. - #[cfg_attr(not(feature = "async"), allow(dead_code, reason = "async-only"))] - pub(crate) fn with_rtt(mut self, rtt: Option) -> Self { - self.rtt = rtt; - self - } - /// Whether this route passed through an anonymous hop. /// /// True when the chain holds a 0 anywhere, including Lite03 hop-count @@ -923,7 +900,7 @@ type RouteOrder = ( Reverse, ); -/// The `(hops, cost, source, instance, epoch, auth, node, available, rtt)` metadata +/// The `(hops, cost, source, instance, epoch, auth, node, available)` metadata /// an announce cursor delivers alongside a prefix. type RouteMeta = ( Hops, @@ -934,7 +911,6 @@ type RouteMeta = ( Option, Option, bool, - Option, ); /// The earlier of two optional deadlines. @@ -1340,7 +1316,6 @@ impl OriginConsumerState { node: meta.6, draining: false, available: meta.7, - rtt: meta.8, lane: Lane::default(), }, }; @@ -1386,8 +1361,6 @@ struct RouteEntry { draining: bool, /// Whether a usable path reaches the route's origin; see [`RouteInfo::available`]. available: bool, - /// The round trip to the route's origin node; see [`RouteInfo::rtt`]. - rtt: Option, /// The queue requests under this route are served from, when the announcer /// serves content on demand (a [`Claim`]). `None` for an advertise-only /// announcement ([`Producer::announce`]) and for a local broadcast. @@ -1456,13 +1429,12 @@ impl RouteEntry { self.auth.clone(), self.node, self.available, - self.rtt, ) } /// Whether [`Self::meta`] would equal `meta`, without building it. fn delivers(&self, meta: &RouteMeta) -> bool { - let (hops, cost, source, instance, epoch, auth, node, available, rtt) = meta; + let (hops, cost, source, instance, epoch, auth, node, available) = meta; *hops == self.hops && *cost == self.cost && *source == self.entered() @@ -1471,7 +1443,6 @@ impl RouteEntry { && *auth == self.auth && *node == self.node && *available == self.available - && *rtt == self.rtt } /// Whether a request for `path` can be served through this entry. A served @@ -3069,7 +3040,6 @@ impl Announcing { lane: route.lane.clone(), draining: route.draining, available: route.available, - rtt: route.rtt, server: serving.server.clone(), source: serving.source.clone(), advertised: serving.advertised, @@ -3695,7 +3665,6 @@ impl AnnounceProducer { entry.lane = route.lane.clone(); entry.draining = route.draining; entry.available = route.available; - entry.rtt = route.rtt; entry.advertised = true; let claim = entry.claim.clone(); shared.sync_route(prefix, &claim, Gone::End); @@ -3758,7 +3727,6 @@ impl AnnounceProducer { lane: entry.lane.clone(), draining: entry.draining, available: entry.available, - rtt: entry.rtt, }) } diff --git a/rs/moq-net/src/route/mod.rs b/rs/moq-net/src/route/mod.rs index 723ad7da48b..8cc1a811a38 100644 --- a/rs/moq-net/src/route/mod.rs +++ b/rs/moq-net/src/route/mod.rs @@ -20,7 +20,6 @@ pub(crate) mod node; pub(crate) mod path; mod proof; mod reader; -mod rtt; mod view; #[cfg(test)] @@ -36,8 +35,6 @@ pub(crate) use proof::EXPORTER_LABEL; pub use proof::RouteKey; pub(crate) use proof::{Proof, Transcript}; #[cfg(feature = "async")] -pub(crate) use rtt::LinkRtt; -#[cfg(feature = "async")] pub(crate) use view::ancestors; pub(crate) use view::{View, within}; diff --git a/rs/moq-net/src/route/node.rs b/rs/moq-net/src/route/node.rs index ba8153ba30e..b939bccdad3 100644 --- a/rs/moq-net/src/route/node.rs +++ b/rs/moq-net/src/route/node.rs @@ -24,7 +24,6 @@ use std::{ collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecDeque}, sync::{Arc, Mutex, MutexGuard}, task::{Poll, ready}, - time::Duration, }; use kio::clock::{Deadlines, Instant}; @@ -70,8 +69,6 @@ pub(crate) struct Served { pub claim: Claim, /// The route's metric: a path through the claim costs the Announce Cost plus this. pub metric: Metric, - /// The round trip to the route's publisher, informational. - pub rtt: Option, /// Whether a usable route serves it; a held one leaves it shown but unavailable. pub available: bool, /// A node on the route's path sent GOAWAY: it ranks below every route avoiding one. @@ -1164,11 +1161,6 @@ impl Stream { self.with(|router, key, now| router.goaway(key, now)); } - /// The link to the peer has `rtt`, or `None` unmeasured. - pub fn rtt(&self, rtt: Option) { - self.with(|router, key, _| router.rtt(key, rtt)); - } - /// This stream's session now serves `claim` of `id` along its route covering `prefix` /// at `served`'s instance, so the other streams are sent that instance, and a slot /// that no longer carries a live route to it lets go. @@ -1442,7 +1434,6 @@ impl State { let served = Served { claim: item.clone(), metric: offer.metric, - rtt: offer.rtt, available, draining: offer.draining, priority: offer.priority, diff --git a/rs/moq-net/src/route/node/tests.rs b/rs/moq-net/src/route/node/tests.rs index ea98a73b29f..fada334d6b5 100644 --- a/rs/moq-net/src/route/node/tests.rs +++ b/rs/moq-net/src/route/node/tests.rs @@ -66,7 +66,6 @@ fn served_at(claim: Claim, metric: Metric, primary: bool) -> Served { Served { claim, metric, - rtt: None, available: true, draining: false, priority: 0, @@ -266,7 +265,6 @@ fn nothing_moves_across_a_dead() { priority: 0, metric, down_only: false, - rtt: None, }; let mut outbox = Outbox::default(); let mut waiting = Waiting::default(); @@ -296,7 +294,6 @@ fn a_reader_behind_repeated_failures_overruns() { priority: 0, metric: 1, down_only: false, - rtt: None, }; let dead = |session, gone| Dead::Closed { hop: Hop { node: 2, session }, @@ -373,7 +370,6 @@ fn a_claim_started_and_withdrawn_unread_leaves_nothing() { priority: 0, metric: 1, down_only: false, - rtt: None, }; let instance = Instance::random(); let mut outbox = Outbox::default(); @@ -427,7 +423,6 @@ fn a_read_route_ends_alone() { priority: 0, metric: 1, down_only: false, - rtt: None, }; let mut outbox = Outbox::default(); let mut waiting = Waiting::default(); @@ -537,7 +532,6 @@ fn a_route_at_the_hop_limit_is_not_forwarded() { priority: i8::MAX, metric: 1, down_only: false, - rtt: None, }; from_a.route(100, Path::empty(), Some(Reach::Finite(offer))); // A route goes on the wire only with a claim it shows, once that is served. @@ -637,7 +631,6 @@ fn a_goaway_moves_the_forwarded_route_to_another_stream() { priority: i8::MAX, metric, down_only: false, - rtt: None, }; let live = claim(&instance, 0); stream.route(5, Path::empty(), Some(Reach::Finite(offer))); @@ -675,7 +668,6 @@ fn dropped_streams_disconnect_once_the_last_closing_guard_goes() { priority: i8::MAX, metric: 0, down_only: false, - rtt: None, }; receive.route(1, Path::empty(), Some(Reach::Finite(offer))); receive.batch( @@ -726,7 +718,6 @@ fn a_floor_sealed_while_a_claim_is_held_back_certifies_nothing() { priority: 0, metric: 1, down_only: false, - rtt: None, }; let instance = Instance::random(); let mut outbox = Outbox::default(); @@ -772,7 +763,6 @@ fn a_release_closes_with_the_newest_floor_after_older_batches_are_read() { priority: 0, metric: 1, down_only: false, - rtt: None, }; let instance = Instance::random(); let mut outbox = Outbox::default(); diff --git a/rs/moq-net/src/route/path.rs b/rs/moq-net/src/route/path.rs index 2707df16d36..6eea4664e2a 100644 --- a/rs/moq-net/src/route/path.rs +++ b/rs/moq-net/src/route/path.rs @@ -88,8 +88,6 @@ pub(crate) struct Offer { pub metric: Metric, /// An upstream link is on its path, so it is never sent to one. pub down_only: bool, - /// The round trip to the publisher: informational, never read to rank a route. - pub rtt: Option, } impl Offer { @@ -436,7 +434,6 @@ struct Session { /// How the neighbour names itself in a path. hop: Id, link: Link, - rtt: Option, draining: bool, /// What this node asks the neighbour for as of the last marker, each prefix with /// whether its initial set arrived (SYNCED). @@ -886,7 +883,6 @@ impl Router { number: self.opened, hop, link, - rtt: None, draining: false, asked: BTreeMap::new(), edits: VecDeque::new(), @@ -1127,19 +1123,6 @@ impl Router { self.update(ids, vec![Report::Draining(node)], None); } - /// The link to `neighbor` has `rtt`, or `None` unmeasured. - pub fn rtt(&mut self, neighbor: N, rtt: Option) { - let Some(session) = self.sessions.get_mut(&neighbor) else { - return; - }; - if session.rtt == rtt { - return; - } - session.rtt = rtt; - let ids = self.through(neighbor); - self.update(ids, Vec::new(), None); - } - /// The identities `neighbor` offered a route for. fn through(&self, neighbor: N) -> BTreeSet { (self.sessions.get(&neighbor).into_iter()) @@ -1214,7 +1197,6 @@ impl Router { priority: i8::MAX, metric: 0, down_only: false, - rtt: Some(Duration::ZERO), }); self.routes.insert((id, Path::empty()), route); self.scopes.entry(id).or_default().insert(Path::empty()); @@ -2217,7 +2199,6 @@ impl Router { priority: session.link.priority.min(heard.offer.priority), metric, down_only: session.link.upstream || heard.offer.down_only, - rtt: heard.offer.rtt.zip(session.rtt).and_then(|(a, b)| a.checked_add(b)), }) } diff --git a/rs/moq-net/src/route/rtt.rs b/rs/moq-net/src/route/rtt.rs deleted file mode 100644 index 21434b5f453..00000000000 --- a/rs/moq-net/src/route/rtt.rs +++ /dev/null @@ -1,144 +0,0 @@ -//! A link's min RTT, as the route layer adds it to the routes learned over the link. - -use std::{collections::VecDeque, time::Duration}; - -/// Reads a link's smoothed RTT once per [`Self::INTERVAL`] and reports the lowest of the -/// last 30 reads in whole milliseconds, changed only once it moves past the larger of -/// 5 ms and a quarter of the value reported. -/// -/// The smoothed RTT follows every queue, and a lifetime minimum never rises after a -/// path change; a windowed minimum ignores a queue shorter than the window and turns a -/// path change into one new value. -#[derive(Debug, Default)] -pub(crate) struct LinkRtt { - reads: VecDeque, - reported: Option, - /// Reads in a row that found no RTT. - misses: usize, -} - -impl LinkRtt { - /// How often to [read](Self::read) the smoothed RTT. - pub const INTERVAL: Duration = Duration::from_secs(1); - /// How many reads the minimum covers. - const WINDOW: usize = 30; - /// The smallest change reported. - const FLOOR: Duration = Duration::from_millis(5); - - /// The min RTT last reported. - pub fn reported(&self) -> Option { - self.reported - } - - /// Whether to keep reading: false once a window of reads found no RTT, since a - /// transport that reports none that long, past a first ping, never will. - pub fn reading(&self) -> bool { - self.misses < Self::WINDOW - } - - /// Take one read of the smoothed RTT, `None` when the transport reports none, and - /// return the min RTT to report. - pub fn read(&mut self, rtt: Option) -> Option { - let Some(rtt) = rtt else { - self.reads.clear(); - self.reported = None; - self.misses += 1; - return None; - }; - self.misses = 0; - if self.reads.len() == Self::WINDOW { - self.reads.pop_front(); - } - self.reads.push_back(rtt); - let min = self.reads.iter().min().expect("just pushed"); - let min = Duration::from_millis(u64::try_from(min.as_micros().div_ceil(1000)).unwrap_or(u64::MAX)); - match self.reported { - Some(reported) if min.abs_diff(reported) <= (reported / 4).max(Self::FLOOR) => {} - _ => self.reported = Some(min), - } - self.reported - } -} - -#[cfg(test)] -mod tests { - use super::*; - - fn ms(ms: u64) -> Option { - Some(Duration::from_millis(ms)) - } - - /// Feed `reads` one per interval, returning each report. - fn feed(link: &mut LinkRtt, reads: impl IntoIterator>) -> Vec> { - reads.into_iter().map(|rtt| link.read(rtt)).collect() - } - - #[test] - fn the_first_read_reports_at_once() { - let mut link = LinkRtt::default(); - assert_eq!(link.read(ms(30)), ms(30)); - } - - #[test] - fn a_queue_shorter_than_the_window_reports_nothing() { - let mut link = LinkRtt::default(); - link.read(ms(30)); - // 29 seconds of a growing queue, then it drains. - let queued = (1..30).map(|i| ms(30 + i * 3)); - assert!(feed(&mut link, queued).iter().all(|report| *report == ms(30))); - assert_eq!(link.read(ms(31)), ms(30)); - } - - #[test] - fn a_rise_reports_once_the_window_passes_it() { - let mut link = LinkRtt::default(); - link.read(ms(30)); - let reports = feed(&mut link, std::iter::repeat_n(ms(55), 30)); - // The window still holds the last 30 ms read until the 30th read of 55 ms. - assert!(reports[..29].iter().all(|report| *report == ms(30))); - assert_eq!(reports[29], ms(55)); - } - - #[test] - fn a_drop_reports_at_once() { - let mut link = LinkRtt::default(); - link.read(ms(80)); - assert_eq!(link.read(ms(40)), ms(40)); - } - - #[test] - fn a_change_within_the_band_reports_nothing() { - let mut link = LinkRtt::default(); - link.read(ms(10)); - // A quarter of 10 ms is below the 5 ms floor. - assert_eq!(link.read(ms(5)), ms(10)); - assert_eq!(link.read(ms(4)), ms(4)); - let mut link = LinkRtt::default(); - link.read(ms(100)); - assert_eq!(link.read(ms(75)), ms(100)); - assert_eq!(link.read(ms(74)), ms(74)); - } - - #[test] - fn a_transport_without_rtt_reports_none_and_starts_over() { - let mut link = LinkRtt::default(); - link.read(ms(80)); - assert_eq!(link.read(None), None); - assert_eq!(link.read(ms(90)), ms(90)); - } - - #[test] - fn a_window_without_rtt_stops_reading() { - let mut link = LinkRtt::default(); - feed(&mut link, std::iter::repeat_n(None, 29)); - assert!(link.reading()); - link.read(None); - assert!(!link.reading()); - } - - #[test] - fn a_fraction_of_a_millisecond_rounds_up() { - let mut link = LinkRtt::default(); - assert_eq!(link.read(Some(Duration::from_micros(300))), ms(1)); - } -} diff --git a/rs/moq-net/src/route/tests/mod.rs b/rs/moq-net/src/route/tests/mod.rs index f52b824c8ea..7f26d5813db 100644 --- a/rs/moq-net/src/route/tests/mod.rs +++ b/rs/moq-net/src/route/tests/mod.rs @@ -14,7 +14,6 @@ mod handoff; mod interest; mod residual; mod routing; -mod rtt; mod scope; mod search; @@ -115,7 +114,6 @@ pub(super) fn along(hops: &[(Id, u64)], metric: Metric) -> path::Offer { priority: i8::MAX, metric, down_only: false, - rtt: None, } } @@ -518,26 +516,6 @@ impl Sim { self.flush(); } - /// `node` measures its link to `peer` at `ms`, or nothing. - pub fn rtt(&mut self, node: Node, peer: Node, ms: Option) { - let rtt = ms.map(Duration::from_millis); - self.nodes[node].rtt(peer, rtt); - self.flush(); - } - - /// The last finite route `node` sent `peer` for `id` covering `prefix`, while it - /// stands. - pub fn offer(&self, node: Node, peer: Node, id: Id, prefix: &Path) -> Option<&path::Offer> { - self.offered.get(&(node, peer, id, prefix.clone())) - } - - /// The streams `node` sends a finite route for `id` on. - pub fn sending(&self, node: Node, id: Id) -> usize { - (self.offered.keys()) - .filter(|(from, _, key, _)| *from == node && *key == id) - .count() - } - pub fn hold(&mut self, from: Node, to: Node) { self.held.insert((from, to)); } diff --git a/rs/moq-net/src/route/tests/routing.rs b/rs/moq-net/src/route/tests/routing.rs index a2f3b1ac7fa..14d30bdb47a 100644 --- a/rs/moq-net/src/route/tests/routing.rs +++ b/rs/moq-net/src/route/tests/routing.rs @@ -39,7 +39,6 @@ fn offer(hops: impl IntoIterator, metric: Metric) -> Option Option { - Some(Duration::from_millis(ms)) -} - -/// The RTT `node` advertises to `peer` for `id`. -fn advertised(sim: &Sim, node: Node, peer: Node, id: Id) -> Option { - match sim.offer(node, peer, id, &Path::empty()) { - Some(offer) => offer.rtt, - None => panic!("{node} sends {peer} no route for {id}"), - } -} - -/// The next hop, metric, and RTT of `node`'s route for `id`. -fn route(sim: &Sim, node: Node, id: Id) -> Option<(Option, Metric, Option)> { - let route = sim.path(node).route_for(id, &Path::empty())?; - let offer = route.offer()?; - Some((route.next(), offer.metric, offer.rtt)) -} - -/// A chain origin, a, b, c: each relay measures its link toward the origin. -fn chain() -> Sim { - let (origin, a, b, c) = (0, 1, 2, 3); - let mut sim = Sim::new(4); - sim.join(origin, a, 1); - sim.join(a, b, 1); - sim.join(b, c, 1); - sim.rtt(a, origin, Some(10)); - sim.rtt(b, a, Some(20)); - sim.rtt(c, b, Some(30)); - originate(&mut sim, origin, 7); - assert!(sim.run()); - sim -} - -#[test] -fn each_relay_adds_its_link_to_the_sum() { - let (origin, a, b, c) = (0, 1, 2, 3); - let sim = chain(); - assert_eq!(advertised(&sim, origin, a, 7), ms(0), "the origin's own route"); - assert_eq!(advertised(&sim, a, b, 7), ms(10)); - assert_eq!(advertised(&sim, b, c, 7), ms(30)); - assert_eq!(route(&sim, c, 7), Some((Some(b), 3, ms(60)))); -} - -/// A shift on one link sends one ROUTE_UPDATE on each stream carrying the route from -/// there on, and the same value again sends nothing. -#[test] -fn a_shift_updates_each_stream_downstream_once() { - let (origin, a, b, c) = (0, 1, 2, 3); - let mut sim = chain(); - let downstream: usize = [a, b, c].iter().map(|&node| sim.sending(node, 7)).sum(); - let before = sim.stats.route_msgs; - sim.rtt(a, origin, Some(40)); - assert!(sim.run()); - assert_eq!(sim.stats.route_msgs - before, downstream); - assert_eq!(advertised(&sim, b, c, 7), ms(60)); - - let before = sim.stats.route_msgs; - sim.rtt(a, origin, Some(40)); - assert!(sim.run()); - assert_eq!(sim.stats.route_msgs, before); -} - -/// A link with no measurement leaves the sum unknown from there on, while the nodes -/// before it still carry theirs. -#[test] -fn an_unknown_link_ends_the_sum() { - let (a, b, c) = (1, 2, 3); - let mut sim = chain(); - sim.rtt(b, a, None); - assert!(sim.run()); - assert_eq!(advertised(&sim, a, b, 7), ms(10)); - assert_eq!(advertised(&sim, b, c, 7), None); - assert_eq!(route(&sim, c, 7), Some((Some(b), 3, None))); -} - -/// The metric selects; a far lower RTT through a costlier link changes nothing. -#[test] -fn rtt_never_selects_a_route() { - let (origin, cheap, fast, edge) = (0, 1, 2, 3); - let mut sim = Sim::new(4); - sim.join(origin, cheap, 1); - sim.join(origin, fast, 5); - sim.join(cheap, edge, 1); - sim.join(fast, edge, 1); - sim.rtt(cheap, origin, Some(200)); - sim.rtt(fast, origin, Some(1)); - originate(&mut sim, origin, 7); - assert!(sim.run()); - assert_eq!(sim.next_hop(edge, 7), Some(cheap)); - assert_eq!(advertised(&sim, cheap, edge, 7), ms(200)); -} - -/// The path rule carries the same sum, and a shift on one link reaches the routes -/// through it. -#[test] -fn a_path_route_follows_its_links_rtt() { - let (origin, a, b, c) = (0, 1, 2, 3); - let mut sim = Sim::with(Rule::PATH, 4); - sim.join(origin, a, 1); - sim.join(a, b, 1); - sim.join(b, c, 1); - sim.rtt(a, origin, Some(10)); - sim.rtt(b, a, Some(20)); - sim.rtt(c, b, Some(30)); - originate(&mut sim, origin, 7); - assert!(sim.run()); - let rtt = |sim: &Sim| match sim.path(c).routes(7).next() { - Some((_, path::Route::Live { offer, .. })) => offer.rtt, - _ => panic!("{c} has no live route to 7"), - }; - assert_eq!(rtt(&sim), ms(60)); - sim.rtt(a, origin, Some(40)); - assert!(sim.run()); - assert_eq!(rtt(&sim), ms(90)); -} diff --git a/rs/moq-net/src/route/tests/scope.rs b/rs/moq-net/src/route/tests/scope.rs index 58bf92001b2..094521bca3a 100644 --- a/rs/moq-net/src/route/tests/scope.rs +++ b/rs/moq-net/src/route/tests/scope.rs @@ -11,7 +11,6 @@ fn offered(via: Id, session: u64) -> path::Reach { priority: i8::MAX, metric: 1, down_only: false, - rtt: None, }) } @@ -301,9 +300,9 @@ fn teardown_is_linear_in_prefixes_held() { /// A relay sends each of its downstream neighbours one route through a leaving /// node, each over its own session of that node. Hearing the node drain, hearing it -/// again from another upstream, and any later update that changes no route each cost -/// work linear in the neighbours: a scan of the node's sessions for each neighbour, -/// or a repeat that revisits every route sent through the node, would be quadratic. +/// again from another upstream, and then closing an idle session each cost work +/// linear in the neighbours: a scan of the node's sessions for each neighbour, or a +/// repeat that revisits every route sent through the node, would be quadratic. /// The `cost`s sweep both axes at once, since there is a session per neighbour. #[test] fn drain_news_is_linear_in_neighbours() { @@ -346,7 +345,6 @@ fn drain_news_is_linear_in_neighbours() { priority: i8::MAX, metric: 1, down_only: false, - rtt: None, }; router.route(up, 7, prefix.clone(), Some(path::Reach::Finite(offer))); router.batch(up, 7, prefix, vec![(p(&format!("live/{i}/x")), Some(1))], Some(1)); @@ -377,7 +375,7 @@ fn drain_news_is_linear_in_neighbours() { "a repeat visits each neighbour at most once: {repeated}" ); let before = router.work(); - router.rtt(idle, Some(Duration::from_millis(5))); + router.disconnect([idle], Instant::ZERO); (drained, repeated, router.work() - before) }; let costs: Vec<(usize, usize, usize)> = [8, 16, 32].into_iter().map(cost).collect(); @@ -385,7 +383,7 @@ fn drain_news_is_linear_in_neighbours() { // Quadratic work would quadruple. assert!(pair[1].0 <= 5 * pair[0].0 / 2, "hearing the drain: {costs:?}"); assert!(pair[1].1 <= 5 * pair[0].1 / 2, "hearing it again: {costs:?}"); - assert!(pair[1].2 <= 5 * pair[0].2 / 2, "an idle update: {costs:?}"); + assert!(pair[1].2 <= 5 * pair[0].2 / 2, "closing an idle session: {costs:?}"); } } @@ -1199,7 +1197,6 @@ fn dead_replacement_paths_obey_the_same_limit_as_route_paths() { priority: i8::MAX, metric: 1, down_only: false, - rtt: None, }; router.dead( 1, diff --git a/rs/moq-tokio/tests/integration/broadcast.rs b/rs/moq-tokio/tests/integration/broadcast.rs index efe28237977..66635936e40 100644 --- a/rs/moq-tokio/tests/integration/broadcast.rs +++ b/rs/moq-tokio/tests/integration/broadcast.rs @@ -974,58 +974,6 @@ async fn announce_lifecycle_test(version: &str) { .expect("server task failed"); } -/// A lite-07 route carries the publisher's RTT, 0 at its own node, and the subscriber -/// adds its own link's. -#[tokio::test] -async fn broadcast_moq_lite_07_route_rtt() { - let version = "moq-lite-07-wip"; - let pub_origin = moq_tokio::origin::spawn(); - let _route = pub_origin - .route("room/first", moq_net::origin::RouteOptions::default()) - .expect("create broadcast"); - - let mut server_config = moq_tokio::listen::Config::default(); - server_config.bind = Some("[::]:0".parse().unwrap()); - server_config.tls.generate = vec!["localhost".into()]; - server_config.version = vec![version.parse().unwrap()]; - let server = server_config.init(Default::default()).expect("init server"); - let mut server = server.listen().await.expect("failed to listen"); - let addr = server.local_addr().expect("local addr"); - - let sub_origin = moq_tokio::origin::spawn(); - let mut announcements = sub_origin.consume().announced(); - - let mut client_config = moq_tokio::connect::Config::default(); - client_config.tls.insecure = Some(true); - client_config.version = vec![version.parse().unwrap()]; - let client = client_config.init(Default::default()).expect("init client"); - let url: url::Url = format!("moqt://localhost:{}", addr.port()).parse().unwrap(); - - let server_handle = tokio::spawn(async move { - let request = server.accept().await.expect("accept"); - let session = request.with_publisher(&pub_origin).ok().await?; - let _ = session.closed().await; - Ok::<_, anyhow::Error>(()) - }); - - let client = client.with_subscriber(sub_origin); - let (_client, connection) = kio::clock::timeout(TIMEOUT, connect_once(client, url)) - .await - .expect("connect timeout") - .expect("connect failed"); - let (update, active) = next_announce(&mut announcements).await; - assert_eq!(update.prefix.as_str(), "room/first"); - assert!(active, "expected the initial announce"); - - drop(connection); - server_handle - .await - .expect("server task panicked") - .expect("server task failed"); - let rtt = update.route.rtt().expect("QUIC reports an RTT"); - assert!(rtt > std::time::Duration::ZERO, "rounded up to a whole millisecond"); -} - /// Read `count` groups (one frame each) off the subscriber, returning the sorted /// payloads. Sorted because delivery order across groups isn't guaranteed. async fn read_payloads(sub: &mut moq_net::track::Subscriber, count: usize) -> Vec { diff --git a/swift/Sources/Moq/Aliases.swift b/swift/Sources/Moq/Aliases.swift index 9bc378d9fa1..4ba899aa4c0 100644 --- a/swift/Sources/Moq/Aliases.swift +++ b/swift/Sources/Moq/Aliases.swift @@ -55,9 +55,8 @@ public typealias Datagram = MoqFFI.MoqDatagram /// Names one continuous stream at a path: `Instance.parse(text:)` names one, only a session mints /// one, and `==` also compares `isMinted()`, so pin a reported stream with the instance, not its text. public typealias Instance = MoqFFI.MoqInstance -/// The read-only facts on a received route: the `Instance` of the stream it serves, -/// relay hop ids (oldest first), its static production and link cost, lower wins, and its -/// informational `rtt` to the origin node. +/// The read-only facts on a received route: the `Instance` of the stream it serves, its static +/// production and link cost, lower wins, and whether a usable path reaches it. public typealias RouteInfo = MoqFFI.MoqRouteInfo /// A route over a prefix: the origin-relative `prefix`, what each filter /// wildcard matched (`captures`, a required list, empty without wildcards), and the `route` serving it.