Expand description
Advisory locks implementation with namespacing and retry policies.
Cross-database advisory locking with proper namespacing and configurable retry/backoff.
§Security policy
This crate forbids plain SQL outside migration infrastructure. Therefore, locks are implemented purely as file-based locks (no DB-native advisory locks).
Notes:
- Prefer calling
guard.release().awaitfor deterministic unlock;Dropprovides best-effort cleanup only (may be skipped on runtime shutdown). - File-based locks use
create_new(true)semantics and keep the file open, then remove it on release. Consider usingfs2::FileExt::try_lock_exclusive()if you want kernel-level advisory locks across processes.
Structs§
- DbLock
Guard - Database lock guard that can release lock explicitly via
release().Dropprovides best-effort cleanup if you forget to callrelease(). - Lock
Config - Configuration for lock acquisition attempts.