Expand description
Lock typestate for compile-time safety of lock lifecycle.
Uses the typestate pattern to make invalid state transitions uncompilable. A lock can only be released or extended when it’s in the Acquired state.
§State Transition Diagram
(unlocked) ─── acquire() ──→ Acquired ─── release() ──→ (unlocked)
│
extend() ↺Modules§
- private 🔒
Structs§
- Acquired
- Lock is currently held (acquired).
- Lock
- A lock with compile-time state tracking.
- Lock
Record - Internal data storage for a lock, independent of typestate. This is what gets persisted to the database.
- Released
- Lock has been released (for documentation; locks in this state don’t exist at runtime).
- Stored
Lock - A lock as stored in the database (status-agnostic).
Enums§
- Lock
Mode - Lock mode determining concurrency behavior.
- Lock
State Error - Errors when transitioning lock states.
Traits§
- Lock
State - Marker trait for lock states.
Functions§
- compute_
lock_ key - Compute a stable i64 key for advisory locks using FNV-1a hash.