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
impl FairDispatchQueue
pub fn new( control_bounds: QueueBounds, data_bounds: QueueBounds, replay_bounds: QueueBounds, control_quantum: usize, ) -> FairDispatchQueue
pub fn current_cursor(&self) -> u64
pub fn is_empty(&self) -> bool
pub fn control_len(&self) -> usize
pub fn data_len(&self) -> usize
Sourcepub fn enqueue(
&mut self,
channel: ChannelKind,
item_id: impl Into<String>,
content: Value,
timestamp_unix_ms: i64,
) -> Result<u64, QueueCapacityExceeded>
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.
Sourcepub fn dequeue(&mut self) -> Option<QueuedItem>
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.
Sourcepub fn replay_from_cursor(&self, from_cursor: u64) -> Vec<QueuedItem>
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
impl Clone for FairDispatchQueue
Source§fn clone(&self) -> FairDispatchQueue
fn clone(&self) -> FairDispatchQueue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more