pub struct FileReplicationLog { /* private fields */ }Expand description
File-backed append-only replication log for local runtime sync.
Implementations§
Source§impl FileReplicationLog
impl FileReplicationLog
Sourcepub fn new(
storage_path: impl AsRef<Path>,
relative_path: &str,
) -> SyncResult<Self>
pub fn new( storage_path: impl AsRef<Path>, relative_path: &str, ) -> SyncResult<Self>
Opens a relative append-only log below storage_path.
Sourcepub fn reload(&mut self) -> SyncResult<()>
pub fn reload(&mut self) -> SyncResult<()>
Re-reads and validates all durable records from disk.
Trait Implementations§
Source§impl Clone for FileReplicationLog
impl Clone for FileReplicationLog
Source§fn clone(&self) -> FileReplicationLog
fn clone(&self) -> FileReplicationLog
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FileReplicationLog
impl Debug for FileReplicationLog
impl Eq for FileReplicationLog
Source§impl PartialEq for FileReplicationLog
impl PartialEq for FileReplicationLog
Source§impl ReplicationLog for FileReplicationLog
impl ReplicationLog for FileReplicationLog
Source§fn 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.
Source§fn 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.Source§fn 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.
Source§fn 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.
Source§fn last_index(&self) -> usize
fn last_index(&self) -> usize
Returns the one-based final log index, or zero for an empty log.
Source§fn create_snapshot(&self) -> SyncResult<ReplicationSnapshot>
fn create_snapshot(&self) -> SyncResult<ReplicationSnapshot>
Creates a validated portable snapshot when supported.
Source§fn 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.
impl StructuralPartialEq for FileReplicationLog
Auto Trait Implementations§
impl Freeze for FileReplicationLog
impl RefUnwindSafe for FileReplicationLog
impl Send for FileReplicationLog
impl Sync for FileReplicationLog
impl Unpin for FileReplicationLog
impl UnsafeUnpin for FileReplicationLog
impl UnwindSafe for FileReplicationLog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more