Expand description
Resource lock registry with full lifecycle.
Provides acquire/release/heartbeat/TTL-expire/startup-cleanup for any scoped resource operation, wired to the typed event system from task 9.
§OCP contract
- Adding a new scope dimension: add one optional field to
LockScopeand one intersection arm inLockScope::intersects. No existing arms change. - Adding a new release reason: add one
ReleaseReasonvariant. Serializes automatically viarename_all = "snake_case". - Heartbeat loop works for any scope — it is a generic background task that
calls
release_staleon anyLockRegistry. - Event emission uses
events::emit— no string literals scattered at call sites.
Modules§
- lifecycle
- Background lifecycle tasks for the lock registry.
Structs§
- Lock
Acquired Payload - LockId
- Opaque lock identifier — UUID v4 minted on
acquire. - Lock
Registry - Thread-safe in-memory registry of active resource locks.
- Lock
Registry Handle Arc<LockRegistry>wrapped for Tauri’sStatesystem.- Lock
Released Payload - Lock
Scope - Hierarchical scope key for a resource lock.
- Registry
Inner 🔒 - Inner registry state — separated so tests can poke at it directly.
- Resource
Lock - An active resource lock held by an operation.
Enums§
- Release
Reason - Why a lock was released.
Functions§
- emit_
acquired - Emit
lock:acquiredforlock. - emit_
released - Emit
lock:releasedfor a lock that was removed withreason.