use Future;
use LockError;
/// A single lock instance whose operations yield to the executor instead of
/// blocking the OS thread.
///
/// Every operation is asynchronous because a lock may be backed by I/O: the
/// in-memory lock resolves immediately, but a durable lock (e.g. the SQLx
/// lease-table [`PostgresLock`](super::PostgresLock) /
/// [`SqliteLock`](super::SqliteLock)) acquires and releases by talking to the
/// database. `lock` awaits until the lock becomes free; `try_lock` attempts a
/// single non-blocking acquire; `unlock` releases the lock and (for in-memory)
/// wakes any waiters so they can re-contend.
///
/// All returned futures are `Send` so an async `QueuedRepository` built on this
/// lock keeps its repository futures `Send` (required by the async repo traits).