1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! Lock - Pluggable locking abstractions
//!
//! This module provides traits and implementations for per-entity locking,
//! used by `QueuedRepository` to serialize aggregate access.
//!
//! ## Architecture
//!
//! ```text
//! ┌─────────────────────────────────────────────────────────────┐
//! │ LockManager (per repository) │
//! │ - get_lock(id) → Arc<Lock> │
//! └─────────────────────────────────────────────────────────────┘
//! │
//! ▼
//! ┌─────────────────────────────────────────────────────────────┐
//! │ Lock Trait │
//! │ lock() / try_lock() / unlock() │
//! └─────────────────────────────────────────────────────────────┘
//! │ │ │
//! ▼ ▼ ▼
//! ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
//! │ InMemoryLock │ │ PostgresLock │ │ SqliteLock │
//! │ (process-local)│ │ (durable lease, │ │ (durable lease, │
//! │ │ │ feature=postgres│ │ feature=sqlite) │
//! └──────────────────┘ └──────────────────┘ └──────────────────┘
//! ```
//!
//! The SQLx locks ([`PostgresLock`]/[`SqliteLock`]) persist a per-stream lease in
//! the `aggregate_locks` table so a `QueuedRepository` can serialize aggregate
//! access across processes.
pub use ;
pub use ;
pub use Lock;
pub use LockManager;
pub use ;
pub use ;
pub use ;