Skip to main content

Journal

Struct Journal 

Source
pub struct Journal<B> { /* private fields */ }
Expand description

The single state-machine implementation shared by every backend.

Implementations§

Source§

impl<B: JournalBackend> Journal<B>

Source

pub fn new(backend: B) -> Self

Wraps a backend. Durable production backends must report write safety.

Source

pub fn acquire_lease(&self) -> Result<Lease, JournalError>

Obtains a new fencing generation, invalidating every older lease.

Source

pub fn head(&self) -> Result<Option<JournalHead>, JournalError>

Returns the current verified head.

Source

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.

Source

pub fn verify(&self) -> Result<Verification, JournalError>

Reads and verifies the complete journal closure.

Source

pub fn replay(&self) -> Result<Replay, JournalError>

Replays verified entries in sequence order.

Source

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.

Source

pub fn table_projection(&self) -> Result<TableProjection, JournalError>

Creates a detached, read-only table projection.

Source

pub fn dir_projection(&self) -> Result<DirProjection, JournalError>

Creates a detached, read-only directory projection.

Source

pub fn entry( sequence: u64, previous: Option<ContentId>, kind: Symbol, payloads: Vec<ContentId>, ) -> JournalEntry

Convenience constructor for an entry with an open kind symbol.

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