begin method

TxnContext begin()

Start a new transaction. Returns its TxnContext.

Implementation

TxnContext begin() {
  final txnId = _nextTxnId++;
  final ctx = TxnContext(
    txnId: txnId,
    snapshotTxnId: _lastCommitted,
    snapshotActive: Set<int>.from(_active.keys),
  );
  _active[txnId] = ctx;
  return ctx;
}