Use similar return types for LeadershipService.getCandidates() and LeadershipService.getCandidates(topic)
Change-Id: I9aaea9dfa14e4e9916103a61c8e59290ad656aa7
diff --git a/core/api/src/main/java/org/onosproject/cluster/LeadershipService.java b/core/api/src/main/java/org/onosproject/cluster/LeadershipService.java
index 5857154..44d84db 100644
--- a/core/api/src/main/java/org/onosproject/cluster/LeadershipService.java
+++ b/core/api/src/main/java/org/onosproject/cluster/LeadershipService.java
@@ -15,9 +15,9 @@
*/
package org.onosproject.cluster;
+import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.List;
/**
* Service for leader election.
@@ -76,9 +76,9 @@
/**
* Returns the candidates for all known topics.
*
- * @return A mapping from topics to up-to-date candidate info.
+ * @return A mapping from topics to corresponding list of candidates.
*/
- Map<String, Leadership> getCandidates();
+ Map<String, List<NodeId>> getCandidates();
/**
* Returns the candidates for a given topic.
diff --git a/core/api/src/test/java/org/onosproject/cluster/LeadershipServiceAdapter.java b/core/api/src/test/java/org/onosproject/cluster/LeadershipServiceAdapter.java
index 3c503bb..02742d4 100644
--- a/core/api/src/test/java/org/onosproject/cluster/LeadershipServiceAdapter.java
+++ b/core/api/src/test/java/org/onosproject/cluster/LeadershipServiceAdapter.java
@@ -65,7 +65,7 @@
}
@Override
- public Map<String, Leadership> getCandidates() {
+ public Map<String, List<NodeId>> getCandidates() {
return null;
}
diff --git a/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/HazelcastLeadershipService.java b/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/HazelcastLeadershipService.java
index 220a28d..ddd0b9e 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/HazelcastLeadershipService.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/HazelcastLeadershipService.java
@@ -576,7 +576,7 @@
}
@Override
- public Map<String, Leadership> getCandidates() {
+ public Map<String, List<NodeId>> getCandidates() {
return null;
}
diff --git a/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/DistributedLeadershipManager.java b/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/DistributedLeadershipManager.java
index 6f498ff..58fd3eb 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/DistributedLeadershipManager.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/DistributedLeadershipManager.java
@@ -166,8 +166,8 @@
}
@Override
- public Map<String, Leadership> getCandidates() {
- return ImmutableMap.copyOf(candidateBoard);
+ public Map<String, List<NodeId>> getCandidates() {
+ return Maps.toMap(candidateBoard.keySet(), this::getCandidates);
}
@Override
diff --git a/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleLeadershipManager.java b/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleLeadershipManager.java
index 3f05480..5f7bb92 100644
--- a/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleLeadershipManager.java
+++ b/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleLeadershipManager.java
@@ -111,7 +111,7 @@
}
@Override
- public Map<String, Leadership> getCandidates() {
+ public Map<String, List<NodeId>> getCandidates() {
return null;
}