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 methods
fn peek(
&self,
limit: usize,
max_bytes: usize,
) -> SyncResult<Vec<SyncMessage>> { ... }
fn stats(&self) -> SyncResult<SyncOutboxStats> { ... }
fn mark_attempt(
&self,
_batch_id: &str,
_next_ready_at_ms: u64,
) -> SyncResult<u32> { ... }
fn next_ready(
&self,
_now_ms: u64,
limit: usize,
max_bytes: usize,
) -> SyncResult<Vec<SyncMessage>> { ... }
fn acknowledge_receipt(
&self,
receipt: &SyncOutboxReceipt,
) -> SyncResult<usize> { ... }
fn is_empty(&self) -> SyncResult<bool> { ... }
}Expand description
Ordered bounded queue that retains replication batches until acknowledgement.
Required Methods§
Sourcefn try_enqueue(&self, message: SyncMessage, max_len: usize) -> SyncResult<bool>
fn try_enqueue(&self, message: SyncMessage, max_len: usize) -> SyncResult<bool>
Enqueues a batch if the current length is below max_len.
Sourcefn front(&self) -> SyncResult<Option<SyncMessage>>
fn front(&self) -> SyncResult<Option<SyncMessage>>
Returns the oldest pending batch.
Sourcefn acknowledge_front(&self, batch_id: &str) -> SyncResult<()>
fn acknowledge_front(&self, batch_id: &str) -> SyncResult<()>
Removes the oldest batch only when its identifier matches batch_id.
Sourcefn messages(&self) -> SyncResult<Vec<SyncMessage>>
fn messages(&self) -> SyncResult<Vec<SyncMessage>>
Returns all pending batches in delivery order.
Sourcefn len(&self) -> SyncResult<usize>
fn len(&self) -> SyncResult<usize>
Returns the number of pending batches.
Provided Methods§
Sourcefn peek(&self, limit: usize, max_bytes: usize) -> SyncResult<Vec<SyncMessage>>
fn peek(&self, limit: usize, max_bytes: usize) -> SyncResult<Vec<SyncMessage>>
Returns a delivery-order page bounded before cloning message payloads.
The compatibility default returns at most the front message. Providers should override this method to offer real multi-message pagination.
Sourcefn stats(&self) -> SyncResult<SyncOutboxStats>
fn stats(&self) -> SyncResult<SyncOutboxStats>
Returns payload-free queue statistics.
The compatibility default reports only the exact pending count and
leaves unavailable observations from pre-extension providers as None.
Sourcefn mark_attempt(
&self,
_batch_id: &str,
_next_ready_at_ms: u64,
) -> SyncResult<u32>
fn mark_attempt( &self, _batch_id: &str, _next_ready_at_ms: u64, ) -> SyncResult<u32>
Records one failed delivery attempt and its next eligible timestamp.
Providers without this extension fail explicitly instead of pretending to persist retry state.
Sourcefn next_ready(
&self,
_now_ms: u64,
limit: usize,
max_bytes: usize,
) -> SyncResult<Vec<SyncMessage>>
fn next_ready( &self, _now_ms: u64, limit: usize, max_bytes: usize, ) -> SyncResult<Vec<SyncMessage>>
Returns the ready delivery-order prefix within both page bounds.
The compatibility default preserves pre-extension immediate readiness and returns at most one message.
Sourcefn acknowledge_receipt(&self, receipt: &SyncOutboxReceipt) -> SyncResult<usize>
fn acknowledge_receipt(&self, receipt: &SyncOutboxReceipt) -> SyncResult<usize>
Acknowledges the exact ordered prefix named by a partial receipt.
The compatibility default accepts one identifier only. Providers should override this method to apply a multi-message receipt atomically.
Sourcefn is_empty(&self) -> SyncResult<bool>
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".