pub struct Journal<B> { /* private fields */ }Expand description
The single state-machine implementation shared by every backend.
Implementations§
Source§impl<B: JournalBackend> Journal<B>
impl<B: JournalBackend> Journal<B>
Sourcepub fn new(backend: B) -> Self
pub fn new(backend: B) -> Self
Wraps a backend. Durable production backends must report write safety.
Sourcepub fn acquire_lease(&self) -> Result<Lease, JournalError>
pub fn acquire_lease(&self) -> Result<Lease, JournalError>
Obtains a new fencing generation, invalidating every older lease.
Sourcepub fn head(&self) -> Result<Option<JournalHead>, JournalError>
pub fn head(&self) -> Result<Option<JournalHead>, JournalError>
Returns the current verified head.
Sourcepub fn publish(
&self,
lease: &Lease,
expected: Option<&JournalHead>,
objects: Vec<JournalObject>,
entries: Vec<JournalEntry>,
) -> Result<JournalHead, JournalError>
pub fn publish( &self, lease: &Lease, expected: Option<&JournalHead>, objects: Vec<JournalObject>, entries: Vec<JournalEntry>, ) -> Result<JournalHead, JournalError>
Atomically publishes objects and an ordered entry batch under one fence.
Exact redelivery is a no-op. Any conflicting delivery, missing/corrupt payload, stale fence, sequence gap, or wrong predecessor is rejected.
Sourcepub fn verify(&self) -> Result<Verification, JournalError>
pub fn verify(&self) -> Result<Verification, JournalError>
Reads and verifies the complete journal closure.
Sourcepub fn replay(&self) -> Result<Replay, JournalError>
pub fn replay(&self) -> Result<Replay, JournalError>
Replays verified entries in sequence order.
Sourcepub fn verified_snapshot(&self) -> Result<VerifiedSnapshot, JournalError>
pub fn verified_snapshot(&self) -> Result<VerifiedSnapshot, JournalError>
Reads and verifies one internally consistent semantic snapshot.
Consumers that must reduce entries together with their payload values use this method so both come from the same backend read. The returned value exposes no physical storage identity or mutable backend state.
Sourcepub fn table_projection(&self) -> Result<TableProjection, JournalError>
pub fn table_projection(&self) -> Result<TableProjection, JournalError>
Creates a detached, read-only table projection.
Sourcepub fn dir_projection(&self) -> Result<DirProjection, JournalError>
pub fn dir_projection(&self) -> Result<DirProjection, JournalError>
Creates a detached, read-only directory projection.