Documentation
¶
Overview ¶
Package lock wraps gofrs/flock to provide an advisory file lock on .focus/.lock for the duration of a mutating CLI/MCP operation.
Per designs/focus-issue-001.md §"Concurrency", every mutating command acquires this lock to serialize next_id allocation and index.json writes across concurrent invocations. Read-only commands do NOT take the lock — atomic-rename on the writer side guarantees they see a consistent snapshot.
Stale lock files are not a concern: flock is kernel-managed, so a dying process releases its lock when its file descriptor closes. The .lock file itself stays on disk; that's expected and harmless.
Index ¶
Constants ¶
const FileName = ".lock"
FileName is the lock file's name relative to .focus/.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
Lock is a held lock on .focus/.lock. Always Release() what you Acquire(). Use With() if you can; it's harder to forget.