pub struct BoundedQueue {
pub backpressure_active: bool,
/* private fields */
}Expand description
A single bounded queue of IndexJobs, ordered by priority then
insertion order (RFC-036 §8).
Fields§
§backpressure_active: boolWhether backpressure is currently active for this queue.
Implementations§
Source§impl BoundedQueue
impl BoundedQueue
pub fn new(kind: QueueKind, capacity: usize) -> Self
pub fn kind(&self) -> QueueKind
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn is_full(&self) -> bool
pub fn is_full(&self) -> bool
true when the queue has reached its capacity ceiling.
Callers must not push when this returns true.
pub fn capacity(&self) -> usize
pub fn total_pushed(&self) -> u64
Sourcepub fn push(&mut self, job: IndexJob)
pub fn push(&mut self, job: IndexJob)
Push a job into the queue, maintaining priority order.
§Ordering invariant
pop_back serves the item at the highest index. To dispatch
the highest-priority job first, and within equal priority the
oldest job first (FIFO), items must be stored with:
- higher-priority items at higher indices (closer to back), and
- among equal-priority items, older items at higher indices.
§Insertion rule
The new job is inserted at the first index (from the back) where the existing item has strictly lower priority than the new job. This places it after (higher index than) all equal-or-higher priority items already in the queue, satisfying both conditions.
Panics if the queue is full — callers must check is_full first.
Sourcepub fn cancel_for_source(&mut self, source_id: &SourceId) -> usize
pub fn cancel_for_source(&mut self, source_id: &SourceId) -> usize
Cancel all jobs belonging to source_id (RFC-036 §12.3).
Returns the number of jobs removed.
Auto Trait Implementations§
impl Freeze for BoundedQueue
impl RefUnwindSafe for BoundedQueue
impl Send for BoundedQueue
impl Sync for BoundedQueue
impl Unpin for BoundedQueue
impl UnsafeUnpin for BoundedQueue
impl UnwindSafe for BoundedQueue
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