Expand description
Store ownership via a process-local registry and an OS file lock.
Two mechanisms are needed, because neither alone is sufficient:
- The process-local registry provides same-process exclusion. POSIX
record locks do not conflict between descriptors held by one process, so
without the registry a second
Storein the same process would be admitted. Windows byte-range locks do conflict per handle, even inside one process, but the registry is still what keeps the two platforms on one contract: it owns exactly one descriptor per store, counts the local shared holders, and refuses a conflicting mode before any lock call, so admission does not depend on which platform is answering. - The persistent
writer.lockprovides cross-process exclusion and is released by the operating system when the holder dies, orderly or not.
The registry is keyed on the store directory’s stable filesystem identity —
(st_dev, st_ino) on Unix, (volume serial, file index) on Windows — never
on path text, so case differences, separator differences, relative versus
absolute spellings and supported junctions all converge on one store.
Nothing else in this process may open STORE_LOCK_FILE.
Structs§
- Store
Lock - Exclusive writer ownership automatically released when the process dies.
Enums§
- Store
Lock Error - Failure to open or acquire the single-writer lock.
Constants§
- STORE_
LOCK_ FILE - Persistent lock filename; only
StoreLockmay open this file.