Skip to main content

FairDispatchQueue

Struct FairDispatchQueue 

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

Fair dispatch queue maintaining separate Control and Data channels with strict capacity bounds and a deficit/quantum fair arbiter to prevent starvation.

Retention is bounded independently of delivery capacity: replay_bounds limits how much history the replay log holds, and entries past the bound are evicted oldest-first. Without it an in-memory queue would grow with the lifetime throughput of the host, not with the work in flight.

Implementations§

Source§

impl FairDispatchQueue

Source

pub fn new( control_bounds: QueueBounds, data_bounds: QueueBounds, replay_bounds: QueueBounds, control_quantum: usize, ) -> FairDispatchQueue

Source

pub fn current_cursor(&self) -> u64

Source

pub fn is_empty(&self) -> bool

Source

pub fn control_len(&self) -> usize

Source

pub fn data_len(&self) -> usize

Source

pub fn enqueue( &mut self, channel: ChannelKind, item_id: impl Into<String>, content: Value, timestamp_unix_ms: i64, ) -> Result<u64, QueueCapacityExceeded>

Enqueue an item into its channel, enforcing separate bounds.

Source

pub fn dequeue(&mut self) -> Option<QueuedItem>

Fair dequeue implementing deficit/quantum fair arbiter.

Control commands have priority up to control_quantum items, after which pending Data items are served, ensuring no control flood can starve background data.

Source

pub fn replay_from_cursor(&self, from_cursor: u64) -> Vec<QueuedItem>

Replay retained messages from a cursor (catch-up upon reconnect or recovery). History older than the replay window has been evicted: a from_cursor below the retained floor replays the window, which is the bounded retention contract rather than a complete log.

Trait Implementations§

Source§

impl Clone for FairDispatchQueue

Source§

fn clone(&self) -> FairDispatchQueue

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 FairDispatchQueue

Source§

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

Formats the value using the given formatter. Read more

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