AsyncLeaderElector APIs in support for mastership balancing
Change-Id: Ia235c6a18c54490dc49ca13e2caebf70b750dbc7
diff --git a/core/api/src/main/java/org/onosproject/store/service/LeaderElector.java b/core/api/src/main/java/org/onosproject/store/service/LeaderElector.java
index b37d1c4..f4257be 100644
--- a/core/api/src/main/java/org/onosproject/store/service/LeaderElector.java
+++ b/core/api/src/main/java/org/onosproject/store/service/LeaderElector.java
@@ -58,6 +58,25 @@
boolean anoint(String topic, NodeId nodeId);
/**
+ * Attempts to promote a node to top of candidate list.
+ *
+ * @param topic leadership topic
+ * @param nodeId instance identifier of the new top candidate
+ * @return {@code true} if node is now the top candidate. This operation can fail (i.e. return
+ * {@code false}) if the node is not registered to run for election for the topic.
+ */
+ boolean promote(String topic, NodeId nodeId);
+
+ /**
+ * Attempts to evict a node from all leadership elections it is registered for.
+ * <p>
+ * If the node the current leader for a topic, this call will force the next candidate (if one exists)
+ * to be promoted to leadership.
+ * @param nodeId node instance identifier
+ */
+ void evict(NodeId nodeId);
+
+ /**
* Returns the {@link Leadership} for the specified topic.
* @param topic leadership topic
* @return current Leadership state of the topic