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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/bin/relay/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ relay.with_web(web).run().await?;
from `relay.shutdown().admission()` and pass `relay.shutdown().clone()` to
`Connection::with_shutdown`, so the drain waits for its handshakes too.
- To serve a session from any other moq-net transport, such as the in-memory
one in tests, enable the `test-support` feature, read its SETUP with `moq_net::Server::accept_request` and pass
one in tests, enable the `test-support` feature, read its SETUP with `moq_net::Server::handshake` and pass
`Accepted::new(handshake, transport)` to `Connection::new`. The client must
send its path in the SETUP. The server's accept timeout (`moq_net::Server::with_timeout`)
bounds admission and, on moq-lite 01/02, the SETUP reply too.
Expand Down
3 changes: 2 additions & 1 deletion doc/concept/identity.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ A route resolving a path is chosen in this order:
because the timeline continues.
3. Among eligible routes: a route from a peer that has not sent GOAWAY
(a draining peer's routes rank below every other, whatever their preference
or cost, and serve only as a last resort), then the preferred link, then an
or cost, and serve only as a last resort), then the highest priority, which on
moq-lite 07 is the lowest of any link along the route's path, then an
identified chain
over an anonymous one, then the lowest cost, then a broadcast published on
this origin, then the shortest hop chain, then a hash of the full requested
Expand Down
7 changes: 4 additions & 3 deletions doc/concept/moq-lite.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ hidden names work exactly as before.
instance, so it never inherits those viewers.
- **Most specific, then highest epoch, then rank.** The most specific prefix
wins. Within one instance only its highest epoch is eligible, ahead of cost.
Among instances the order is link preference, cost, a broadcast published
Among instances the order is link priority, cost, a broadcast published
locally, hop length, then a hash of the instance and the path, so relays
agree and a pool's paths spread over its hosts. See
[choosing a route](/concept/identity#choosing-a-route).
Expand Down Expand Up @@ -161,9 +161,10 @@ choosing instances, following restarts, and answering work on demand.

An endpoint can hold sessions to several CDNs at once, each feeding one shared
origin, and rank them: moq.pro as primary, another CDN as secondary. The rank is
a per-link preference the endpoint sets (higher wins, 0 is neutral, negative demotes), never sent on the wire. It decides
a per-link priority the endpoint sets (higher wins, 0 is neutral, negative demotes), unrelated to a subscription's priority. It decides
among instances before cost, so metrics from different operators are never
compared. A subscription uses the preferred link that has a route and moves to the
compared. After the earlier keys of [choosing a route](/concept/identity#choosing-a-route), a subscription uses the
route with the highest priority, on moq-lite 07 the lowest of any link along its path, and moves to the
next when that route goes; a publisher pushes the same broadcast to every CDN.

The move resumes without a seam only between routes with the same instance,
Expand Down
4 changes: 2 additions & 2 deletions doc/lib/rs/moq-net.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ moq-transport at setup and presents one API either way. Media is a layer above
What you use it for, beyond what the concept page already describes:

- **An origin outlives the session.** `origin.route(path, options)` returns a `Route` that owns the broadcast to fill (`route.broadcast()`) and controls its announcement: `announce()`, `withdraw()`, `set_cost()`, and dropping the last clone retracts it. `origin.claim(prefix, options)` returns a `Claim` that serves requests beneath a prefix instead: `claim.requested()` yields each one, answered with `request.serve(held)`, `request.route(options)` (the path's own exact route) or `reject`. A `Claim` has the same announcement controls and no broadcast. A standalone broadcast cannot announce; publish one only through a claim's `serve`. A reconnect announces existing routes again, and closing the session does not delete them.
- **Routes report what the mesh filled in.** An announcement's `route` gives its `instance()` and `cost()`; an application sets only `RouteOptions`. The hop chain a relay uses for loop detection stays internal. An origin's own hop id is `origin::Config::hop`, random unless a relay names one.
- **Routes report what the mesh filled in.** An announcement's `route` gives its `instance()` and `cost()`; an application sets only `RouteOptions`. The hop chain a relay uses for loop detection stays internal. An origin's own Node ID is `origin::Config::node`, random unless a relay names one.
- **Requests can pin an instance.** `consumer.request(path, Some(instance))` resolves only through a route announcing that [publisher instance](/concept/moq-lite#publisher-instances); `None` takes whichever route wins. The resolved consumer names its instance in `info().instance`, pinned or not. `origin.route(path, options)` serves a random instance minted when it is created and kept across `withdraw()` and `announce()`. Unless one is named, a claim moves to a fresh instance each time a job holding its current one ends, and a job takes the claim's. Set one with `RouteOptions::with_instance(instance, epoch)` only for a publisher that continues its timeline across restarts, so its group starts keep rising, and raises the epoch each time. `route.instance()` names it.
- **Rank several CDNs.** Dial each with its own subscribe handle, `origin.clone().with_preference(origin::Preference::new(rank))` (higher wins; 0 is neutral and a negative rank demotes), all on one origin. Requests use the preferred link that has a route and fail over to the next; see [multiple CDNs](/concept/moq-lite#multiple-cdns).
- **Rank several CDNs.** Dial each with its own subscribe handle, `origin.clone().with_priority(origin::Priority::new(rank))` (higher wins; 0 is neutral and a negative rank demotes), all on one origin. After the earlier route keys, requests use the route with the highest priority, on moq-lite 07 the lowest of any link along its path, and fail over to the next; see [multiple CDNs](/concept/moq-lite#multiple-cdns).
- **Request one instance, or follow them all.** `consumer.request(path, None)` resolves the instance serving a path now, and fails `Unroutable` only once discovery has synced with no route for it. `consumer.follow(path, None)` hands out each publisher instance serving a path from `available()`: the first once announced, then each one that takes over, `None` once the path goes offline, and whatever serves it next, like JS `follow(path)`. `consumer.announced()` lists paths as present, then unavailable or available as a held route loses and recovers its path, and finally absent once the origin withdraws one or offline once this side lets go of it, which says nothing of whether the origin still serves it. A broadcast already resolved stays on the old instance until dropped or its route goes. See [identity and recovery](/concept/identity) to choose between following and holding one instance.
- **Discovery follows what you watch.** A client session asks the relay for announcements only under the prefixes its subscribe origin's readers watch, with `announced()`, `request`, or `follow`, stops asking about a prefix 2s after nothing at or beneath it is watched, and asks again on reconnect. A broadcast resolved through a discovered route keeps its path watched until dropped. `request` owns discovery of its path, so no separate watch is needed. A server session, or a client fed into an origin handle marked `with_link(origin::Link::Peer)` or `Link::Upstream`, asks for everything it may, so a relay discovers everything. An HTTP gateway (the moq-hls `Server`, the moq-webrtc WHEP router) watches its whole scope while it lives, so the paths its callers name never open a request each. moq-lite-03/04 sessions, whose announcements mark no initial set, still ask for everything.
- **Relay by opting into proxying.** On moq-lite-07 (`moq-lite-07-wip`, opt-in) a session sends its peer only the routes to its origin's own claims, so an application never becomes transit for anyone else. A relay built on the library marks the handle it publishes with `origin.clone().with_proxy(true)` to carry what it learned from other peers too; `moq-relay` does so for every session. Older versions advertise everything either way.
Expand Down
3 changes: 1 addition & 2 deletions quest/m2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ removal, a rename, or a wire, catalog, or format change that is free until
of [cache-aware multicast](/quest/m2/multicast/README.md), whose
[switch](/quest/m2/multicast/switch.md) also settles the public route API
and retires the moq-cluster draft.
- **moq-net API.** [Names](/quest/m2/net-renames.md) and
[session codes](/quest/m2/session-codes.md).
- **moq-net API.** [Session codes](/quest/m2/session-codes.md).
[Socket endpoints](/quest/m2/sockets/README.md) leave for Kixel, and the
demos return to their earlier format.
- **Unused API.** [One sweep per area](/quest/m2/unused-api/README.md), each
Expand Down
2 changes: 1 addition & 1 deletion quest/m2/cluster-routes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ the bullets below are the contract it carries.
Switching between paths resumes only across a matching explicit epoch.
Keep administrative identity and broadcast epoch separate. A node names
itself in paths by a hop fresh per process, since its session numbers
restart with it (`Router::new`); the origin's `Config::hop` is both that
restart with it (`Router::new`); the origin's `Config::node` is both that
hop and its declared identity, so one set by hand must be fresh per
process too. A random identity alone does not keep a dead incarnation
away. What bounds it is ordered sessions, state scoped to the session that
Expand Down
8 changes: 3 additions & 5 deletions quest/m2/multicast/switch.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,9 @@ omission. All in `rs/moq-net/src/model/origin.rs`:
value, which AGENTS.md forbids in public API. Crate-private.
- Before hiding each, grep Kixel and moq.pro for a caller (the maintainer's
condition for every unused-API removal) and keep what one uses.
- Two renames ride [the moq-net renames](/quest/m2/net-renames.md), not
this PR: `Config::hop` to `node`, and `with_preference` to `priority`.
Whichever lands second rebases; this PR must not reintroduce the old
names. The Route Offer's priority byte stays on the wire: the relay has
no key to set it yet, and
- `Config::hop` is now `node` and `with_preference` is `with_priority`;
this PR must not reintroduce the old names. The Route Offer's priority
byte stays on the wire: the relay has no key to set it yet, and
[outbound federation](/quest/m3/cluster-routing/federation.md) adds one.
- moq-ffi exposes only a route's `cost` and `available`
(`rs/moq-ffi/src/origin.rs`), so no binding changes.
Expand Down
85 changes: 0 additions & 85 deletions quest/m2/net-renames.md

This file was deleted.

4 changes: 0 additions & 4 deletions quest/m2/session-codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,3 @@ holds its pads on a lost source and fails on a refusal, as today.
Public API: breaking in Rust (`SessionError` variants), moq-ffi
(`MoqProtocolKind`), moq-c (`moq.h` constants), the wrappers, and JS; adds
the classification method. Wire: none.

## Related

- [moq-net's node, version, handshake, and route priority](/quest/m2/net-renames.md) - the renames beside this in the same crate
1 change: 0 additions & 1 deletion quest/m2/unused-api/net.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@ Public API: breaking, removals only. Wire: none.
## Related

- [Browser audio holes](/quest/m2/audio-playout/browser-audio-hole-skip.md) - the browser counterpart of the reader moving onto `Gap`
- [moq-net's node, version, handshake, and route priority](/quest/m2/net-renames.md) - makes `Version` opaque
4 changes: 2 additions & 2 deletions rs/moq-ffi/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8346,7 +8346,7 @@ async fn request_accept_inherits_overrides_and_captures_origins() {
let fresh = MoqOriginProducer::new(MoqOriginConfig::default());
let publish = override_publish.then(|| fresh.clone());
let consume = override_consume.then(|| fresh.clone());
let expected_publish = publish.as_ref().unwrap_or(&default_publish).inner().hop();
let expected_publish = publish.as_ref().unwrap_or(&default_publish).inner().node();
let expected_consume = consume.as_ref().unwrap_or(&default_consume).consume();
let captured = Arc::downgrade(&fresh);
let server = MoqServer::new(MoqServerConfig {
Expand Down Expand Up @@ -8397,7 +8397,7 @@ async fn request_accept_inherits_overrides_and_captures_origins() {
kio::clock::timeout(TIMEOUT, hold).await.unwrap().unwrap().unwrap();
let session = kio::clock::timeout(TIMEOUT, accept).await.unwrap().unwrap().unwrap();
let client_session = kio::clock::timeout(TIMEOUT, connect).await.unwrap().unwrap().unwrap();
assert_eq!(session.publish().inner().hop(), expected_publish);
assert_eq!(session.publish().inner().node(), expected_publish);

// Incoming broadcasts reach the selected consume origin, independently
// of which publish side was selected.
Expand Down
4 changes: 2 additions & 2 deletions rs/moq-net/benches/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async fn pair(origins: Option<Origins<'_>>) -> Pair {
if let Some(origins) = &origins {
config = config.with_subscriber(origins.subscribe.clone());
}
let mut request = config.accept_request(harness::now(), server).await.unwrap();
let mut request = config.handshake(harness::now(), server).await.unwrap();
let requests = request.requests();
let (session, driver) = request.ok().await.unwrap();
harness::spawn(driver);
Expand Down Expand Up @@ -142,7 +142,7 @@ async fn publisher(origin: &origin::Producer) -> (Session, Session, auth::Reques
.with_versions(version.into())
.with_solicit(false)
.with_subscriber(subscribe.clone())
.accept_request(harness::now(), server)
.handshake(harness::now(), server)
.await
.unwrap();
let requests = request.requests();
Expand Down
Loading