pub struct PrioritySyncQueue { /* private fields */ }Expand description
Priority-ordered sync queue
Maintains separate queues per QoS class with automatic aging promotion to prevent starvation of low-priority data.
Implementations§
Source§impl PrioritySyncQueue
impl PrioritySyncQueue
Sourcepub fn new(max_bytes: usize) -> Self
pub fn new(max_bytes: usize) -> Self
Create a new priority sync queue
§Arguments
max_bytes- Maximum total size in bytes the queue can hold
Sourcepub fn default_capacity() -> Self
pub fn default_capacity() -> Self
Default queue with 10 MB capacity
Sourcepub fn enqueue(&mut self, sync: PendingSync) -> Result<()>
pub fn enqueue(&mut self, sync: PendingSync) -> Result<()>
Enqueue a sync item
Returns an error if the queue is full.
Sourcepub fn dequeue_highest(&mut self) -> Option<PendingSync>
pub fn dequeue_highest(&mut self) -> Option<PendingSync>
Dequeue the highest priority item
Returns None if all queues are empty.
Sourcepub fn peek_highest(&self) -> Option<&PendingSync>
pub fn peek_highest(&self) -> Option<&PendingSync>
Peek at the highest priority item without removing
Sourcepub fn apply_aging(&mut self) -> usize
pub fn apply_aging(&mut self) -> usize
Apply aging promotion to queued items
Moves items that have waited long enough to higher priority queues. Returns the number of items promoted.
Sourcepub fn queue_depth(&self, class: QoSClass) -> usize
pub fn queue_depth(&self, class: QoSClass) -> usize
Get queue depth for a specific class
Sourcepub fn total_bytes_queued(&self) -> usize
pub fn total_bytes_queued(&self) -> usize
Get total bytes currently queued
Sourcepub fn total_items(&self) -> usize
pub fn total_items(&self) -> usize
Get total items currently queued
Sourcepub fn available_bytes(&self) -> usize
pub fn available_bytes(&self) -> usize
Get available capacity in bytes
Sourcepub fn stats(&self) -> QueueStats
pub fn stats(&self) -> QueueStats
Get queue statistics
Sourcepub fn drain_class(&mut self, class: QoSClass) -> Vec<PendingSync>
pub fn drain_class(&mut self, class: QoSClass) -> Vec<PendingSync>
Drain all items from a specific class
Sourcepub fn remove_stale(&mut self, max_age: Duration) -> usize
pub fn remove_stale(&mut self, max_age: Duration) -> usize
Remove items older than a threshold
Returns the number of items removed.
Sourcepub fn oldest_item_age(&self) -> Option<Duration>
pub fn oldest_item_age(&self) -> Option<Duration>
Get oldest item across all queues (for monitoring)
Sourcepub fn dequeue_batch(&mut self, max_items: usize) -> Vec<PendingSync>
pub fn dequeue_batch(&mut self, max_items: usize) -> Vec<PendingSync>
Dequeue up to N items, respecting priority order
Sourcepub fn dequeue_bytes(&mut self, max_bytes: usize) -> Vec<PendingSync>
pub fn dequeue_bytes(&mut self, max_bytes: usize) -> Vec<PendingSync>
Dequeue items up to a byte limit, respecting priority order
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PrioritySyncQueue
impl RefUnwindSafe for PrioritySyncQueue
impl Send for PrioritySyncQueue
impl Sync for PrioritySyncQueue
impl Unpin for PrioritySyncQueue
impl UnsafeUnpin for PrioritySyncQueue
impl UnwindSafe for PrioritySyncQueue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more