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 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.
Auto Trait Implementations§
impl<B> Freeze for Journal<B>where
B: Freeze,
impl<B> RefUnwindSafe for Journal<B>where
B: RefUnwindSafe,
impl<B> Send for Journal<B>where
B: Send,
impl<B> Sync for Journal<B>where
B: Sync,
impl<B> Unpin for Journal<B>where
B: Unpin,
impl<B> UnsafeUnpin for Journal<B>where
B: UnsafeUnpin,
impl<B> UnwindSafe for Journal<B>where
B: 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