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: TxIdThe unique ID of this transaction.
snapshot: SnapshotThe 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: AtomicBoolA 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.