pub struct QueueStore { /* private fields */ }Expand description
Core queue data structure supporting FIFO, LIFO, and priority modes.
Implementations§
Source§impl QueueStore
impl QueueStore
Sourcepub fn new_priority(max_size: usize) -> Self
pub fn new_priority(max_size: usize) -> Self
Create a priority queue
Sourcepub fn push_back(
&mut self,
payload: Value,
priority: Option<i32>,
) -> Result<u64, QueueError>
pub fn push_back( &mut self, payload: Value, priority: Option<i32>, ) -> Result<u64, QueueError>
Push a message to the back (RPUSH). Returns the sequence number.
Sourcepub fn push_front(
&mut self,
payload: Value,
priority: Option<i32>,
) -> Result<u64, QueueError>
pub fn push_front( &mut self, payload: Value, priority: Option<i32>, ) -> Result<u64, QueueError>
Push a message to the front (LPUSH). Returns the sequence number.
Sourcepub fn pop_front(&mut self) -> Option<QueueMessage>
pub fn pop_front(&mut self) -> Option<QueueMessage>
Pop from the front (LPOP) — FIFO dequeue. For priority queues, pops highest priority.
Sourcepub fn pop_back(&mut self) -> Option<QueueMessage>
pub fn pop_back(&mut self) -> Option<QueueMessage>
Pop from the back (RPOP) — LIFO dequeue
Sourcepub fn peek_front(&self, count: usize) -> Vec<&QueueMessage>
pub fn peek_front(&self, count: usize) -> Vec<&QueueMessage>
Peek at the front message without removing it
Sourcepub fn get(&self, seq: u64) -> Option<&QueueMessage>
pub fn get(&self, seq: u64) -> Option<&QueueMessage>
Get a message by sequence number (for ack/nack)
Sourcepub fn remove(&mut self, seq: u64) -> Option<QueueMessage>
pub fn remove(&mut self, seq: u64) -> Option<QueueMessage>
Remove a specific message by sequence (for ack)
Sourcepub fn increment_attempts(&mut self, seq: u64) -> Option<u32>
pub fn increment_attempts(&mut self, seq: u64) -> Option<u32>
Increment attempt count for a message
Sourcepub fn is_priority(&self) -> bool
pub fn is_priority(&self) -> bool
Whether this is a priority queue
Sourcepub fn memory_bytes(&self) -> usize
pub fn memory_bytes(&self) -> usize
Approximate memory usage
Auto Trait Implementations§
impl !Freeze for QueueStore
impl RefUnwindSafe for QueueStore
impl Send for QueueStore
impl Sync for QueueStore
impl Unpin for QueueStore
impl UnsafeUnpin for QueueStore
impl UnwindSafe for QueueStore
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request