This is the main API module.
This module can be used to manually start new election or to check
if the current node is the leader. The elector
application has
to be started before calling any of these functions. To start the
elector
add it to your supervision tree or start it manually.
When elector
is started it will handle the elections automatically
startup and when new node joins/leaves erlang the cluster.
The elections are started automatically when new node joins the
cluster or old one leaves. It is possible to start an election
manually by calling elector:elect/0
or elect_sync/0
.
elect/0 | Starts an election asynchronously. |
elect_sync/0 | Starts an election synchronously. |
get_leader/0 | Returns the current leader node's machine name. |
is_leader/0 | Returns boolean true this node is the leader or false if not. |
elect() -> {ok, election_started} | {error, quorum_size_not_met}
Starts an election asynchronously.
elect_sync() -> {ok, election_finished} | {error, term()}
Starts an election synchronously.
get_leader() -> {ok, node()} | {error, leader_node_not_set}
Returns the current leader node's machine name.
is_leader() -> {ok, boolean()} | {error, leader_node_not_set}
Returns boolean true this node is the leader or false if not.
Generated by EDoc