Database class

Properties

btreeIndexes Map<String, Map<String, BTreeV2>>
Per-table, per-column BTreeV2 instances. These are loaded from *.btree2 files at open() and persisted at checkpoint (step 7 — AFTER data pages, BEFORE WAL truncation).
final
cache PageCache
getter/setter pair
committedTxns CommittedTxnsFilter
Committed-txn filter (O(1) visibility checks without WAL scan).
no setter
dir String
final
hashCode int
The hash code for this object.
no setterinherited
lockManager LockManagerV2
no setter
mvccTables Map<String, MvccTable>
Per-table MVCC version stores (in-memory; rebuilt from page data on open).
final
pager Pager
getter/setter pair
pageTables Map<String, PageTable>
New binary slotted-page tables (PageTable + DirtyPageTracker). These are the authoritative write path once migration is complete.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
statsRegistry StatsRegistry
CBO statistics registry — persisted to stats.json at each checkpoint.
final
tables Map<String, Table>
Legacy JSON-page tables — kept for backward-compat with executor scans and the BTree index layer until the binary page migration is complete.
final
txnManager TransactionManagerV2
V2 transaction manager: monotonic txnIds (never 0), FIFO fair locks.
getter/setter pair
wal Wal
getter/setter pair

Methods

abortTxn(TxnContextV2 ctx) → void
Abort (rollback). MVCC undo is implicit via xmin visibility.
analyze(String tableName) Future<void>
analyzeAll() Future<void>
autoCommitDone(TxnContextV2 ctx) → void
Must be called after autoCommitRead finishes to release resources.
autoCommitRead() TxnContextV2
Autocommit read: allocates a transient read-only TxnContextV2.
beginTxn({bool readOnly = false}) TxnContextV2
Begin a new MVCC transaction. Returns a TxnContextV2.
btreeDelete(String table, String column, dynamic key, int rowId) → void
Delete a key from a column's binary B+Tree index.
btreeInsert(String table, String column, dynamic key, int rowId) → void
Insert a value into a column's binary B+Tree index.
btreeLookup(String table, String column, dynamic key) List<int>
Lookup a key in a column's binary B+Tree index.
checkpoint() Future<void>
close() Future<void>
commitTxn(TxnContextV2 ctx) → void
Commit. The WAL commit record MUST be written before calling this.
createTable(String name, Schema schema) Future<Table>
dropTable(String name) Future<void>
getTable(String name) Table?
mvccTableFor(String name) MvccTable
Get or create the MvccTable for name.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rollback() Future<void>
saveSnapshot() Future<void>
toString() String
A string representation of this object.
inherited
vacuum() Future<void>
walAppend(WalOp op, String table, Map<String, dynamic> payload, {int? txnId}) Future<int>

Operators

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

Static Methods

open(String dirPath) Future<Database>