Skip to content

refactor!: SubscriptionExt, layout and endpoint config in iroh-live-node, explicit media re-exports - #98

Closed
Frando wants to merge 4 commits into
Frando/send-groupsfrom
Frando/cleanups-next
Closed

Frando wants to merge 4 commits into
Frando/send-groupsfrom
Frando/cleanups-next

Conversation

@Frando

@Frando Frando commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Stacked on #96. It has three small API cleanups, one per commit.

1. SubscriptionExt::remote_broadcast()

The free function iroh_live::media::remote_broadcast(&subscription) was hard to find, because users look for a method on Subscription first. Subscription lives in iroh-live-node, which has no media dependency, so the method cannot be inherent. The facade now adds it through the extension trait iroh_live::media::SubscriptionExt, and the free function is removed.

// Before
let player = remote_broadcast(&subscription).play(PlayerConfig::default())?;
// After, with `use iroh_live::media::SubscriptionExt`
let player = subscription.remote_broadcast().play(PlayerConfig::default())?;

2. Layout and endpoint setup move to iroh-live-node

iroh-live-relay depended on the facade only for LiveLayout, EndpointConfig, BroadcastTicket and the rooms part of the layout grant. That inverted the dependency direction: the relay sits below the facade. These types need only the node, so they now live in iroh-live-node:

  • iroh_live_node::layout (with LiveLayout, grant and policy);
  • iroh_live_node::{EndpointConfig, Mdns, load_or_create_secret_key}.

The facade re-exports them at the old paths (iroh_live::layout, iroh_live::EndpointConfig and so on), so code that imports them from iroh_live does not change. The mDNS dependency iroh-mdns-peer-lookup moves from the facade to the node with them.

The binding errors move with EndpointConfig. iroh_live::Error::SecretKey and iroh_live::Error::Bind are gone. They are now iroh_live_node::Error::SecretKey and iroh_live_node::Error::Bind, and they reach iroh_live::Error through its Node variant. Code that propagates with ? does not change. Code that matches on the two variants must match Error::Node(node::Error::Bind { .. }) instead.

The relay now depends on the node and on iroh-live-rooms directly. It keeps the facade only as a dev-dependency, for the tests that publish and play real media through it. A new test in iroh-live-rooms checks that the live and rooms layouts compose into one policy.

Crate Dependencies before (workspace and mDNS crates) Dependencies after
iroh-live-relay iroh-live (feature rooms), iroh-live-node, moq-transport-iroh iroh-live-node, iroh-live-rooms, moq-transport-iroh
iroh-live iroh-live-node, iroh-mdns-peer-lookup, ... iroh-live-node, ...
iroh-live-node ... ..., iroh-mdns-peer-lookup

The relay's dev-dependencies keep iroh-live with media and rooms. iroh-live-rooms moves from the relay's dev-dependencies to its normal dependencies.

3. Explicit re-exports in iroh_live::media

iroh_live::media re-exported moq_ext_player::* and moq_ext_publisher::*. Every new item of either crate thus became facade API without review, and a later name clash between the two would become an ambiguity error in user code. The module now names each item. The list matches what the globs exported, except the hidden test_util module. The commit also adds a paragraph to the facade's crate docs: it says which error each call returns, and that all of them convert into iroh_live::Error. The node's examples now call the node node, not moq.

Public API changes

Before After
iroh_live::media::remote_broadcast(&subscription) subscription.remote_broadcast(), from iroh_live::media::SubscriptionExt
iroh_live::Error::SecretKey, iroh_live::Error::Bind iroh_live_node::Error::SecretKey, iroh_live_node::Error::Bind, inside iroh_live::Error::Node
iroh_live::layout, iroh_live::{EndpointConfig, Mdns, load_or_create_secret_key} the same paths, now re-exported from iroh_live_node
iroh_live::media::* from two globs the same items, listed by name

docs/migration.md lists the first two rows.

Tests

On this branch, rebased onto the new #96:

  • cargo make check-all (5 check configs, clippy -D warnings in 3 configs, the configured fmt check) and cargo fmt --check pass.
  • cargo nextest run --workspace --all-features: 656 passed, 4 skipped.
  • cargo test --doc --workspace --all-features passes.
  • scripts/check-links.py: 364 links, none broken.

🤖 Generated with Claude Code

Frando and others added 4 commits November 14, 2026 09:19
moq-transport-iroh returned no send groups, so moq-net ranked every
group stream of a session in one queue, where the older of two
equal-priority subscriptions goes first. Under a held bandwidth cap a
rendition switch never landed: the replacement's first group waited
behind the incumbent's backlog, which never drained.

`Transport::send_group` now returns a `SendGroup`. iroh schedules a
stream by an i32 priority, so the group priority and each stream's
dense rank by order within its group are packed into it
(group * 16 + 15 - tier), with ungrouped streams at 2^29 and up, above
every group. The heads of equal-priority groups share one priority, and
noq sends streams of one priority round robin while send fairness is on,
its default, so they share the bytes. A group's older streams wait for
its head, and a higher group outranks every tier of a lower one. A
stream joining, leaving or moving reranks its group, which reaches the
other streams through a shared handle.

Unlike moq-quic's deficit round robin, fairness is per stream and only
within a tier: a group whose head is idle does not hand its share to its
backlog. With send fairness turned off the older group goes first
again; RFC 9218's incremental flag, which n0-computer/noq#859 adds,
would remove that dependency.

`a_switch_lands_while_the_link_stays_capped` is no longer ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The free function `media::remote_broadcast(&subscription)` was hard to
find, since users look for a method on `Subscription` first. The node
crate has no media dependency, so `Subscription` cannot carry the method
itself. The facade now adds it through the extension trait
`media::SubscriptionExt`, and the free function is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The relay depended on the facade for `LiveLayout`, `EndpointConfig`,
`BroadcastTicket` and the rooms layout, so the facade's dependency
direction was inverted. Both types only need the node, so they now live
in `iroh-live-node` as `layout` and `EndpointConfig`, `Mdns` and
`load_or_create_secret_key`. The facade re-exports them at the same paths.

The relay now depends on `iroh-live-node` and `iroh-live-rooms` only, and
keeps the facade as a dev-dependency for its media tests. Binding errors
move into the node's error as `SecretKey` and `Bind`, and still convert
into `iroh_live::Error` through its `Node` variant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`iroh_live::media` re-exported `moq_ext_player::*` and
`moq_ext_publisher::*`, so every new item of either crate became facade
API without review, and a later name clash would turn into an ambiguity
error in user code. The module now names each item. The facade's crate
docs say once which error each call returns and that all of them
convert into `iroh_live::Error`, and the node's examples call the node
`node` rather than `moq`, a leftover of the `Moq` rename.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Frando
Frando force-pushed the Frando/send-groups branch from 59369d6 to cf14b6d Compare November 16, 2026 11:12
@Frando

Frando commented Nov 16, 2026

Copy link
Copy Markdown
Member Author

Folded into #94 as aa6de12 (with the ergonomics review fixes: sealed SubscriptionExt, EndpointError, one Layout path).

@Frando Frando closed this Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant