RiftTransaction class

Represents an ACID transaction that can be committed or rolled back.

Transactions provide atomic, consistent, isolated, and durable operations on Rift boxes. Operations are recorded in the transaction and only applied when the transaction is committed. If the transaction is rolled back, all recorded operations are discarded.

Savepoints allow creating intermediate checkpoints within a transaction. Rolling back to a savepoint discards only the operations recorded after the savepoint was created, preserving earlier operations.

Usage:

final tx = txManager.begin();
try {
  tx.put('user_1', {'name': 'Alice', 'age': 30});
  tx.savepoint('after_user');
  tx.put('user_2', {'name': 'Bob', 'age': 25});
  tx.rollbackTo('after_user');
  tx.put('user_2', {'name': 'Robert', 'age': 25});
  txManager.commit(tx);
} catch (e) {
  txManager.rollback(tx);
}

Constructors

RiftTransaction(String id)

Properties

hashCode int
The hash code for this object.
no setterinherited
id String
Unique identifier for this transaction.
final
isActive bool
Whether this transaction is still active and can accept operations.
no setter
isCommitted bool
Whether this transaction has been successfully committed.
no setter
operationCount int
The number of operations recorded in this transaction.
no setter
operations List<_TransactionOp>
An unmodifiable view of all operations recorded in this transaction.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
savepointCount int
The number of savepoints currently active in this transaction.
no setter
startedAt DateTime
Timestamp when this transaction was created.
final

Methods

clear() → void
Records a clear operation in this transaction.
delete(String key) → void
Records a delete operation in this transaction.
deleteAll(List<String> keys) → void
Records a deleteAll operation in this transaction.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put(String key, dynamic value) → void
Records a put operation in this transaction.
putAll(Map<String, dynamic> entries) → void
Records a putAll operation in this transaction.
rollback() → void
Rolls back the entire transaction, discarding all operations and savepoints.
rollbackTo(String name) → void
Rolls back all operations recorded after the named savepoint.
savepoint(String name) String
Creates a named savepoint at the current position in the transaction.
toDebugMap() Map<String, dynamic>
Returns a summary of this transaction for debugging purposes.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited