Package org.onosproject.cluster
Interface LeadershipStore
-
- All Superinterfaces:
Store<LeadershipEvent,LeadershipStoreDelegate>
public interface LeadershipStore extends Store<LeadershipEvent,LeadershipStoreDelegate>
Store interface for managingLeadershipServicestate.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description LeadershipaddRegistration(String topic)Adds registration for the local instance to be part of the leadership contest for topic.LeadershipgetLeadership(String topic)Returns the current leadership for topic.Map<String,Leadership>getLeaderships()Return current leadership for all topics.booleanmakeTopCandidate(String topic, NodeId nodeId)Attempts to make a node the top candidate.booleanmoveLeadership(String topic, NodeId toNodeId)Updates state so that given node is leader for a topic.voidremoveRegistration(String topic)Unregisters the local instance from leadership contest for topic.voidremoveRegistration(NodeId nodeId)Unregisters an instance from all leadership contests.-
Methods inherited from interface org.onosproject.store.Store
hasDelegate, setDelegate, unsetDelegate
-
-
-
-
Method Detail
-
addRegistration
Leadership addRegistration(String topic)
Adds registration for the local instance to be part of the leadership contest for topic.- Parameters:
topic- leadership topic- Returns:
- Updated leadership after operation is completed
-
removeRegistration
void removeRegistration(String topic)
Unregisters the local instance from leadership contest for topic.- Parameters:
topic- leadership topic
-
removeRegistration
void removeRegistration(NodeId nodeId)
Unregisters an instance from all leadership contests.- Parameters:
nodeId- node identifier
-
moveLeadership
boolean moveLeadership(String topic, NodeId toNodeId)
Updates state so that given node is leader for a topic.- Parameters:
topic- leadership topictoNodeId- identifier of the desired leader- Returns:
trueif the transfer succeeded;falseotherwise. This method can returnfalseif the node is not registered for the topic
-
makeTopCandidate
boolean makeTopCandidate(String topic, NodeId nodeId)
Attempts to make a node the top candidate.- Parameters:
topic- leadership topicnodeId- node identifier- Returns:
trueif the specified node is now the top candidate. This method will returnfalseif the node is not registered for the topic
-
getLeadership
Leadership getLeadership(String topic)
Returns the current leadership for topic.- Parameters:
topic- leadership topic- Returns:
- current leadership
-
getLeaderships
Map<String,Leadership> getLeaderships()
Return current leadership for all topics.- Returns:
- topic to leadership mapping
-
-