Skip to main content

ReplicatedLog

Struct ReplicatedLog 

Source
pub struct ReplicatedLog<P, R> { /* private fields */ }

Implementations§

Source§

impl<P: TransitionLogStore, R: TransitionLogStore> ReplicatedLog<P, R>

Source

pub fn new( primary: P, replicas: Vec<R>, policy: Synchronization, ) -> Result<Self, LinkError>

Source

pub fn set_trace(&mut self, enabled: bool)

Source

pub fn into_parts(self) -> (P, Vec<R>)

Source

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>

Source§

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

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>

Appends one entry. Entries never contain newlines.
Source§

fn flush_log(&mut self) -> Result<(), LinkError>

Makes every appended entry durable.
Source§

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>

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>

§

impl<P, R> Send for ReplicatedLog<P, R>
where P: Send, R: Send,

§

impl<P, R> Sync for ReplicatedLog<P, R>
where P: Sync, R: Sync,

§

impl<P, R> Unpin for ReplicatedLog<P, R>
where P: Unpin, R: Unpin,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.