Package org.onosproject.cluster
Interface LeadershipStore
-
- All Superinterfaces:
Store<LeadershipEvent,LeadershipStoreDelegate>
public interface LeadershipStore extends Store<LeadershipEvent,LeadershipStoreDelegate>
Store interface for managingLeadershipService
state.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Leadership
addRegistration(java.lang.String topic)
Adds registration for the local instance to be part of the leadership contest for topic.Leadership
getLeadership(java.lang.String topic)
Returns the current leadership for topic.java.util.Map<java.lang.String,Leadership>
getLeaderships()
Return current leadership for all topics.boolean
makeTopCandidate(java.lang.String topic, NodeId nodeId)
Attempts to make a node the top candidate.boolean
moveLeadership(java.lang.String topic, NodeId toNodeId)
Updates state so that given node is leader for a topic.void
removeRegistration(java.lang.String topic)
Unregisters the local instance from leadership contest for topic.void
removeRegistration(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(java.lang.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(java.lang.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(java.lang.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:
true
if the transfer succeeded;false
otherwise. This method can returnfalse
if the node is not registered for the topic
-
makeTopCandidate
boolean makeTopCandidate(java.lang.String topic, NodeId nodeId)
Attempts to make a node the top candidate.- Parameters:
topic
- leadership topicnodeId
- node identifier- Returns:
true
if the specified node is now the top candidate. This method will returnfalse
if the node is not registered for the topic
-
getLeadership
Leadership getLeadership(java.lang.String topic)
Returns the current leadership for topic.- Parameters:
topic
- leadership topic- Returns:
- current leadership
-
getLeaderships
java.util.Map<java.lang.String,Leadership> getLeaderships()
Return current leadership for all topics.- Returns:
- topic to leadership mapping
-
-