Skip to main content

Module lock

Module lock 

Source
Expand description

Process-local + cross-process advisory locking (§5.7).

redb guarantees a single in-process writer but offers no protection between processes (GUI + CLI sharing one meta.redb). We layer an fs2 flock on a dedicated lock file:

  • shared for reads (multiple readers allowed),
  • exclusive for writes (mutates the index).

The memo files themselves are never locked — atomic rename keeps them safe, and external editors/agents may read and write them freely.

Structs§

FileLock
A held advisory lock. Dropping it releases the flock.

Enums§

LockKind

Functions§

acquire
Open (creating if needed) and hold a lock file. timeout caps contention waits; default policy in callers is 5s (§5.7).
is_locked
Probe whether an exclusive lock is currently held by some process. Used by oximemo doctor to report lock contention without blocking.