Struct wral::Wal[][src]

pub struct Wal<S = NoState> { /* fields omitted */ }

Write ahead logging.

Implementations

impl<S> Wal<S>[src]

pub fn create(config: Config, state: S) -> Result<Wal<S>> where
    S: State
[src]

Create a new Write-Ahead-Log instance, while create a new journal, older journals matching the name shall be purged.

pub fn load(config: Config) -> Result<Wal<S>> where
    S: Default + State
[src]

Load an existing journal under dir, matching name. Files that don’t match the journal file-name structure or journals with corrupted batch or corrupted state shall be ignored.

Application state shall be loaded from the last batch of the last journal.

pub fn close(self, purge: bool) -> Result<Option<u64>>[src]

Close the Wal instance. To purge the instance pass purge as true.

impl<S> Wal<S>[src]

pub fn add_op(&self, op: &[u8]) -> Result<u64>[src]

Add a operation to WAL, operations are pre-serialized and opaque to Wal instances. Return the sequence-number for this operation.

impl<S> Wal<S>[src]

pub fn iter(&self) -> Result<impl Iterator<Item = Result<Entry>>>[src]

Iterate over all entries in this Wal instance, entries can span across multiple journal files. Iteration will start from lowest sequence-number to highest.

pub fn range<R>(&self, range: R) -> Result<impl Iterator<Item = Result<Entry>>> where
    R: RangeBounds<u64>, 
[src]

Iterate over entries whose sequence number fall within the specified range.

Trait Implementations

impl<S> Clone for Wal<S>[src]

Auto Trait Implementations

impl<S = NoState> !RefUnwindSafe for Wal<S>

impl<S> Send for Wal<S> where
    S: Send + Sync

impl<S = NoState> !Sync for Wal<S>

impl<S> Unpin for Wal<S>

impl<S = NoState> !UnwindSafe for Wal<S>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,