Skip to main content

OutboxWriter

Trait OutboxWriter 

Source
pub trait OutboxWriter: Send + Sync {
    // Required methods
    fn append<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        query_id: &'life1 str,
        sequence: u64,
        data: &'life2 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<(), IndexError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn read_from<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query_id: &'life1 str,
        after_sequence: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(u64, Vec<u8>)>, IndexError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn read_latest_sequence<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<u64>, IndexError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn clear<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), IndexError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn trim_to_capacity<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query_id: &'life1 str,
        capacity: usize,
    ) -> Pin<Box<dyn Future<Output = Result<usize, IndexError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Persistent outbox storage for query result replay.

Implementations store serialized QueryResult bytes keyed by (query_id, sequence). The lib layer handles serialization/deserialization.

Required Methods§

Source

fn append<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, query_id: &'life1 str, sequence: u64, data: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), IndexError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Append a serialized query result entry.

If the outbox already contains an entry at this sequence, it is overwritten.

Source

fn read_from<'life0, 'life1, 'async_trait>( &'life0 self, query_id: &'life1 str, after_sequence: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<(u64, Vec<u8>)>, IndexError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read all entries with sequence strictly greater than after_sequence.

Returns entries in ascending sequence order as (sequence, data) pairs. Returns an empty vec if no entries exist after the given sequence.

Source

fn read_latest_sequence<'life0, 'life1, 'async_trait>( &'life0 self, query_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<u64>, IndexError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read the highest sequence number stored for this query.

Returns None if the outbox is empty for this query.

Source

fn clear<'life0, 'life1, 'async_trait>( &'life0 self, query_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), IndexError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete all outbox entries for a query.

Used during AutoReset recovery and reaction deprovisioning.

Source

fn trim_to_capacity<'life0, 'life1, 'async_trait>( &'life0 self, query_id: &'life1 str, capacity: usize, ) -> Pin<Box<dyn Future<Output = Result<usize, IndexError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Trim the outbox to at most capacity entries, removing the oldest.

Returns the number of entries removed. If the outbox has ≤ capacity entries, this is a no-op returning 0.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§