Package org.onosproject.mastership
Class MastershipInfo
- java.lang.Object
-
- org.onosproject.mastership.MastershipInfo
-
public final class MastershipInfo extends Object
Mastership info.
-
-
Constructor Summary
Constructors Constructor Description MastershipInfo()
MastershipInfo(long term, Optional<NodeId> master, com.google.common.collect.ImmutableMap<NodeId,MastershipRole> roles)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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()
-
-
-
Constructor Detail
-
MastershipInfo
public MastershipInfo()
-
MastershipInfo
public MastershipInfo(long term, 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
-
backups
public List<NodeId> backups()
Returns a sorted list of standby nodes.- Returns:
- a sorted list of standby nodes
-
getRoles
public 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
-
-