alopex-core 0.5.0

Core storage engine for Alopex DB - LSM-tree, columnar storage, and vector index
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Transaction management traits.

use crate::error::Result;
use crate::types::TxnMode;

/// A manager for creating and committing transactions.
///
/// This trait is generic over the transaction type it manages.
pub trait TxnManager<'a, T> {
    /// Begins a new transaction in the specified mode.
    fn begin(&'a self, mode: TxnMode) -> Result<T>;

    /// Commits a transaction, applying its changes to the store.
    fn commit(&'a self, txn: T) -> Result<()>;

    /// Rolls back a transaction, discarding its changes.
    fn rollback(&'a self, txn: T) -> Result<()>;
}