Gust.DBLocker behaviour (gust v0.1.26)

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

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

Summary

Types

Function to execute if the lock is acquired

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

Types

attempt_result_fun()

@type attempt_result_fun() :: (boolean() -> any())

Function to execute if the lock is acquired

lock_key()

@type lock_key() :: term()

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

Callbacks

try_lock(lock_key, attempt_result_fun)

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

Functions

try_lock(lock_key, attempt_result)

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