Skip to main content

Module advisory_locks

Module advisory_locks 

Source
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().await for deterministic unlock; Drop provides 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 using fs2::FileExt::try_lock_exclusive() if you want kernel-level advisory locks across processes.

Structs§

DbLockGuard
Database lock guard that can release lock explicitly via release(). Drop provides best-effort cleanup if you forget to call release().
LockConfig
Configuration for lock acquisition attempts.

Enums§

DbLockError