Relocker.Locker behaviour
A module for acquiring a lock, extending it and releasing the lock.
Summary
Functions
Extend a lock. When successful a new lock struct is returned and that should be used for subsequent calls to this API
Try to acquire a lock. Returns {:ok, %Lock{}}
if successful, if not :error
is returned
Read lock with name lock_name
. Returns {:ok, %Lock{}}
if successful
Reset, meant to be used for testing only
Release a lock
Types
lock_name :: binary | atom
Functions
Extend a lock. When successful a new lock struct is returned and that should be used for subsequent calls to this API.
Try to acquire a lock. Returns {:ok, %Lock{}}
if successful, if not :error
is returned
Read lock with name lock_name
. Returns {:ok, %Lock{}}
if successful.
Callbacks
Specs
extend(lock :: Relocker.Lock.t, current_time :: integer) ::
{:ok, Relocker.Lock.t} |
:error
Specs
lock(name :: lock_name, metadata :: any, lease_time_secs :: integer, current_time :: integer) ::
{:ok, Relocker.Lock.t} |
:error
Specs
read(name :: lock_name, current_time :: integer) ::
{:ok, Relocker.Lock.t} |
:error
Specs
unlock(lock :: Relocker.Lock.t, current_time :: integer) ::
:ok |
:error