Paxtor.Lock (paxtor v0.3.0)

The module Paxtor.Lock is the home of the cluster-wide locking mechanism.

See Paxtor.lock for futher details.

This module can also be used in via tuples as a registry to reference the pid of a process that owns a lock.

iex> Paxtor.lock(:some_key)
iex> Paxtor.whereis({:via, Paxtor.Lock, :some_key}) == self()
true
iex> Paxtor.Lock.whereis_name(:some_key) == self()
true

Summary

Functions

This function returns a :via tuple that uses the current module as the regitry module. The purpose of this is to allow processes to get the pid of a process holding a lock.

This is the API function that makes it possible to use Elixir.Paxtor.Lock in :via tuples. You can also call this function directly to get the pid of the process currenty associated with a lock.

Functions

lock(key, opts)

via(key)

This function returns a :via tuple that uses the current module as the regitry module. The purpose of this is to allow processes to get the pid of a process holding a lock.

iex> key |> Paxtor.Lock.via() |> Paxtor.whereis()

whereis_name(key)

This is the API function that makes it possible to use Elixir.Paxtor.Lock in :via tuples. You can also call this function directly to get the pid of the process currenty associated with a lock.