pub struct ReplicatedLog<P, R> { /* private fields */ }Implementations§
Source§impl<P: TransitionLogStore, R: TransitionLogStore> ReplicatedLog<P, R>
impl<P: TransitionLogStore, R: TransitionLogStore> ReplicatedLog<P, R>
pub fn new( primary: P, replicas: Vec<R>, policy: Synchronization, ) -> Result<Self, LinkError>
pub fn set_trace(&mut self, enabled: bool)
pub fn into_parts(self) -> (P, Vec<R>)
Sourcepub fn synchronize(&mut self) -> Result<usize, LinkError>
pub fn synchronize(&mut self) -> Result<usize, LinkError>
Catch up each replica, checking that its complete log is an exact prefix. Retries never append duplicates. Divergent replicas require operator repair.
Trait Implementations§
Source§impl<P: TransitionLogStore, R: TransitionLogStore> TransitionLogStore for ReplicatedLog<P, R>
impl<P: TransitionLogStore, R: TransitionLogStore> TransitionLogStore for ReplicatedLog<P, R>
Source§fn read_log_entries(&mut self) -> Result<Vec<String>, LinkError>
fn read_log_entries(&mut self) -> Result<Vec<String>, LinkError>
Reads the primary, refusing it when a replica holds its whole log and more. Replicas only receive records the primary has flushed, so that shape means the primary lost acknowledged commits (a truncated file, an old backup); writing on top would fork history and drop them for good. Unreadable or divergent replicas stay ignored, as during catch-up.
Source§fn supports_durable_flush(&self) -> bool
fn supports_durable_flush(&self) -> bool
Whether flush requests persistent storage. Custom/volatile logs default
to false; this describes an adapter, not the reliability of its hardware.
Source§fn append_log_entry(&mut self, entry: &str) -> Result<(), LinkError>
fn append_log_entry(&mut self, entry: &str) -> Result<(), LinkError>
Appends one entry. Entries never contain newlines.
Source§fn supports_compaction(&self) -> bool
fn supports_compaction(&self) -> bool
Whether
compact_log_entries can rewrite
the durable journal. Retention uses it to bound the journal on disk;
logs without it keep every entry, as before.Source§fn compact_log_entries(&mut self, entries: &[String]) -> Result<(), LinkError>
fn compact_log_entries(&mut self, entries: &[String]) -> Result<(), LinkError>
Atomically and durably replaces every entry with
entries, the
retained journal. After a crash the log holds either the old or the
new journal, never a mixture. Called only between transactions and
only when supports_compaction is true.Auto Trait Implementations§
impl<P, R> Freeze for ReplicatedLog<P, R>where
P: Freeze,
impl<P, R> RefUnwindSafe for ReplicatedLog<P, R>where
P: RefUnwindSafe,
R: RefUnwindSafe,
impl<P, R> Send for ReplicatedLog<P, R>
impl<P, R> Sync for ReplicatedLog<P, R>
impl<P, R> Unpin for ReplicatedLog<P, R>
impl<P, R> UnsafeUnpin for ReplicatedLog<P, R>where
P: UnsafeUnpin,
impl<P, R> UnwindSafe for ReplicatedLog<P, R>where
P: UnwindSafe,
R: UnwindSafe,
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