Package org.onosproject.cluster
Interface LeadershipAdminService
-
public interface LeadershipAdminService
Interface for administratively manipulating leadership assignments.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Map<String,Leadership>
getLeaderBoard()
Returns the current leader board.boolean
promoteToTopOfCandidateList(String topic, NodeId nodeId)
Make a node to be the next leader by promoting it to top of candidate list.boolean
transferLeadership(String topic, NodeId nodeId)
Attempts to assign leadership for a topic to a specified node.void
unregister(NodeId nodeId)
Removes all active leadership registrations for a given node.
-
-
-
Method Detail
-
transferLeadership
boolean transferLeadership(String topic, NodeId nodeId)
Attempts to assign leadership for a topic to a specified node.- Parameters:
topic
- leadership topicnodeId
- identifier of the node to be made leader- Returns:
- true is the transfer was successfully executed. This method returns
false
ifnodeId
is not one of the candidates for for the topic.
-
promoteToTopOfCandidateList
boolean promoteToTopOfCandidateList(String topic, NodeId nodeId)
Make a node to be the next leader by promoting it to top of candidate list.- Parameters:
topic
- leadership topicnodeId
- identifier of node to be next leader- Returns:
true
if nodeId is now the top candidate. This method returnsfalse
ifnodeId
is not one of the candidates for for the topic.
-
unregister
void unregister(NodeId nodeId)
Removes all active leadership registrations for a given node.This method will also evict the node from leaderships that it currently owns.
- Parameters:
nodeId
- node identifier
-
getLeaderBoard
Map<String,Leadership> getLeaderBoard()
Returns the current leader board.- Returns:
- mapping from topic to leadership info.
-
-