Expand description
File locking for concurrent agents.
When file_locking is enabled in config, agents lock files they work on
to prevent concurrent writes. Locks are stored as JSON files in .mana/locks/.
Lock lifecycle:
- Pre-emptive:
mana runlocks files listed in the unit’spathsfield on spawn. - On-write: The pi extension locks files on first write (safety net).
- Release: Locks are released when the agent finishes or is killed.
Structs§
- Active
Lock - A lock with its file system path.
- Lock
Info - Information stored in each lock file.
Functions§
- acquire
- Acquire a lock on a file for a unit agent.
- check_
lock - Check if a file is currently locked.
- clear_
all - Force-clear all locks.
- list_
locks - List all active locks, cleaning stale ones (dead PIDs) along the way.
- lock_
dir - Return the locks directory, creating it if needed.
- release_
all_ for_ unit - Release all locks held by a specific unit.