pub struct SendGroup { /* private fields */ }Expand description
A send group, from send_group on a
Transport.
moq-net opens one send group per subscription and ranks its streams in two levels: a higher-priority group preempts every lower one, groups of equal priority share the bytes, and inside a group streams go in their own order, the newest group of a track first. Streams outside every group, the control streams, go before all of them. kuic schedules exactly that, with deficit round robin between groups.
iroh’s QUIC stack has one level instead: an i32 urgency per stream,
higher first. Streams of one urgency are sent round robin while the
connection’s send fairness is on, which is noq’s default, so they share the
bytes. The two levels are packed into the urgency:
ungrouped: 2^29 + priority above every group
grouped: group priority * 16 + (15 - tier)A stream’s tier is its dense rank inside its group: the streams with the highest order in the group are tier 0, the next distinct order tier 1, up to tier 15, which the rest share. So the streams heading equal-priority groups share one urgency and split the bytes, a group’s older streams wait for its head, and a higher-priority group outranks every tier of a lower one. A stream joining, leaving or moving reranks its group.
A new urgency does not reach data the stream already has queued right away.
noq 1.4’s set_priority only stores the value: a stream with queued data
keeps its place in noq’s send queue, at the urgency it was queued with,
until its next turn. So a lowered urgency applies after one more turn at
the old one. A raised one, from
set_priority on the group, from a stream
moving up its group’s order or from the stream behind a departing head,
applies only once that turn comes at the old urgency. While anything above
the old urgency has data queued, as it does on a link held at its cap, that
may never happen. A stream that joins is queued at its urgency from its
first write, so a new subscription is not affected.
It departs from kuic in one more way: fairness is per stream and per turn, not per group and per byte, and only between streams of one tier. Two streams of one group that tie at its head take two turns to another group’s one, and a turn is up to one packet whatever the stream has queued. When the head of a group has nothing queued, the next stream of that group waits behind the heads of the other groups rather than taking the idle head’s turn. For live media that holds back a group’s backlog first, as the newest-first order asks anyway.
The sharing rests on the connection’s send fairness: with
send_fairness(false) in iroh’s transport config, streams of one urgency go
in the order they were written to, and the older of two equal-priority
groups goes first again. RFC 9218’s per-stream incremental flag, which
n0-computer/noq#859 adds,
would let each stream ask for round robin whatever that setting.
Clones share the group. It lives as long as a handle or a member stream does.