Skip to main content

SyncOutbox

Trait SyncOutbox 

Source
pub trait SyncOutbox: Send + Sync {
    // Required methods
    fn try_enqueue(
        &self,
        message: SyncMessage,
        max_len: usize,
    ) -> SyncResult<bool>;
    fn front(&self) -> SyncResult<Option<SyncMessage>>;
    fn acknowledge_front(&self, batch_id: &str) -> SyncResult<()>;
    fn messages(&self) -> SyncResult<Vec<SyncMessage>>;
    fn len(&self) -> SyncResult<usize>;

    // Provided method
    fn is_empty(&self) -> SyncResult<bool> { ... }
}
Expand description

Ordered bounded queue that retains replication batches until acknowledgement.

Required Methods§

Source

fn try_enqueue(&self, message: SyncMessage, max_len: usize) -> SyncResult<bool>

Enqueues a batch if the current length is below max_len.

Source

fn front(&self) -> SyncResult<Option<SyncMessage>>

Returns the oldest pending batch.

Source

fn acknowledge_front(&self, batch_id: &str) -> SyncResult<()>

Removes the oldest batch only when its identifier matches batch_id.

Source

fn messages(&self) -> SyncResult<Vec<SyncMessage>>

Returns all pending batches in delivery order.

Source

fn len(&self) -> SyncResult<usize>

Returns the number of pending batches.

Provided Methods§

Source

fn is_empty(&self) -> SyncResult<bool>

Reports whether no batches are pending.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§