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>
impl<File: ManagedFile> TransactionLog<File>
Sourcepub fn read(
log_path: &Path,
state: State,
context: Context<File::Manager>,
) -> Result<Self, Error>
pub fn read( log_path: &Path, state: State, context: Context<File::Manager>, ) -> Result<Self, Error>
Opens a transaction log for reading.
Sourcepub fn open(
log_path: &Path,
state: State,
context: Context<File::Manager>,
) -> Result<Self, Error>
pub fn open( log_path: &Path, state: State, context: Context<File::Manager>, ) -> Result<Self, Error>
Opens a transaction log for writing.
Sourcepub fn total_size(&self) -> u64
pub fn total_size(&self) -> u64
Returns the total size of the transaction log file.
Sourcepub fn initialize_state(
state: &State,
context: &Context<File::Manager>,
) -> Result<(), Error>
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.
Sourcepub fn push(&mut self, handles: Vec<LogEntry<'static>>) -> Result<(), Error>
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.
Sourcepub fn get(&mut self, id: u64) -> Result<Option<LogEntry<'static>>, Error>
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.
Sourcepub fn scan<Callback: FnMut(LogEntry<'static>) -> bool>(
&mut self,
ids: impl RangeBounds<u64>,
callback: Callback,
) -> Result<(), Error>
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.
Sourcepub fn current_transaction_id(&self) -> u64
pub fn current_transaction_id(&self) -> u64
Returns the current transaction id.
Sourcepub fn new_transaction<'a, I: IntoIterator<Item = &'a [u8], IntoIter = II>, II: ExactSizeIterator<Item = &'a [u8]>>(
&self,
trees: I,
) -> TransactionHandle
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.