View Source Cloister (cloister v0.18.0)
Cloister is a consensus helper for clusters.
It is designed to be a configurable drop-in for transparent cluster support.
Supported options
:otp_app(atom/0) - OTP application this cloister runs for. The default value is:cloister.:sentry- Required. The way the cloister knows how to build cluster; might be a service name or a node list. E. g.:"cloister.local"or~w[c1@127.0.0.1 c2@127.0.0.1]a. Default[node()].:consensus(non_neg_integer/0) - Required. Number of nodes to consider consensus. The default value is1.:listener(atom/0) - Listener to be called when the ring is changed. The default value isCloister.Listener.Default.:additional_modules- Additional modules to include intoCloister.Manager’s supervision tree.:ring(atom/0) - The name of theHashRingto be used. If set, the HashRing is assumed to be managed externally.:manager(non-emptykeyword/0) - Set of options to configureCloister.Managerwhen started in a supervision tree.:monitor_opts(non-emptykeyword/0) - FineCloister.Monitor’s tuning.:name(atom/0) - Required. Name of theMonitorprocess.
:loopback?(boolean/0) - Use loopback interface in FQ node name? The default value isfalse.:magic?- When false, allows to avoid node reinitialization The default value is:longnames.
Summary
Functions
Returns a specification to start this module under a supervisor.
Returns true if the hashring points to this node for the term given, false otherwise
Applies the function given as m, f, a on all the nodes given as a first parameter.
Returns the ring from current node cloister monitor state
Returns {:ok, node()} if the cloister has the only one sentry, or {:error, [node()]
with the list of nodes fancied themselves a sentry.
See Cloister.Monitor.siblings!/0.
See Cloister.Monitor.siblings!/1.
The state of this cloister.
Retrieves states of all the nodes in the cloister.
Returns who would be chosen by a hash ring for the term in the group given
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Returns true if the hashring points to this node for the term given, false otherwise
Applies the function given as m, f, a on all the nodes given as a first parameter.
If no nodes are given, it defaults to Cloister.siblings/0.
@spec ring() :: atom()
Returns the ring from current node cloister monitor state
Returns {:ok, node()} if the cloister has the only one sentry, or {:error, [node()]
with the list of nodes fancied themselves a sentry.
See Cloister.Monitor.siblings!/0.
See Cloister.Monitor.siblings!/1.
@spec state(monitor :: module()) :: nil | Cloister.Monitor.t()
The state of this cloister.
This function returns the value only after Cloister.Monitor has been started
%Cloister.Monitor{
otp_app: :rates_blender,
consensus: 3,
listener: MyApp.Cloister.Listener,
monitor: Cloister.Monitor,
started_at: ~U[2024-05-31 05:37:40.238027Z],
alive?: true,
clustered?: true,
sentry?: false,
ring: :my_app
}
@spec states(monitor :: module()) :: {[Cloister.Monitor.t()], [node()]}
Retrieves states of all the nodes in the cloister.
@spec whois(group :: atom(), term :: any()) :: node() | {:error, {:invalid_ring, :no_nodes}} | {:error, {:not_our_ring, atom()}}
Returns who would be chosen by a hash ring for the term in the group given