Skip to main content

Module locks

Module locks 

Source
Expand description

Advisory locks (PG-compatible pg_advisory_* family).

Connection-scoped, reentrant-safe-only-through-explicit-unlock. Backed by a single global mutex + condition variable — fine for the embedded/single-node workload RedDB targets today. If it ever becomes a hotspot, split into a DashMap<i64, Mutex<_>>.

Ownership is tracked by ConnId (the same id savepoints use). release_all(conn) drops every lock a connection holds — call it on connection close so crashed sessions don’t wedge other callers forever.

Structs§

AdvisoryLocks
Process-global table. One per runtime is enough; lock ids are a shared namespace across connections by PG semantics.

Functions§

global
Process-wide singleton accessor. Lazy-init on first call.

Type Aliases§

ConnId