TransactionLog

Struct TransactionLog 

Source
pub struct TransactionLog<File: ManagedFile> { /* private fields */ }
Expand description

A transaction log that records changes for one or more trees.

Implementations§

Source§

impl<File: ManagedFile> TransactionLog<File>

Source

pub fn read( log_path: &Path, state: State, context: Context<File::Manager>, ) -> Result<Self, Error>

Opens a transaction log for reading.

Source

pub fn open( log_path: &Path, state: State, context: Context<File::Manager>, ) -> Result<Self, Error>

Opens a transaction log for writing.

Source

pub fn total_size(&self) -> u64

Returns the total size of the transaction log file.

Source

pub fn initialize_state( state: &State, context: &Context<File::Manager>, ) -> Result<(), Error>

Initializes state to contain the information about the transaction log located at log_path.

Source

pub fn push(&mut self, handles: Vec<LogEntry<'static>>) -> Result<(), Error>

Logs one or more transactions. After this call returns, the transaction log is guaranteed to be fully written to disk.

§Errors

Returns ErrorKind::TransactionPushedOutOfOrder if handles is out of order, or if any handle contains an id older than one already written to the log.

Source

pub fn get(&mut self, id: u64) -> Result<Option<LogEntry<'static>>, Error>

Returns the executed transaction with the id provided. Returns None if not found.

Source

pub fn scan<Callback: FnMut(LogEntry<'static>) -> bool>( &mut self, ids: impl RangeBounds<u64>, callback: Callback, ) -> Result<(), Error>

Logs one or more transactions. After this call returns, the transaction log is guaranteed to be fully written to disk.

Source

pub fn close(self) -> Result<(), Error>

Closes the transaction log.

Source

pub fn current_transaction_id(&self) -> u64

Returns the current transaction id.

Source

pub fn new_transaction<'a, I: IntoIterator<Item = &'a [u8], IntoIter = II>, II: ExactSizeIterator<Item = &'a [u8]>>( &self, trees: I, ) -> TransactionHandle

Begins a new transaction, exclusively locking trees.

Source

pub fn state(&self) -> State

Returns the current state of the log.

Auto Trait Implementations§

§

impl<File> Freeze for TransactionLog<File>

§

impl<File> !RefUnwindSafe for TransactionLog<File>

§

impl<File> Send for TransactionLog<File>

§

impl<File> Sync for TransactionLog<File>

§

impl<File> Unpin for TransactionLog<File>

§

impl<File> !UnwindSafe for TransactionLog<File>

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.