Persistence

Universal Directory keeps its working state in memory. Snapshots and write-ahead logs preserve that state across restarts. Reads use the live store; recovery reconstructs it from the durable files.

Generations and recovery #

Each generation has a snapshot, a write-ahead log, or both. A snapshot records complete state; log frames record changed state rather than re-running original requests. Headers identify the format, node, and generation. Checksums detect incomplete or damaged records.

Recovery reads a valid snapshot and the later log chain, then reconstructs derived indexes and schema. It can truncate an incomplete tail in the active log. Damage in a sealed generation, or valid records after damaged bytes, causes refusal rather than speculative recovery.

Acknowledgment and durability #

A persistent mutating API request waits for its log data to be synchronized before returning success. Concurrent callers can share a flush. A failed synchronization stops the daemon rather than acknowledging state it cannot promise to recover.

Local reads can see an in-memory change before its flush completes. Replication's advertised progress is separately durability-gated. These are different provides: a readable value is not itself evidence that a crash will preserve it. In ephemeral mode there is no durable disk storage.

Compaction and erasure #

Rotation seals the active log and opens its successor. A background rebuild replays sealed files into a replacement snapshot. The snapshot is published and synchronized before superseded generations are removed. Rollback salvage has a separate path because its corrected state initially exists only in memory.

Destructive changes record an erasure debt until compaction removes the older files that contain their payloads. The current two-minute target is reported through the storage view. It is not a guarantee against stalled I/O or failed compaction; inspect outstanding debt and rebuild failures. Deletion concerns directory files, not physical remnants in freed storage, external backups, or filesystem snapshots.

Operating boundary #

The daemon takes an exclusive, nonblocking directory lock before accessing storage. Another daemon opening that directory fails immediately. The lock remains held while storage writers exist and is released when they close; process termination also releases it. This is an advisory lock, so it does not protect against programs that bypass the locking protocol. Do not remove or replace a running daemon's data directory.

Preserve all generations and the machine key when backing up or moving a stopped development instance. The repository's fault-injection tests cover interrupted writes, flush failures, crash recovery, and restored snapshots; they do not qualify every filesystem, device, or backup procedure.

Edit this page