pub fn lock_databases_session<I, S>(names: I) -> Result<String>Expand description
Acquire locks for one or more databases and return an opaque session ID to hold those locks until explicitly released. This is suitable for use over an IPC boundary where a separate “database process” manages locks on behalf of clients.
- Locks are acquired in a stable sorted order to avoid deadlocks.
- If any lock acquisition fails, all acquired locks are released and an error is returned.
- Re-entrant calls from the same thread are supported by
ResourceLock.
Returns a session_id string which must be used to release the locks.
Example usage from an IPC handler:
let session = lock_databases_session(&[“users/auth”, “users/uuids”])?;
// … do work …
unlock_databases_session(&session)?;