pub struct OutputQueue { /* private fields */ }Expand description
Manages a queue of outbound replication messages.
The queue has a configurable maximum size. When the queue is full or
shut down, enqueue returns false. Messages can be dequeued in
batches for efficient network I/O.
Implementations§
Source§impl OutputQueue
impl OutputQueue
Sourcepub fn new(max_queue_size: usize) -> Self
pub fn new(max_queue_size: usize) -> Self
Create a new output queue with the given maximum capacity.
Sourcepub fn enqueue(&self, message: Vec<u8>) -> bool
pub fn enqueue(&self, message: Vec<u8>) -> bool
Enqueue a message.
Returns true if the message was accepted, false if the queue
is full or has been shut down.
Sourcepub fn dequeue_batch(&self, max: usize) -> Vec<Vec<u8>>
pub fn dequeue_batch(&self, max: usize) -> Vec<Vec<u8>>
Dequeue up to max messages in a batch.
Returns the messages in FIFO order. If fewer than max messages
are available, returns all of them.
Sourcepub fn is_shutdown(&self) -> bool
pub fn is_shutdown(&self) -> bool
Return true if the queue has been shut down.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for OutputQueue
impl !RefUnwindSafe for OutputQueue
impl Send for OutputQueue
impl Sync for OutputQueue
impl Unpin for OutputQueue
impl UnsafeUnpin for OutputQueue
impl UnwindSafe for OutputQueue
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> 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 more