View Source Cloister (cloister v0.17.3)

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 is 1.

  • :listener (atom/0) - Listener to be called when the ring is changed. The default value is Cloister.Listener.Default.

  • :additional_modules - Additional modules to include into Cloister.Manager’s supervision tree.

  • :ring (atom/0) - The name of the HashRing to be used. If set, the HashRing is assumed to be managed externally.

  • :manager (non-empty keyword/0) - Set of options to configure Cloister.Manager when started in a supervision tree.

    • :name (atom/0) - Name of the Manager process.

    • :state (non-empty keyword/0) - The parameters to configure the Manager ouside of Cloister application.

      • :otp_app (atom/0) - Required.

      • :additional_modules

  • :monitor_opts (non-empty keyword/0) - Fine Cloister.Monitor’s tuning.

    • :name (atom/0) - Required. Name of the Monitor process.
  • :loopback? (boolean/0) - Use loopback interface in FQ node name? The default value is false.

  • :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

See Cloister.Monitor.siblings!/0.

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.

@spec mine?(term :: any()) :: boolean() | {:error, :no_such_ring}

Returns true if the hashring points to this node for the term given, false otherwise

Link to this function

multiapply(nodes \\ nil, m, f, a)

View Source
@spec multiapply(nil | [node()], module(), atom(), list()) :: any()

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.

Link to this function

multicall(name, request)

View Source

See Cloister.Node.multicall/2.

Link to this function

multicall(nodes, name, request)

View Source

See Cloister.Node.multicall/3.

Link to this function

multicast(name, request)

View Source

See Cloister.Node.multicast/2.

Link to this function

multicast(nodes, name, request)

View Source

See Cloister.Node.multicast/3.

@spec ring() :: atom()

Returns the ring from current node cloister monitor state

See Cloister.Monitor.siblings/0.

See Cloister.Monitor.siblings!/0.

See Cloister.Monitor.state/0.

Link to this function

whois(group \\ nil, term)

View Source
@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