Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0775240
chore(quest): claim quest/m1/api-audit/route/serve.md
kixelated Nov 1, 2026
da3fea2
feat(net): serve held broadcasts through prefix routes
kixelated Nov 1, 2026
3558352
style(net): format cross-version serve tests
kixelated Nov 1, 2026
2dcf502
test(net): retain the published track through first subscribe
kixelated Nov 1, 2026
346446c
docs(net): describe all prefix request answers
kixelated Nov 1, 2026
13457e4
docs(net): remove the retired direct-publish comment
kixelated Nov 1, 2026
f7fce9c
refactor(net): use public serve in test and benchmark consumers
kixelated Nov 1, 2026
53429e5
Merge remote-tracking branch 'origin/main' into worktree-agent-add630…
kixelated Nov 1, 2026
f5a92b3
refactor(net): drop the session-delivered mark serve no longer reads
kixelated Nov 1, 2026
520b701
docs(bindings): point held-broadcast answers at serve
kixelated Nov 1, 2026
8403982
Merge remote-tracking branch 'origin/main' into iterate-7485
kixelated Nov 2, 2026
7903f5a
test(py): use Timestamp for held broadcast content
kixelated Nov 2, 2026
04ef021
test(net): serve the merged track status request through the public API
kixelated Nov 2, 2026
8693cfb
docs(go): name the consumer passed to a held broadcast request
kixelated Nov 2, 2026
7e7d6f9
fix(net): gate held-answer test and clarify routing docs
kixelated Nov 2, 2026
66412dc
Merge remote-tracking branch 'origin/main' into quest/m1/api-audit/ro…
kixelated Nov 3, 2026
1a1a65d
test(net): adapt held-answer tests to fresh-instance prepare
kixelated Nov 3, 2026
8dfe2b4
Merge remote-tracking branch 'origin/main' into quest/m1/api-audit/ro…
kixelated Nov 3, 2026
c5df124
test(net): serve the group ID request through the public API
kixelated Nov 3, 2026
fe44ac0
docs(net): name the current crate-private route functions in MIGRATE
kixelated Nov 3, 2026
97b74c6
Merge remote-tracking branch 'origin/main' into quest/m1/api-audit/ro…
kixelated Nov 3, 2026
d073c40
Merge remote-tracking branch 'origin/main' into quest/m1/api-audit/ro…
kixelated Nov 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions c/moq/MIGRATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Publish a replacement under a new name, and expect a finished track's demand ter

`moq_origin_dynamic` takes no route, and `moq_origin_dynamic_update` is gone.
`moq_broadcast_request_accept` is replaced by `moq_broadcast_request_prepare`, which returns a prepared answer: fill its broadcast, then `moq_broadcast_prepared_publish` announces it at the exact path under a fresh instance of its own.
To answer with a broadcast you already hold, `moq_broadcast_request_serve(request, consumer)` serves it under the prefix route without announcing an exact route; the consumer stays yours to free.
`moq_broadcast_prepared_free` refuses an answer you will not publish.

### `moq_track_info` gains `compress` (#5928)
Expand Down
1 change: 1 addition & 0 deletions dart/moq/MIGRATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ Publish a replacement under a new name, and expect a finished track's demand wat

`origin.dynamic_(prefix:)` takes no route, and `update` is gone.
Replace `request.accept(broadcast:)` with `request.prepare()`, which returns a `BroadcastPrepared`: fill its `broadcast()`, then `publish()` announces it at the exact path under a fresh instance of its own and returns its producer.
To answer with a broadcast you already hold, `request.serve(broadcast: producer.consume())` serves it under the prefix route without announcing an exact route.

### Anchors can name a time (#6074)

Expand Down
28 changes: 27 additions & 1 deletion dart/moq_ffi/lib/src/moq.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12444,6 +12444,7 @@ abstract class MoqBroadcastRequestInterface {
String path();
MoqBroadcastPrepared prepare();
void reject({required int errorCode});
void serve({required MoqBroadcastConsumer broadcast});
}

final _MoqBroadcastRequestFinalizer = Finalizer<Pointer<Void>>((ptr) {
Expand Down Expand Up @@ -12514,6 +12515,16 @@ class MoqBroadcastRequest implements MoqBroadcastRequestInterface {
);
}, moqExceptionErrorHandler);
}

void serve({required MoqBroadcastConsumer broadcast}) {
return rustCall((status) {
uniffi_moq_ffi_fn_method_moqbroadcastrequest_serve(
uniffiClonePointer(),
FfiConverterMoqBroadcastConsumer.lower(broadcast),
status,
);
}, moqExceptionErrorHandler);
}
}

