Skip to main content

SendGroup

Struct SendGroup 

Source
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.

Trait Implementations§

Source§

impl Clone for SendGroup

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SendGroup

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl SendGroup for SendGroup

Source§

fn set_priority(&mut self, priority: i64)

Change the group’s priority: higher preempts lower.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more