Skip to main content

Module database

Module database 

Source
Expand description

Multi-table Database container (spec §5, §6, §10).

Owns the shared services — catalog, dual-counter epoch authority, shared raw/decoded page caches, snapshot-retention registry, and the DB-wide KEK — and mounts per-table Table engines under tables/<id>/ that borrow them. P1 scope: per-table WALs remain (collapsed into one shared WAL in P2); the win here is one consistent commit clock across tables and one reopen path.

Structs§

AuthorizedReadSnapshot
One optimistic authorization snapshot for a complete scored read.
AuthorizedReadStamp
Exact table/security generation used by one successful authorized read.
CdcBatch
ChangeEvent
A durable data-change event reconstructed from committed WAL records, or an ephemeral SQL NOTIFY event when id is None.
CheckIssue
An integrity issue found by Database::check (spec §16).
Database
The exclusive public owner of one DatabaseCore (spec §10.1, S1A-001).
DatabaseCore
The shared storage core (spec §10.1, S1A-001): one catalog, one epoch clock, shared caches, a shared WAL, and a live map of name → Arc<Table>.
DatabaseOpenMetrics
ExternalTriggerWriteResult
OpenOptions
Knobs for Database::open_with_options.
ReadAuthorization
RlsCacheStats
Runtime statistics for the byte-bounded RLS candidate cache.
TableGenerationStats
TableHandle
Mounted table with immutable, structurally shared scored-read generations.
TablePinsReport
Per-table version-retention pin diagnostics (S1C-004): one mounted table’s active pin sources as reported by crate::engine::Table::version_pins_report.
TableReadGeneration
Immutable, structurally shared snapshot used by scored readers.

Enums§

ExternalTriggerBaseWrite
ExternalTriggerWrite
StagedTxnWrite
Two-pass, flushed_epoch-gated recovery of the shared WAL (spec §15).
TableGuard

Constants§

CTAS_BUILD_TABLE_PREFIX
DEFAULT_MEMORY_BUDGET_BYTES
Default node-level memory budget (S1E-003): 1 GiB. Comfortably covers the two 64 MiB caches with headroom for query execution, result buffering, and maintenance reservations.
DEFAULT_TEMP_DISK_BUDGET_BYTES
Default node-level temporary-disk (spill) budget (S1E-004): 4 GiB of live spill files across every query on the core.
EXTERNAL_TABLE_ID
Sentinel table_id for CheckIssues that concern external-table module state instead of an ordinary table.
HISTORY_RETENTION_FILENAME
KEYS_FILENAME
META_DIR
TABLES_DIR
VTAB_DIR
WAL_TABLE_ID
Sentinel table_id for CheckIssues that concern the shared WAL rather than any table. u64::MAX is never allocated to a real table (the catalog mints ids from 0 upward), so Database::doctor can safely skip them.

Traits§

ExternalTriggerBridge

Functions§

lock_table_with_context
translate_records_for_replication
Leader-side spill translation for the replicated write path (spec section 11.3 step 3, “leader constructs transaction command”; review finding M2).