pub struct TransactionManager { /* private fields */ }Expand description
Transaction manager with ACID guarantees
Implementations§
Source§impl TransactionManager
impl TransactionManager
Sourcepub fn new(wal_dir: impl AsRef<Path>) -> Result<Self, OxirsError>
pub fn new(wal_dir: impl AsRef<Path>) -> Result<Self, OxirsError>
Create a new transaction manager
Sourcepub fn begin(
&mut self,
isolation: IsolationLevel,
) -> Result<AcidTransaction, OxirsError>
pub fn begin( &mut self, isolation: IsolationLevel, ) -> Result<AcidTransaction, OxirsError>
Begin a new transaction with specified isolation level
Sourcepub fn begin_named_graph_transaction(
&mut self,
isolation: IsolationLevel,
) -> Result<NamedGraphTransaction, OxirsError>
pub fn begin_named_graph_transaction( &mut self, isolation: IsolationLevel, ) -> Result<NamedGraphTransaction, OxirsError>
Begin a new named graph transaction with specified isolation level
This provides graph-specific operations with ACID guarantees:
- Atomic multi-graph operations
- Graph-level isolation
- MVCC snapshot isolation per graph
Sourcepub fn recover<F, G>(
&mut self,
insert_fn: F,
delete_fn: G,
) -> Result<usize, OxirsError>
pub fn recover<F, G>( &mut self, insert_fn: F, delete_fn: G, ) -> Result<usize, OxirsError>
Recover from WAL after crash
This method replays committed transactions from the Write-Ahead Log using callback functions to apply operations to the store.
§Arguments
insert_fn- Callback to insert a quad into the storedelete_fn- Callback to delete a quad from the store
§Example
ⓘ
let mut tx_mgr = TransactionManager::new("./wal")?;
let mut store = RdfStore::new()?;
tx_mgr.recover(
|quad| store.insert_quad(quad),
|quad| store.remove_quad(quad)
)?;Sourcepub fn checkpoint(&mut self) -> Result<(), OxirsError>
pub fn checkpoint(&mut self) -> Result<(), OxirsError>
Checkpoint WAL (write buffered entries to disk)
Sourcepub fn stats(&self) -> TransactionStats
pub fn stats(&self) -> TransactionStats
Get transaction statistics
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more