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
3 changes: 2 additions & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ jobs:
# viewer: diff-independent, since a break can arrive through the relay,
# js/net, or the wire between them.
# `rs quic-sim` sweeps moq-quic's simulated workloads from a fresh seed; PRs run a fixed 64.
# `test resume-model` sweeps resume against its model from a fresh seed; PRs run a fixed 64.
# It also runs the bandwidth probe's acceptance suite, of which PRs run the short cases.
# `test drill impaired` runs the relay drills over a freshly seeded shaper; PRs run loopback.
# `rs cli-export` runs moq-cli's export process tests, which take tens of seconds of real time.
Expand All @@ -364,7 +365,7 @@ jobs:
# `rs multicast` runs the mDNS tests, which loop multicast back on the runner.
# `rs render-sw` renders through wgpu on Mesa's software Vulkan driver.
# `test qmux` runs js/qmux against the in-tree Rust qmux, per draft.
recipe: ["gate", "rs doctest --workspace", "rs loom", "test drill-sensitivity", "rs uring", "test drain", "test json-properties", "rs quic-sim", "test drill impaired", "rs cli-export", "rs quic-stress", "rs audio-devices", "rs multicast", "rs render-sw", "test qmux"]
recipe: ["gate", "rs doctest --workspace", "rs loom", "test drill-sensitivity", "rs uring", "test drain", "test json-properties", "test resume-model", "rs quic-sim", "test drill impaired", "rs cli-export", "rs quic-stress", "rs audio-devices", "rs multicast", "rs render-sw", "test qmux"]
include:
- recipe: rs send-depth
nightly: true
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions js/net/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@types/bun": "^1.4.3",
"@types/node": "^26.6.4",
"@typescript/lib-dom": "npm:@types/web@^0.0.358",
"fast-check": "^4.10.2",
"rimraf": "^6.1.3",
"typescript": "7.0.2"
}
Expand Down
15 changes: 11 additions & 4 deletions js/net/src/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,8 @@ export class Consumer {
readonly sequence: number;

#state: GroupState;
// The copy it was mirrored from, which that copy's cache evicts.
readonly #mirrored: GroupState;
#expiry?: Expiry;
// Carries the group across its logical track's route changes; see `resume.ts`.
#recover?: GroupRecover;
Expand All @@ -685,6 +687,7 @@ export class Consumer {

private constructor(state: GroupState) {
this.#state = state;
this.#mirrored = state;
this.sequence = state.sequence;
}

Expand Down Expand Up @@ -746,6 +749,7 @@ export class Consumer {
static {
makeConsumer = (state) => new Consumer(state);
hooks.releaseGroupReader = (group, abort) => group.#release(abort);
hooks.readsMirrored = (group) => group.#state === group.#mirrored;
hooks.groupTimestamp = (group) =>
group.#state.unverified || group.#state.offset !== 0 ? undefined : group.#state.timestamp;
hooks.groupLatest = (group) => (group.#state.unverified ? undefined : group.#state.latest);
Expand Down Expand Up @@ -777,9 +781,7 @@ export class Consumer {
group.#closed = undefined;
};
hooks.readGroupFrame = (group, compressed) => group.#readFrame(0, compressed);
hooks.evictGroup = (group) => {
group.#evict();
};
hooks.evictGroup = (group) => group.#evict();
}

// Evaluate the drift budget for a read that has nothing buffered and is about to
Expand All @@ -801,7 +803,9 @@ export class Consumer {
return true;
}

#evict() {
#evict(): boolean {
// A group read on from another copy is that copy's to reclaim.
if (this.#state !== this.#mirrored) return false;
const frames = this.#bufferedFrames();
if (frames.length > 0) {
// Unread content is going away either way. If the budget had already given up
Expand All @@ -819,6 +823,9 @@ export class Consumer {
this.#state.cacheBytes = 0;
this.#state.flate = undefined;
this.#state.frames.set([]);
// A failed copy holds nothing more to reclaim, and its recovery may still continue the group.
const closed = this.#state.closed.peek();
return !(closed instanceof Error && this.#recovers(closed));
}

// The next change a parked read waits for.
Expand Down
12 changes: 10 additions & 2 deletions js/net/src/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,8 @@ export const hooks: {
* Assigned by `group.ts`.
*/
releaseGroupReader: (group: GroupConsumer, abort?: Error) => void;
/** Whether a group reader still reads the copy it was mirrored from, not one its recovery moved it to. */
readsMirrored: (group: GroupConsumer) => boolean;
groupTimestamp: (group: GroupConsumer) => Timestamp | undefined;
groupLatest: (group: GroupConsumer) => Timestamp | undefined;
/** Return when a group joined its track at this hop, on the installed clock. */
Expand All @@ -572,8 +574,11 @@ export const hooks: {
recoverGroup: (group: GroupConsumer, recover: GroupRecover) => void;
/** Read the next frame, as its stored DEFLATE slice when `compressed`, so a lite-07 publisher forwards it without inflating. */
readGroupFrame: (group: GroupConsumer, compressed: boolean) => Promise<ReadGroupFrame | undefined>;
/** Make an evicted mirror terminal while its track timeline still contains it. */
evictGroup: (group: GroupConsumer) => void;
/**
* Make an evicted mirror terminal while its track timeline still contains it. Whether the
* mirror is released too: not when its group reads on, or may yet, from another copy.
*/
evictGroup: (group: GroupConsumer) => boolean;
/** Attach the origin advertisement of a created broadcast. */
attachAnnouncer: (
producer: BroadcastProducer,
Expand Down Expand Up @@ -771,6 +776,9 @@ export const hooks: {
releaseGroupReader: () => {
throw new Error("group.ts not loaded");
},
readsMirrored: () => {
throw new Error("group.ts not loaded");
},
groupTimestamp: () => {
throw new Error("group.ts not loaded");
},
Expand Down
Loading
Loading