public final class MastershipInfo
extends java.lang.Object
Constructor and Description |
---|
MastershipInfo() |
MastershipInfo(long term,
java.util.Optional<NodeId> master,
com.google.common.collect.ImmutableMap<NodeId,MastershipRole> roles) |
Modifier and Type | Method and Description |
---|---|
java.util.List<NodeId> |
backups()
Returns a sorted list of standby nodes.
|
boolean |
equals(java.lang.Object object) |
MastershipRole |
getRole(NodeId nodeId)
Returns the current role for the given node.
|
java.util.List<NodeId> |
getRoles(MastershipRole role)
Returns the list of nodes with the given role.
|
int |
hashCode() |
java.util.Optional<NodeId> |
master()
Returns the current master.
|
long |
term()
Returns the mastership term.
|
java.lang.String |
toString() |
public MastershipInfo()
public MastershipInfo(long term, java.util.Optional<NodeId> master, com.google.common.collect.ImmutableMap<NodeId,MastershipRole> roles)
public long term()
public java.util.Optional<NodeId> master()
public java.util.List<NodeId> backups()
public java.util.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 rolepublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object