Struct nebari::transaction::TransactionManager
source · [−]pub struct TransactionManager<Manager: FileManager> { /* private fields */ }Expand description
A shared TransactionLog manager. Allows multiple threads to interact with a single transaction log.
Implementations
sourceimpl<Manager> TransactionManager<Manager> where
Manager: FileManager,
impl<Manager> TransactionManager<Manager> where
Manager: FileManager,
sourcepub fn spawn(directory: &Path, context: Context<Manager>) -> Result<Self, Error>
pub fn spawn(directory: &Path, context: Context<Manager>) -> Result<Self, Error>
Spawns a new transaction manager. The transaction manager runs its own thread that writes to the transaction log.
sourcepub fn new_transaction<'a, I: IntoIterator<Item = &'a [u8], IntoIter = II>, II: ExactSizeIterator<Item = &'a [u8]>>(
&self,
trees: I
) -> ManagedTransaction<Manager>
pub fn new_transaction<'a, I: IntoIterator<Item = &'a [u8], IntoIter = II>, II: ExactSizeIterator<Item = &'a [u8]>>(
&self,
trees: I
) -> ManagedTransaction<Manager>
Creates a new transaction, exclusively locking trees. Will block the thread until the trees can be locked.
sourcepub fn scan<Callback: FnMut(LogEntry<'static>) -> bool>(
&self,
range: impl RangeBounds<TransactionId>,
callback: Callback
) -> Result<(), Error>
pub fn scan<Callback: FnMut(LogEntry<'static>) -> bool>(
&self,
range: impl RangeBounds<TransactionId>,
callback: Callback
) -> Result<(), Error>
Scans the transaction log for entries with ids within range. Invokes
callback for each entry found. The scan will always scan forwards
starting with the lowest ID matching the range.
sourcepub fn transaction_was_successful(
&self,
transaction_id: TransactionId
) -> Result<bool, Error>
pub fn transaction_was_successful(
&self,
transaction_id: TransactionId
) -> Result<bool, Error>
Returns true if the transaction id was recorded in the transaction log. This method caches
sourcepub fn transaction_position(
&self,
transaction_id: TransactionId
) -> Result<Option<u64>, Error>
pub fn transaction_position(
&self,
transaction_id: TransactionId
) -> Result<Option<u64>, Error>
Returns the location on disk of the transaction, if found.
Methods from Deref<Target = State>
sourcepub fn current_transaction_id(&self) -> Option<TransactionId>
pub fn current_transaction_id(&self) -> Option<TransactionId>
Returns the last successfully written transaction id, or None if no transactions have been recorded yet.
sourcepub fn next_transaction_id(&self) -> TransactionId
pub fn next_transaction_id(&self) -> TransactionId
Returns the next transaction id that will be used.
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
Creates a new transaction, exclusively locking trees. Will block the thread until the trees can be locked.
Trait Implementations
sourceimpl<Manager: Clone + FileManager> Clone for TransactionManager<Manager>
impl<Manager: Clone + FileManager> Clone for TransactionManager<Manager>
sourcefn clone(&self) -> TransactionManager<Manager>
fn clone(&self) -> TransactionManager<Manager>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl<Manager: Debug + FileManager> Debug for TransactionManager<Manager>
impl<Manager: Debug + FileManager> Debug for TransactionManager<Manager>
sourceimpl<Manager: FileManager> Deref for TransactionManager<Manager>
impl<Manager: FileManager> Deref for TransactionManager<Manager>
Auto Trait Implementations
impl<Manager> !RefUnwindSafe for TransactionManager<Manager>
impl<Manager> Send for TransactionManager<Manager>
impl<Manager> Sync for TransactionManager<Manager>
impl<Manager> Unpin for TransactionManager<Manager> where
Manager: Unpin,
impl<Manager> !UnwindSafe for TransactionManager<Manager>
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> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
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