Skip to main content

TransitionLogStore

Trait TransitionLogStore 

Source
pub trait TransitionLogStore {
    // Required methods
    fn append_log_entry(&mut self, entry: &str) -> Result<(), LinkError>;
    fn read_log_entries(&mut self) -> Result<Vec<String>, LinkError>;
    fn flush_log(&mut self) -> Result<(), LinkError>;

    // Provided methods
    fn supports_durable_flush(&self) -> bool { ... }
    fn supports_compaction(&self) -> bool { ... }
    fn compact_log_entries(
        &mut self,
        entries: &[String],
    ) -> Result<(), LinkError> { ... }
}
Expand description

Append-only store of serialized transitions and recovery markers.

Required Methods§

Source

fn append_log_entry(&mut self, entry: &str) -> Result<(), LinkError>

Appends one entry. Entries never contain newlines.

Source

fn read_log_entries(&mut self) -> Result<Vec<String>, LinkError>

Reads every entry back, oldest first.

Source

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

Makes every appended entry durable.

Provided Methods§

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 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.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§