Skip to main content

TransactionLog

Trait TransactionLog 

Source
pub trait TransactionLog: Send + Sync {
    // Required methods
    fn append(&self, record: &TxRecord) -> Result<(), LogError>;
    fn tx_range(
        &self,
        start: u64,
        end: Option<u64>,
    ) -> Result<Vec<TxRecord>, LogError>;

    // Provided method
    fn replay(&self) -> Result<Vec<TxRecord>, LogError> { ... }
}
Expand description

Common transaction log interface.

Required Methods§

Source

fn append(&self, record: &TxRecord) -> Result<(), LogError>

Durably appends exactly the next transaction.

§Errors

Returns an error for I/O failure, corruption, or a non-contiguous t.

Source

fn tx_range( &self, start: u64, end: Option<u64>, ) -> Result<Vec<TxRecord>, LogError>

Returns records in the half-open transaction range [start, end).

§Errors

Returns an error when stored records cannot be read or decoded.

Provided Methods§

Source

fn replay(&self) -> Result<Vec<TxRecord>, LogError>

Replays every committed record.

§Errors

Returns an error when stored records cannot be read or decoded.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§