Expand description
The advisory single-writer lock: a lock entry naming the process that
holds the container open for writing.
Advisory on purpose. It stops the second blockworx from writing a log the first is also appending to; it does not — and is not meant to — stop the user’s text editor, which is the point of a container made of plain files.
Structs§
- Lock
Holder - Who holds the lock, as the entry records it.
Enums§
- Claim
- The answer to “may I write this container?”.
- Holder
- Whether the process named in a lock entry is still running.
- Holding
- Who holds a container open for writing, in the words the reader is told it in.
Functions§
- claim
- Claim the writer’s lock on
storage’s container — whatStorage::claimdoes for a storage with no lock of its own. - claim_
probing 🔒 - The seam the liveness probe enters by: a test can state “the holder is gone” without needing a process that reliably is.
- holder 🔒
- Linux answers this from
/proc, which needs no dependency and nounsafe. Everywhere else the honest answer is that we cannot tell, and the safe one is to leave the lock alone: a lock wrongly broken means two writers appending to one log, while a lock wrongly kept means one read-only session and a file the user can delete. - release
- Give the lock back. A release that does not land leaves a stale entry, which the next claim breaks — so there is nothing here for a caller to do about it.