Trait TransactionalMap

Source
pub trait TransactionalMap<K> {
    // Required methods
    fn commit_transaction(&mut self) -> Option<u64>;
    fn abort_transaction(&mut self);
    fn transaction_keys(&self, txno: u64) -> impl ExactSizeIterator<Item = K>;
    fn transaction_count(&self) -> u64;
}
Expand description

Transaction interface for append-only logs.

If an AORA log supports transactions, it should start a transaction on database open - and panic if there is a non-commited transaction on a drop.

Required Methods§

Source

fn commit_transaction(&mut self) -> Option<u64>

Commits transaction, returning transaction number.

If the pending transaction is empty, a new transaction is not created and None is returned.

Transaction numbers are always sequential.

§Panic

May panic due to internal errors.

Source

fn abort_transaction(&mut self)

Aborts latest transaction.

Source

fn transaction_keys(&self, txno: u64) -> impl ExactSizeIterator<Item = K>

Iterates over keys added to the log as a part of a specific transaction number.

§Panics

If the transaction number is not known.

Source

fn transaction_count(&self) -> u64

Returns number of transactions.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<K, V, const MAGIC: u64, const VER: u16, const KEY_LEN: usize, const VAL_LEN: usize> TransactionalMap<K> for FileAuraMap<K, V, MAGIC, VER, KEY_LEN, VAL_LEN>
where K: From<[u8; KEY_LEN]> + Into<[u8; KEY_LEN]>, V: From<[u8; VAL_LEN]> + Into<[u8; VAL_LEN]>,

Available on crate feature file-strict only.