Package org.onosproject.mastership
Class MastershipInfo
- java.lang.Object
-
- org.onosproject.mastership.MastershipInfo
-
public final class MastershipInfo extends java.lang.ObjectMastership info.
-
-
Constructor Summary
Constructors Constructor Description MastershipInfo()MastershipInfo(long term, java.util.Optional<NodeId> master, com.google.common.collect.ImmutableMap<NodeId,MastershipRole> roles)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<NodeId>backups()Returns a sorted list of standby nodes.booleanequals(java.lang.Object object)MastershipRolegetRole(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.inthashCode()java.util.Optional<NodeId>master()Returns the current master.longterm()Returns the mastership term.java.lang.StringtoString()
-
-
-
Constructor Detail
-
MastershipInfo
public MastershipInfo()
-
MastershipInfo
public MastershipInfo(long term, java.util.Optional<NodeId> master, com.google.common.collect.ImmutableMap<NodeId,MastershipRole> roles)
-
-
Method Detail
-
term
public long term()
Returns the mastership term.- Returns:
- the mastership term
-
master
public java.util.Optional<NodeId> master()
Returns the current master.- Returns:
- the current master
-
backups
public java.util.List<NodeId> backups()
Returns a sorted list of standby nodes.- Returns:
- a sorted list of standby nodes
-
getRoles
public java.util.List<NodeId> getRoles(MastershipRole role)
Returns the list of nodes with the given role.- Parameters:
role- the role by which to filter nodes- Returns:
- an immutable list of nodes with the given role sorted in priority order
-
getRole
public MastershipRole getRole(NodeId nodeId)
Returns the current role for the given node.- Parameters:
nodeId- the node for which to return the current role- Returns:
- the current role for the given node
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-