public interface LeadershipService extends ListenerService<LeadershipEvent,LeadershipEventListener>
| Modifier and Type | Method and Description |
|---|---|
Map<String,List<NodeId>> |
getCandidates()
Returns the candidates for all known topics.
|
List<NodeId> |
getCandidates(String path)
Returns the candidates for a given topic.
|
NodeId |
getLeader(String path)
Returns the current leader for the topic.
|
Map<String,Leadership> |
getLeaderBoard()
Returns the current leader board.
|
Leadership |
getLeadership(String path)
Returns the current leadership info for the topic.
|
boolean |
makeTopCandidate(String path,
NodeId nodeId)
Moves the specified nodeId to the top of the candidates list for the topic.
|
Set<String> |
ownedTopics(NodeId nodeId)
Returns the set of topics owned by the specified node.
|
CompletableFuture<Leadership> |
runForLeadership(String path)
Joins the leadership contest.
|
boolean |
stepdown(String path)
If the local nodeId is the leader for specified topic, this method causes it to
step down temporarily from leadership.
|
CompletableFuture<Void> |
withdraw(String path)
Withdraws from a leadership contest.
|
addListener, removeListenerNodeId getLeader(String path)
path - topicLeadership getLeadership(String path)
path - topicSet<String> ownedTopics(NodeId nodeId)
nodeId - node Id.CompletableFuture<Leadership> runForLeadership(String path)
path - topic for which this controller node wishes to be a leaderLeadership futureCompletableFuture<Void> withdraw(String path)
path - topic for which this controller node no longer wishes to be a leaderboolean stepdown(String path)
The node will continue to be in contention for leadership and can potentially become the leader again if and when it becomes the highest priority candidate
If the local nodeId is not the leader, this method will make no changes and simply return false.
path - topic for which this controller node should give up leadershipboolean makeTopCandidate(String path, NodeId nodeId)
If the node is not a candidate for this topic, this method will be a noop.
path - leadership topicnodeId - nodeId to make the top candidateMap<String,Leadership> getLeaderBoard()
Map<String,List<NodeId>> getCandidates()
Copyright © 2015. All rights reserved.