pub struct TransactionManager { /* private fields */ }Expand description
Manages all active transactions.
Implementations§
Source§impl TransactionManager
impl TransactionManager
pub fn new() -> Self
Sourcepub fn begin(&self, isolation_level: IsolationLevel) -> Result<TransactionId>
pub fn begin(&self, isolation_level: IsolationLevel) -> Result<TransactionId>
Begin a new transaction.
Sourcepub fn commit(&self, tx_id: TransactionId) -> Result<()>
pub fn commit(&self, tx_id: TransactionId) -> Result<()>
Commit a transaction.
Sourcepub fn abort(&self, tx_id: TransactionId) -> Result<()>
pub fn abort(&self, tx_id: TransactionId) -> Result<()>
Abort a transaction.
Sourcepub fn read(
&self,
tx_id: TransactionId,
key: &VersionKey,
) -> Result<Option<Vec<u8>>>
pub fn read( &self, tx_id: TransactionId, key: &VersionKey, ) -> Result<Option<Vec<u8>>>
Read a version visible to the transaction.
Sourcepub fn write(
&self,
tx_id: TransactionId,
key: VersionKey,
data: Vec<u8>,
) -> Result<()>
pub fn write( &self, tx_id: TransactionId, key: VersionKey, data: Vec<u8>, ) -> Result<()>
Write a new version.
Sourcepub fn delete(&self, tx_id: TransactionId, key: &VersionKey) -> Result<()>
pub fn delete(&self, tx_id: TransactionId, key: &VersionKey) -> Result<()>
Delete a version.
Sourcepub fn stats(&self) -> TransactionStats
pub fn stats(&self) -> TransactionStats
Get transaction statistics.
Sourcepub fn run_gc(&self) -> GcStats
pub fn run_gc(&self) -> GcStats
Run garbage collection to remove old versions that are no longer visible. Returns the number of versions collected.
Sourcepub fn run_gc_if_needed(&self, threshold: usize) -> Option<GcStats>
pub fn run_gc_if_needed(&self, threshold: usize) -> Option<GcStats>
Run garbage collection with a threshold.
Only runs if there are more than threshold versions.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TransactionManager
impl !RefUnwindSafe for TransactionManager
impl Send for TransactionManager
impl Sync for TransactionManager
impl Unpin for TransactionManager
impl UnsafeUnpin for TransactionManager
impl UnwindSafe for TransactionManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more