Expand description
Unified durable append-only journal (ledger-journal.jsonl), single-inode reader/writer
flock guards on the repository’s permanent ledger lock, standalone pending-transaction
recovery, and full .ctbnbdl bundle (id, tokens) verification.
Structs§
- Compiled
Bundle Digests - Recorded SHA-256 inventories for unsplit and split
.ctbnbdlbundle directories. - Durable
Transaction Outcome - Output returned by
execute_durable_ledger_transaction_with_planner. - Journal
Record - A single JSONL record (
BATCH_PENDINGorBATCH_COMMITTED) inledger-journal.jsonl. - Ledger
Read Guard - Shared reader lock guard (
flock(LOCK_SH)) on the permanent ledger lock. - Ledger
Write Guard - Exclusive writer lock guard (
flock(LOCK_EX)) on the permanent ledger lock. - Parsed
Journal - Parsed state of
ledger-journal.jsonl. - Planned
Ledger Item - A single planned node append item in a durable ledger transaction and/or manifest.
- Transaction
Manifest - Precomputed deterministic transaction manifest used with
--require-manifest.
Enums§
- Fault
Injection Point - Fault-injection hook for deterministic crash and recovery unit tests.
Constants§
- JOURNAL_
INITIALIZED_ REL_ PATH - Relative path from the repository root to the local post-initialization marker.
- LEDGER_
JOURNAL_ REL_ PATH - Relative path from the repository root to the unified durable ledger journal.
- LOCK_
CANARY_ REL_ PATH - Relative path from the repository root to the shared permanent lock canary file.
Functions§
- chunk_
filename_ for_ node_ id - Returns the
.ctbnodeschunk relative path ("85899_34592.ctbnodes", …,"85900/85900_34492.ctbnodes") that ownsnode_id. - compact_
closed_ ledger_ chunks - Compacts
ledger-journal.jsonland removes closed-chunk.ctbnode-incoming(and legacy.dcsh) files fromsrc/formats/dcdata/data-src/nodes/allocated/for all.ctbnodeschunk files that have reachedMAX_NODES_PER_CHUNK(100nodes) and are therefore closed. - compact_
closed_ ledger_ chunks_ with_ guard - Internal closed-chunk compaction operating under an already-held
LedgerWriteGuard. - compile_
nodes_ slice_ to_ ctbnbdl_ with_ write_ guard - Compiles
nodesinto tracked unsplit (assets/data/graph-bundles/*.ctbnbdl) and gitignored split (assets/data/graph-bundles/split/{live,history}/*.ctbnbdl) bundles under an already-heldLedgerWriteGuarddirectly from the validated in-memorynodesslice,fsyncs all bundle files and directories, updatesbuilt/staging directories if present, verifies the compiled bundles viaverify_compiled_bundles_match_ledger, and returnsCompiledBundleDigests. - compute_
bundle_ dir_ sha256s - Computes a sorted map of
<filename>.ctbnbdl -> sha256_hexfor all.ctbnbdlfiles directly indir. - compute_
ledger_ dir_ sha256 - Computes the canonical SHA-256 digest over all
.ctbnodeschunk files ingraph_dir, sorted by ascending chunk start ID (rel_path\0content\0). - compute_
nodes_ slice_ ledger_ sha256 - Computes the canonical
.ctbnodesdirectory SHA-256 digest from an in-memory slice ofLedgerNodes. - decode_
unicode_ string_ tokens - Decodes a UTF-8 string value node from its token slice if all tokens are Unicode codepoints.
- ensure_
ledger_ journal_ clean - execute_
durable_ ledger_ transaction_ with_ planner - Shared durable transactional writer used by both
process_inbox_nodesandupdate_system_graph_ledger. - fsync_
dir - Invokes
sync_all()on a directory path on Unix platforms. - fsync_
file - Invokes
sync_all()on a file path. - inspect_
ledger_ journal - Parses and validates
ledger-journal.jsonl: - load_
ledger_ nodes_ from_ dir_ with_ write_ guard - Loads
.ctbnodesdirectly under an already-heldLedgerWriteGuardwithout opening a second lock fd or running external reader-gate checks whileBATCH_PENDINGis open. - recover_
pending_ ledger_ journal - Executes standalone recovery of any open
BATCH_PENDINGrecord, torn journal line, or verified CSV-provenanced.ctbnodestail ahead ofledger-journal.jsonl. - recover_
pending_ ledger_ journal_ with_ guard - Internal recovery implementation operating under an already-held
LedgerWriteGuard. - repair_
torn_ journal_ suffix - Truncates an unterminated trailing line from
journal_pathatvalid_prefix_lenandfsyncs both file and parent directory. - resolve_
ctbnbdl_ framing_ dcs_ from_ nodes - Resolves the
CtbnbdlFramingDcsfrom an in-memory slice of.ctbnodesLedgerNodes by bootstrapping from the"ProgrammaticIdentifier"string value node. - sha256_
bytes_ hex - Computes the lowercase hex SHA-256 digest of
bytes. - sha256_
file_ hex - Computes the lowercase hex SHA-256 digest of a file on disk.
- verify_
compiled_ bundles_ match_ ledger - Verifies that the tracked unsplit bundles (
graph-bundles/*.ctbnbdl) and, when present or required, the gitignored split live (graph-bundles/split/live/*.ctbnbdl) and historical (graph-bundles/split/history/*.ctbnbdl) bundles matchcommitted_nodesin: