Struct nebari::transaction::TransactionLog
source · [−]pub struct TransactionLog<File: ManagedFile> { /* private fields */ }
Expand description
A transaction log that records changes for one or more trees.
Implementations
sourceimpl<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: TransactionId
) -> Result<Option<LogEntry<'static>>, Error>
pub fn get(
&mut self,
id: TransactionId
) -> 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<TransactionId>,
callback: Callback
) -> Result<(), Error>
pub fn scan<Callback: FnMut(LogEntry<'static>) -> bool>(
&mut self,
ids: impl RangeBounds<TransactionId>,
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 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
.
Auto Trait Implementations
impl<File> !RefUnwindSafe for TransactionLog<File>
impl<File> Send for TransactionLog<File>
impl<File> Sync for TransactionLog<File>
impl<File> Unpin for TransactionLog<File> where
<<File as ManagedFile>::Manager as FileManager>::FileHandle: Unpin,
impl<File> !UnwindSafe for TransactionLog<File>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more