elector_strategy_behaviour behaviour (elector v0.3.2)
View SourceDefines the base behaviour for election strategies.
Summary
Functions
Returns a list of nodes that are eligible to become the leader.
Starts the election process by triggering the strategy modules elect() function. The election implementation should only contain the logic for selecting the leader node and returning the leader node name. The elect/0 function is triggered on all nodes automatically by the elector application. This means the strategy implementation does not have to worry about starting the election on all nodes.
Types
Callbacks
-callback elect(CandidateNodes :: candidate_nodes()) -> Leader :: leader().
Functions
-spec candidate_nodes() -> CandidateNodes :: candidate_nodes().
Returns a list of nodes that are eligible to become the leader.
-spec elect() -> Leader :: leader().
Starts the election process by triggering the strategy modules elect() function. The election implementation should only contain the logic for selecting the leader node and returning the leader node name. The elect/0 function is triggered on all nodes automatically by the elector application. This means the strategy implementation does not have to worry about starting the election on all nodes.