Expand description
Process exclusion for state directories (audit remediation F04).
One writer per state directory is a structural rule of the anti-rollback
store: high-water marks, manifest digests, and committed generation
snapshots must advance as one coherent unit. In-process mutexes cannot
fence a second process, so every mutating surface (serve, init-state,
offline import) holds an OS advisory exclusive lock on .writer.lock
inside the state directory for its full lifetime.
The lock file is never unlinked: removing a live lock inode would let a
second writer create a fresh, unlocked inode and bypass exclusion. The
file’s presence is not the lock — the kernel-held flock is.
Structs§
- State
Directory Lock - An exclusive, non-blocking OS lock on a state directory.
Constants§
- WRITER_
LOCK_ FILE - Name of the advisory writer lock file inside the state directory.
StateStore::initializeignores exactly this one file when checking that a new directory is empty; every other entry is recovery material.
Functions§
- write_
atomic - Durable, atomic replacement of
pathwithbytes(design §S5).