Documentation
¶
Overview ¶
Package storelock serializes writers of an on-disk store (the owner's book, a memory directory) across goroutines and processes.
The lock file is a sibling of the store, never inside it: a store directory can be replaced wholesale (book-tidy moves the whole book), and two writers holding locks on two different inodes would no longer exclude each other.
Index ¶
Constants ¶
const Supported = true
Supported reports whether Lock really excludes other writers.
Variables ¶
This section is empty.
Functions ¶
func Lock ¶
Lock takes the exclusive lock of dir and returns the open lock file; closing it releases the lock. The file is returned (not an io.Closer) so a caller can hand the descriptor to a child process that must keep the lock held while it runs: a flock belongs to the open file description, not to the process.
flock does not nest within a process either: a second Lock on the same store from the same goroutine blocks forever, so a holder writes the store directly.
Types ¶
This section is empty.