public class PrimaryTerm extends Object
The primary term represents a single instance of a unique primary for a partition. Every term must have a unique
term() number, and term numbers must be monotonically increasing, though not necessarily sequential.
The candidates() should either list the set of non-primary members in order of priority
such that the default backups(int) implementation can properly select backups or else backups(int)
should be overridden.
| Constructor and Description |
|---|
PrimaryTerm(long term,
GroupMember primary,
List<GroupMember> candidates) |
| Modifier and Type | Method and Description |
|---|---|
List<GroupMember> |
backups(int numBackups)
Returns an ordered list of backup members.
|
List<GroupMember> |
candidates()
Returns the list of members.
|
boolean |
equals(Object object) |
int |
hashCode() |
GroupMember |
primary()
Returns the primary member.
|
long |
term()
Returns the primary term number.
|
String |
toString() |
public PrimaryTerm(long term,
GroupMember primary,
List<GroupMember> candidates)
public long term()
The term number is monotonically increasing and guaranteed to be unique for a given primary(). No two
primaries may ever have the same term.
public GroupMember primary()
The primary is the node through which writes are replicated in the primary-backup protocol.
public List<GroupMember> candidates()
The candidate list represents the list of members that are participating in the election but not necessarily in
replication. This list is used to select a set of backups based on a primitive configuration.
public List<GroupMember> backups(int numBackups)
The backups are populated from the set of candidates() based on order and group information. The list of
backups is guaranteed not to contain any duplicate MemberGroups unless not enough groups exist to
satisfy the number of backups.
numBackups - the number of backups to returnCopyright © 2013–2018. All rights reserved.