Skip to main content

LogProcessor

Trait LogProcessor 

Source
pub trait LogProcessor<E>: HasCursors {
    // Required method
    fn apply<'life0, 'async_trait>(
        &'life0 self,
        peer: Uuid,
        index: u64,
        entry: DecodedEntry<E>,
    ) -> Pin<Box<dyn Future<Output = Result<Applied, SyncError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

The apply target of replication: absorbs entries addressed by (peer, index).

Multi-writer — it accepts any origin, so it can relay and merge. (A file log, which writes only its own origin, is FileLogSink instead.)

Entries for a peer must be applied in contiguous ascending order — a cursor is a single high-water mark that can’t hold a hole. An already-seen index is an idempotent no-op (Applied::new == false), so multi-channel redelivery is safe; an index beyond the next expected one is a gap and is rejected.

&self: one processor is shared (Arc<dyn LogProcessor>) as the apply target of several sources while also read as a LogSource, so it mutates through interior mutability.

Required Methods§

Source

fn apply<'life0, 'async_trait>( &'life0 self, peer: Uuid, index: u64, entry: DecodedEntry<E>, ) -> Pin<Box<dyn Future<Output = Result<Applied, SyncError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Apply one entry at (peer, index), advancing the cursor for peer to index + 1. Idempotent (see the trait docs).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§