TransmitQueue

Struct TransmitQueue 

Source
pub struct TransmitQueue { /* private fields */ }
Expand description

The chat transmit queue.

Frames go to the node through a bounded window, so a message larger than the window waits here rather than in the MAC’s own queue. A frame leaves the window when nothing more can happen to it: acknowledged or failed, or transmitted when no acknowledgment will follow.

Implementations§

Source§

impl TransmitQueue

Source

pub fn new(window: usize) -> Self

A queue keeping at most window frames in flight, aligned with the MAC’s transmit queue.

Source

pub fn enqueue(&mut self, outbound: Outbound)

Source

pub fn has_pending(&self) -> bool

Source

pub fn pending_len(&self) -> usize

Source

pub fn in_flight_len(&self) -> usize

Source

pub async fn pump<M, P, const SLOTS: usize, const PAGES: usize>( &mut self, node: &LocalNode<M>, chat: &mut ChatFacade<P, SLOTS, PAGES>, policy: &TransmitPolicy, now_ms: u64, ) -> usize
where M: MacBackend, P: TextProfile + Clone,

Hand waiting frames to the node while the window has room. Returns how many were sent: each is an authenticated send that advanced the frame counter. It is TransmitQueue::depart, transmit, and TransmitQueue::departed in a loop, for a caller that holds the facade across the sends.

Source

pub fn depart( &mut self, channels: &ChannelRegistry, policy: &TransmitPolicy, ) -> Option<Result<Departure, Undeliverable>>

The next frame the window has room for, with where it goes resolved against channels. None when nothing may leave now.

  • A unicast asks for an acknowledgment, and a peer gets one frame in flight until its first is acknowledged: first contact may need counter synchronization. Until then it names us by full key, since a peer that has not registered us cannot read a frame that names us by hint.
  • A channel multicast carries the full source key, so a member who misses a fragment can address a resend request to us.
  • A channel-direct frame is a blind unicast, registering the peer on the way out.
  • EMERGENCY goes out unencrypted, so any node in range can read it.

A frame on a channel no longer held comes back undeliverable.

Source

pub fn departed( &mut self, departure: Departure, sent: Sent, now_ms: u64, ) -> Departed

What became of a departure’s send. A frame the node refused for now—with a registered peer and an engine-bounded payload, its queues are full—goes back to the head of the queue, to wait for tickets to advance.

Source

pub fn service<P, const SLOTS: usize, const PAGES: usize>( &mut self, chat: &mut ChatFacade<P, SLOTS, PAGES>, now_ms: u64, ) -> Vec<Stall>
where P: TextProfile + Clone,

Report what the tickets say to the engine: transmitted, acknowledged, or failed. Returns the frames newly found overdue.

Source

pub fn fail_all<P, const SLOTS: usize, const PAGES: usize>( &mut self, chat: &mut ChatFacade<P, SLOTS, PAGES>, now_ms: u64, ) -> Vec<SendReceipt>
where P: TextProfile + Clone,

Fail every frame the queue holds, waiting or in flight. Returns the receipts of in-flight sends still awaiting an acknowledgment, for the caller to cancel at the MAC.

Auto Trait Implementations§

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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> Same for T

Source§

type Output = T

Should always be Self
§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.