public interface LeadershipStore extends Store<LeadershipEvent,LeadershipStoreDelegate>
LeadershipService
state.Modifier and Type | Method and Description |
---|---|
Leadership |
addRegistration(String topic)
Adds registration for the local instance to be part of the leadership contest for topic.
|
Leadership |
getLeadership(String topic)
Returns the current leadership for topic.
|
Map<String,Leadership> |
getLeaderships()
Return current leadership for all topics.
|
boolean |
makeTopCandidate(String topic,
NodeId nodeId)
Attempts to make a node the top candidate.
|
boolean |
moveLeadership(String topic,
NodeId toNodeId)
Updates state so that given node is leader for a topic.
|
void |
removeRegistration(NodeId nodeId)
Unregisters an instance from all leadership contests.
|
void |
removeRegistration(String topic)
Unregisters the local instance from leadership contest for topic.
|
hasDelegate, setDelegate, unsetDelegate
Leadership addRegistration(String topic)
topic
- leadership topicvoid removeRegistration(String topic)
topic
- leadership topicvoid removeRegistration(NodeId nodeId)
nodeId
- node identifierboolean moveLeadership(String topic, NodeId toNodeId)
topic
- leadership topictoNodeId
- identifier of the desired leadertrue
if the transfer succeeded; false
otherwise.
This method can return false
if the node is not registered for the topicboolean makeTopCandidate(String topic, NodeId nodeId)
topic
- leadership topicnodeId
- node identifiertrue
if the specified node is now the top candidate.
This method will return false
if the node is not registered for the topicLeadership getLeadership(String topic)
topic
- leadership topicMap<String,Leadership> getLeaderships()