Package io.atomix.primitive.partition
Interface PrimaryElection
- All Superinterfaces:
io.atomix.utils.event.ListenerService<PrimaryElectionEvent,PrimaryElectionEventListener>
- All Known Subinterfaces:
ManagedPrimaryElection
public interface PrimaryElection extends io.atomix.utils.event.ListenerService<PrimaryElectionEvent,PrimaryElectionEventListener>
Partition primary election.
A primary election is used to elect a primary and backups for a single partition. To enter a primary election
for a partition, a node must call the enter(GroupMember) method. Once an election is complete, the
PrimaryTerm can be read via getTerm().
The prioritization of candidates within a primary election is unspecified.
-
Method Summary
Modifier and Type Method Description CompletableFuture<PrimaryTerm>enter(GroupMember member)Enters the primary election.CompletableFuture<PrimaryTerm>getTerm()Returns the current term.
-
Method Details
-
enter
Enters the primary election.When entering a primary election, the provided
GroupMemberwill be added to the election's candidate list. The returned term is representative of the term after the member joins the election. Thus, if the joining member is immediately elected primary, the returned term should reflect that.- Parameters:
member- the member to enter the election- Returns:
- the current term
-
getTerm
CompletableFuture<PrimaryTerm> getTerm()Returns the current term.The term is representative of the current primary, candidates, and backups in the primary election.
- Returns:
- the current term
-