public final class MastershipInfo extends Object
Constructor and Description |
---|
MastershipInfo() |
MastershipInfo(long term,
Optional<NodeId> master,
com.google.common.collect.ImmutableMap<NodeId,MastershipRole> roles) |
Modifier and Type | Method and Description |
---|---|
List<NodeId> |
backups()
Returns a sorted list of standby nodes.
|
boolean |
equals(Object object) |
MastershipRole |
getRole(NodeId nodeId)
Returns the current role for the given node.
|
List<NodeId> |
getRoles(MastershipRole role)
Returns the list of nodes with the given role.
|
int |
hashCode() |
Optional<NodeId> |
master()
Returns the current master.
|
long |
term()
Returns the mastership term.
|
String |
toString() |
public MastershipInfo()
public MastershipInfo(long term, Optional<NodeId> master, com.google.common.collect.ImmutableMap<NodeId,MastershipRole> roles)
public long term()
public List<NodeId> backups()
public List<NodeId> getRoles(MastershipRole role)
role
- the role by which to filter nodespublic MastershipRole getRole(NodeId nodeId)
nodeId
- the node for which to return the current role