class FfiConverterMoqBroadcastRequest {
Expand Down Expand Up @@ -19506,6 +19517,15 @@ external void uniffi_moq_ffi_fn_method_moqbroadcastrequest_reject(
Pointer<RustCallStatus> uniffiStatus,
);

@Native<Void Function(Pointer<Void>, Pointer<Void>, Pointer<RustCallStatus>)>(
assetId: _uniffiAssetId,
)
external void uniffi_moq_ffi_fn_method_moqbroadcastrequest_serve(
Pointer<Void> ptr,
Pointer<Void> broadcast,
Pointer<RustCallStatus> uniffiStatus,
);

@Native<Pointer<Void> Function(Pointer<Void>, Pointer<RustCallStatus>)>(
assetId: _uniffiAssetId,
)
Expand Down Expand Up @@ -21378,6 +21398,9 @@ external int uniffi_moq_ffi_checksum_method_moqbroadcastrequest_prepare();
@Native<Uint16 Function()>(assetId: _uniffiAssetId)
external int uniffi_moq_ffi_checksum_method_moqbroadcastrequest_reject();

@Native<Uint16 Function()>(assetId: _uniffiAssetId)
external int uniffi_moq_ffi_checksum_method_moqbroadcastrequest_serve();

@Native<Uint16 Function()>(assetId: _uniffiAssetId)
external int uniffi_moq_ffi_checksum_method_moqfollowing_available();

Expand Down Expand Up @@ -22105,6 +22128,9 @@ void _checkApiChecksums() {
if (uniffi_moq_ffi_checksum_method_moqbroadcastrequest_reject() != 9727) {
throw UniffiInternalError.panicked("UniFFI API checksum mismatch");
}
if (uniffi_moq_ffi_checksum_method_moqbroadcastrequest_serve() != 16802) {
throw UniffiInternalError.panicked("UniFFI API checksum mismatch");
}
if (uniffi_moq_ffi_checksum_method_moqfollowing_available() != 39867) {
throw UniffiInternalError.panicked("UniFFI API checksum mismatch");
}
Expand Down Expand Up @@ -22134,7 +22160,7 @@ void _checkApiChecksums() {
throw UniffiInternalError.panicked("UniFFI API checksum mismatch");
}
if (uniffi_moq_ffi_checksum_method_moqoriginrequests_requested_broadcast() !=
31253) {
47029) {
throw UniffiInternalError.panicked("UniFFI API checksum mismatch");
}
if (uniffi_moq_ffi_checksum_method_moqpublication_announce() != 60624) {
Expand Down
2 changes: 2 additions & 0 deletions dart/moq_ffi/lib/src/uniffi_runtime.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import "dart:ffi";
import "dart:io" show Platform, File, Directory;
import "dart:isolate";
import "dart:typed_data";

import "package:ffi/ffi.dart";

class UniffiInternalError implements Exception {
Expand Down Expand Up @@ -252,6 +253,7 @@ mixin FfiConverterPrimitive<T> on FfiConverter<T, T> {
@override
T lower(T value) => value;
}

Uint8List createUint8ListFromInt(int value) {
int length = value.bitLength ~/ 8 + 1;
if (length != 4 && length != 8) {
Expand Down
15 changes: 11 additions & 4 deletions doc/concept/identity.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,17 @@ demand, which has none until a worker answers.

## Work on demand

A worker can advertise a prefix it serves on demand, such as a transcoder
claiming `transcode`. A claim promises capability, not content. Each requested
path is a separate job, announced at its exact path under a fresh instance of
its own.
A worker can advertise a prefix it serves on demand and answer with a
broadcast it already holds. This announces no exact route: the answer belongs
to the prefix route's instance at that path. Every answer there must continue
one sequence space with the same bytes. To serve different content at a path
already served, start a new prefix route. Its first subscription stays on
the prefix route without a restart.

A job that may restart independently, such as a transcoder claiming
`transcode`, instead prepares and publishes each requested path. A claim
promises capability, not content. Each requested path is a separate job,
announced at its exact path under a fresh instance of its own.

```rust
let claim = origin.requests("transcode")?;
Expand Down
6 changes: 6 additions & 0 deletions doc/lib/layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ Sessions, origins, broadcasts, tracks, and groups: `Client`, `Server`,
| C++ | `moq::` | `moq::BroadcastProducer` |
| C | `moq_session_*`, `moq_origin_*`, `moq_publish_track_*`, `moq_consume_track_*` | `moq_publish_track` |

On-demand broadcast requests in every binding can answer with held content
without announcing an exact route. The answer uses the prefix route's
continuous sequence space at that path. Use a fresh publication for a job
that may restart independently; see [work on demand](/concept/identity#work-on-demand)
and the [Go](/lib/go/) and [C](/lib/c/) binding references.

## media

The catalog, encoded-media imports, and container-decoded reads, merging
Expand Down
1 change: 1 addition & 0 deletions go/wrapper/MIGRATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ Publish a replacement under a new name, and expect a finished track's demand wat

`OriginProducer.Dynamic(prefix)` takes no route, and `OriginDynamic.Update` is gone.
Replace `request.Accept(broadcast)` with `request.Prepare()`, which returns a `*BroadcastPrepared`: fill its `Broadcast()`, then `Publish()` announces it at the exact path under a fresh instance of its own and returns its producer.
To answer with a broadcast you already hold, `request.Serve(consumer)` serves it under the prefix route without announcing an exact route; the consumer stays yours to close.
Where you rejected a request after a failed setup, `Close()` the prepared answer instead.

### `TrackInfo` gains `Compress` (#5928)
Expand Down
6 changes: 6 additions & 0 deletions go/wrapper/origin.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ func (r *BroadcastRequest) Prepare() (*BroadcastPrepared, error) {
return &BroadcastPrepared{inner: inner}, nil
}

// Serve answers with held content under the prefix route's continuous sequence space,
// without announcing an exact route. The broadcast remains the caller's to release.
func (r *BroadcastRequest) Serve(broadcast *BroadcastConsumer) error {
return r.inner.Serve(broadcast.inner)
}

// Reject fails the request with an application error code.
func (r *BroadcastRequest) Reject(errorCode uint16) error {
return r.inner.Reject(errorCode)
Expand Down
5 changes: 3 additions & 2 deletions go/wrapper/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ type BroadcastProducer struct {
}

// NewBroadcastProducer creates a standalone broadcast, not attached to any
// origin: use it to serve a dynamic request ([BroadcastRequest.Accept]) or for
// local pub/sub. To publish at a path, use [OriginProducer.CreateBroadcast].
// origin: pass its [BroadcastProducer.Consume] result to [BroadcastRequest.Serve]
// for a dynamic request, or use it for local pub/sub. To publish at a path, use
// [OriginProducer.CreateBroadcast].
func NewBroadcastProducer() (*BroadcastProducer, error) {
inner, err := ffi.NewMoqBroadcastProducer()
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion js/net/MIGRATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ Only `publish` announces it: `prepared.broadcast` has no announcement methods.
`Prepared.reject(err)` is replaced by idempotent `close()` and `[Symbol.dispose]()`; either refuses the unpublished answer as `Unroutable` and closes its broadcast. Closing that broadcast also refuses the request. `using` handles normal scope exit and exceptions; after `publish()`, disposal leaves the returned publication and its fill producer live.
Use `request.reject(err)` to refuse before preparing. A retained, unclosed `Prepared` keeps its request pending; garbage collection provides no prompt cleanup guarantee.
Construct a `Prepared` only with `request.prepare()`. Its constructor and the `Request.publisher`, `publishPrepared`, and `rejectPrepared` completion hooks are no longer public.
`Dynamic.update` is no longer part of the public API, and `Request` has no `accept` (#6496): only the built-in sessions answer with a broadcast they already hold.
`Dynamic.update` is no longer part of the public API (#6496).
`Request.serve(broadcast)` additively exposes the former private answer path: serve held content without announcing an exact route. The prefix route promises the same bytes and continuous sequences at each served path; start a new prefix route for different content, or prepare and publish an independent job.
Close the claim and claim again to change it, and close an answer's producer to end that output.

### `largest()` reports within a reader's `setGroups` bounds
Expand Down
1 change: 1 addition & 0 deletions js/net/api/index.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ export namespace Origin {
readonly path: Path.Valid;
prepare(): Origin.Prepared;
reject(err: Error): void;
serve(source: Broadcast.Producer | Broadcast.Consumer): void;
}
export interface RequestOptions {
instance?: Instance.Valid;
Expand Down
3 changes: 1 addition & 2 deletions js/net/bench/broadcasts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Producer as BroadcastProducer } from "../src/broadcast.ts";
import { BroadcastCache } from "../src/consume.ts";
import { HopSchema, Route } from "../src/hop.ts";
import * as Instance from "../src/instance.ts";
import { hooks } from "../src/internal.ts";
import { AnnounceRequest } from "../src/lite/announce.ts";
import { Publisher } from "../src/lite/publisher.ts";
import { Subscriber } from "../src/lite/subscriber.ts";
Expand Down Expand Up @@ -243,7 +242,7 @@ for (const pathCount of routeCounts) {
const broadcasts = Array.from({ length: pathCount }, () => new BroadcastProducer());
for (const broadcast of broadcasts) {
const request = (await pending.next()).value;
if (request) hooks.acceptRequest(request, broadcast);
if (request) request.serve(broadcast);
}
await Promise.resolve();
const before = requests.map((request) => request.active.peek());
Expand Down
5 changes: 2 additions & 3 deletions js/net/bench/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
} from "../src/ietf/subscribe_namespace";
import { ALPN, Version } from "../src/ietf/version";
import * as Instance from "../src/instance.ts";
import { hooks } from "../src/internal";
import { createMockTransportPair } from "../src/mock";
import { Producer } from "../src/origin";
import * as Path from "../src/path";
Expand Down Expand Up @@ -149,7 +148,7 @@ for (const failovers of [0, 1, 16, 128])
const source = new Broadcast();
sources.push(source);
const answer = (await ar.next()).value;
if (answer) hooks.acceptRequest(answer, source);
if (answer) answer.serve(source);
await settle();
entries.push({ primary, ar, br, held });
}
Expand Down Expand Up @@ -186,7 +185,7 @@ for (const failovers of [0, 1, 16, 128])
for (let i = 0; i < entries.length; i++) {
const source = new Broadcast();
sources.push(source);
hooks.acceptRequest(pending[i], source);
pending[i].serve(source);
await settle();
if (!readsFrom(entries[i].held.active.peek(), source)) throw new Error("lost failover");
}
Expand Down
4 changes: 2 additions & 2 deletions js/net/src/connection/forward.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Milli, Nano } from "@moq/clock";
import { type Dispose, race } from "@moq/signals";
import type * as Announce from "../announced.ts";
import { type Route, routesEqual } from "../hop.ts";
import { coveringPrefixes, hooks } from "../internal.ts";
import { coveringPrefixes } from "../internal.ts";
import type { Producer as OriginProducer, RequestSlot, Requests } from "../origin.ts";
import * as Path from "../path.ts";
import { after } from "../util/timer.ts";
Expand Down Expand Up @@ -293,7 +293,7 @@ async function drive(handle: Requests, conn: Established): Promise<void> {
const session = wireOf(conn);
try {
for await (const request of handle.requested()) {
hooks.acceptRequest(request, session.consume(request.path));
request.serve(session.consume(request.path));
}
} catch {
handle.close();
Expand Down
3 changes: 1 addition & 2 deletions js/net/src/group-id.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { expect, test } from "bun:test";
import { type Consumer as BroadcastConsumer, Producer as BroadcastProducer } from "./broadcast.ts";
import { accept, connect } from "./connection/index.ts";
import * as Ietf from "./ietf/index.ts";
import { hooks } from "./internal.ts";
import * as Lite from "./lite/index.ts";
import { createMockTransportPair } from "./mock.ts";
import { Producer as OriginProducer } from "./origin.ts";
Expand Down Expand Up @@ -87,7 +86,7 @@ for (const wire of WIRES) {
for await (const request of dynamic.requested()) {
const input = wireOf(ingest).consume(request.path);
inputs.push(input);
hooks.acceptRequest(request, await forward(input));
request.serve(await forward(input));
}
})();

Expand Down
10 changes: 5 additions & 5 deletions js/net/src/ietf/publisher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ test("TRACK_STATUS finished at once is answered on every draft", async () => {
finish();
const served = new BroadcastProducer();
served.createTrack("video");
hooks.acceptRequest(pending, served);
pending.serve(served);
await task;
expect(await wire().u53()).toBe(TrackStatusOk.id);

Expand Down Expand Up @@ -439,7 +439,7 @@ test("a cancelled TRACK_STATUS releases its demand on every draft", async () =>
expect(early.written).toEqual([]);
// Withdrawn, so a late answer is closed rather than served.
const answer = new SessionBroadcast();
hooks.acceptRequest(pending, answer);
pending.serve(answer);
expect(answer.closed.peek()).toBeNull();

// The broadcast resolves, but its track is never answered.
Expand All @@ -449,7 +449,7 @@ test("a cancelled TRACK_STATUS releases its demand on every draft", async () =>
if (!request) throw new Error("no request for room/late");
const served = new BroadcastProducer();
const trackRequest = wireOf(served).requested();
hooks.acceptRequest(request, served);
request.serve(served);
const track = await trackRequest;
expect(track?.name).toBe("video");
late.cancel();
Expand Down Expand Up @@ -491,7 +491,7 @@ test("a SUBSCRIBE withdrawn during setup releases its demand on every draft", as
expect(early.written).toEqual([]);
// Withdrawn, so a late answer is closed rather than served.
const answer = new SessionBroadcast();
if (pending) hooks.acceptRequest(pending, answer);
if (pending) pending.serve(answer);
expect(answer.closed.peek()).toBeNull();

// The broadcast resolves, but its track is never answered.
Expand All @@ -501,7 +501,7 @@ test("a SUBSCRIBE withdrawn during setup releases its demand on every draft", as
if (!request) throw new Error("no request for room/late");
const served = new BroadcastProducer();
const trackRequest = wireOf(served).requested();
hooks.acceptRequest(request, served);
request.serve(served);
const track = await trackRequest;
if (!track) throw new Error("no request for video");
expect(track.name).toBe("video");
Expand Down
Loading
Loading