Skip to main content

JournalWriter

Trait JournalWriter 

Source
pub trait JournalWriter: Send + Sync {
    // Required method
    fn write(&self, entry: &JournalEntry) -> Result<(), JournalError>;
}
Expand description

Durable journal writer for crash recovery.

After processing each command, the runtime writes a JournalEntry to a write-ahead log (WAL). On restart, the journal is replayed from the last snapshot to recover the engine state.

§Durability guarantee

Implementations must ensure that a successful write() return means the entry is durable (fsync’d or equivalent). If the write fails, the runtime must not advance the engine state, preserving the invariant that the journal and engine state are always consistent.

§Ordering

Entries must be written in command_id order. The journal reader relies on monotonically increasing IDs for replay correctness.

Required Methods§

Source

fn write(&self, entry: &JournalEntry) -> Result<(), JournalError>

Write a journal entry durably.

Returns Ok(()) on successful durable write, or a JournalError if the write failed.

Implementors§