Transaction

Struct Transaction 

Source
pub struct Transaction<K: Eq + Hash, V> {
    pub id: TxId,
    pub snapshot: Snapshot,
    pub read_set: DashMap<K, TxId>,
    pub write_set: DashSet<K>,
    pub insert_set: DashSet<K>,
    pub range_scans: RwLock<Vec<(K, K)>>,
    pub prefix_scans: RwLock<Vec<String>>,
    pub in_conflict: AtomicBool,
    pub workspace: RwLock<Workspace<K, V>>,
    /* private fields */
}
Expand description

Represents a single, isolated transaction.

Fields§

§id: TxId

The unique ID of this transaction.

§snapshot: Snapshot

The consistent snapshot of the database state for this transaction.

§read_set: DashMap<K, TxId>

The set of keys read by this transaction, used for SSI conflict detection. Maps Key -> Creator TxId of the version that was read.

§write_set: DashSet<K>

The set of keys written to by this transaction, used for SSI conflict detection.

§insert_set: DashSet<K>

The set of keys inserted by this transaction, used for phantom detection.

§range_scans: RwLock<Vec<(K, K)>>

The set of ranges scanned by this transaction, used for phantom detection.

§prefix_scans: RwLock<Vec<String>>

The set of prefixes scanned by this transaction, used for phantom detection.

§in_conflict: AtomicBool

A flag indicating if a read-write conflict has been detected by another committing transaction. If true, this transaction will be forced to abort.

§workspace: RwLock<Workspace<K, V>>

The transaction’s private workspace for pending changes (inserts, updates, deletes). These changes are only applied to the main database upon a successful commit.

Implementations§

Source§

impl<K, V> Transaction<K, V>

Source

pub fn new(id: TxId, snapshot: Snapshot) -> Self

Creates a new transaction with a given ID and snapshot.

Trait Implementations§

Source§

impl<K: Debug + Eq + Hash, V: Debug> Debug for Transaction<K, V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<K, V> !Freeze for Transaction<K, V>

§

impl<K, V> !RefUnwindSafe for Transaction<K, V>

§

impl<K, V> Send for Transaction<K, V>
where V: Send + Sync, K: Send,

§

impl<K, V> Sync for Transaction<K, V>
where V: Sync + Send, K: Send + Sync,

§

impl<K, V> Unpin for Transaction<K, V>
where V: Unpin, K: Unpin,

§

impl<K, V> UnwindSafe for Transaction<K, V>
where V: UnwindSafe, K: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.