pub trait ReplicationLog {
// Required methods
fn append(&mut self, record: Vec<u8>) -> SyncResult<usize>;
fn append_with_sequence(
&mut self,
record: Vec<u8>,
sequence: u64,
) -> SyncResult<usize>;
fn events_since(&self, index: usize) -> SyncResult<Vec<Vec<u8>>>;
fn last_index(&self) -> SyncResult<usize>;
fn len(&self) -> SyncResult<usize>;
fn is_empty(&self) -> SyncResult<bool>;
// Provided methods
fn event_at_sequence(&self, _sequence: u64) -> SyncResult<Option<Vec<u8>>> { ... }
fn create_snapshot(&self) -> SyncResult<ReplicationSnapshot> { ... }
fn restore_snapshot(
&mut self,
_snapshot: &ReplicationSnapshot,
) -> SyncResult<()> { ... }
}Expand description
Replication log contract.
Required Methods§
Sourcefn append(&mut self, record: Vec<u8>) -> SyncResult<usize>
fn append(&mut self, record: Vec<u8>) -> SyncResult<usize>
Appends an unsequenced record and returns its one-based log index.
Sourcefn append_with_sequence(
&mut self,
record: Vec<u8>,
sequence: u64,
) -> SyncResult<usize>
fn append_with_sequence( &mut self, record: Vec<u8>, sequence: u64, ) -> SyncResult<usize>
Idempotently appends record at a source sequence.
Sourcefn events_since(&self, index: usize) -> SyncResult<Vec<Vec<u8>>>
fn events_since(&self, index: usize) -> SyncResult<Vec<Vec<u8>>>
Returns payloads after the supplied zero-based log offset.
Sourcefn last_index(&self) -> SyncResult<usize>
fn last_index(&self) -> SyncResult<usize>
Returns the one-based final log index, or zero for an empty log.
Sourcefn len(&self) -> SyncResult<usize>
fn len(&self) -> SyncResult<usize>
Returns the number of records in the log.
Sourcefn is_empty(&self) -> SyncResult<bool>
fn is_empty(&self) -> SyncResult<bool>
Reports whether the log contains no records.
Provided Methods§
Sourcefn event_at_sequence(&self, _sequence: u64) -> SyncResult<Option<Vec<u8>>>
fn event_at_sequence(&self, _sequence: u64) -> SyncResult<Option<Vec<u8>>>
Returns the payload at a source sequence when sequence lookup is supported.
Sourcefn create_snapshot(&self) -> SyncResult<ReplicationSnapshot>
fn create_snapshot(&self) -> SyncResult<ReplicationSnapshot>
Creates a validated portable snapshot when supported.
Sourcefn restore_snapshot(
&mut self,
_snapshot: &ReplicationSnapshot,
) -> SyncResult<()>
fn restore_snapshot( &mut self, _snapshot: &ReplicationSnapshot, ) -> SyncResult<()>
Atomically replaces log contents from a validated snapshot when supported.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".