Skip to main content

Module storage

Module storage 

Source
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§

StateDirectoryLock
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::initialize ignores 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 path with bytes (design §S5).