Skip to main content

Module txn

Module txn 

Source
Expand description

Process-level ACID primitives for MDQL.

Three layers:

  1. atomic_write — crash-safe single-file write via temp+rename
  2. table_lock — exclusive per-table lock via flock
  3. multi_file_txn — write-ahead journal for multi-file operations

Structs§

Journal
JournalEntry
TableLock
RAII guard for an exclusive table lock.
TableTransaction

Constants§

JOURNAL_FILENAME
LOCK_FILENAME
TMP_SUFFIX

Functions§

atomic_write
Write content to path atomically via temp file + rename.
recover_journal
If a journal exists from a crashed transaction, roll back. Returns true if recovery was performed.
with_multi_file_txn
Context manager equivalent — runs a closure within a transaction. On success, commits. On error, rolls back and re-raises.