# `Gust.DBLocker`

Behaviour for acquiring a DB-backed lock (e.g. Postgres advisory lock).

Implementations must return `true` if the lock was acquired, `false` otherwise.

# `attempt_result_fun`

```elixir
@type attempt_result_fun() :: (boolean() -&gt; any())
```

Function to execute if the lock is acquired

# `lock_key`

```elixir
@type lock_key() :: term()
```

Lock identifier (e.g. integer key, string name, tuple, etc.)

# `try_lock`

```elixir
@callback try_lock(lock_key(), attempt_result_fun()) :: boolean()
```

# `try_lock`

```elixir
@spec try_lock(lock_key(), attempt_result_fun()) :: boolean()
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
