Madan Jampani
Committed by Gerrit Code Review

Update StorageManager.getPartitionInfo() to delegate to PartitionAdminService.partitionInfo()

Change-Id: I20aa9f986874e6ac7c602b8ae58b7c7b0df9a835
......@@ -26,6 +26,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.collect.Ordering;
/**
* Command to list the database partitions in the system.
......@@ -48,7 +49,7 @@ public class PartitionsListCommand extends AbstractShellCommand {
for (PartitionInfo info : partitionInfo) {
boolean first = true;
for (String member : info.members()) {
for (String member : Ordering.natural().sortedCopy(info.members())) {
if (first) {
print(FMT, info.name(), info.term(), member,
member.equals(info.leader()) ? "*" : "");
......
......@@ -37,6 +37,7 @@ import org.onosproject.persistence.PersistenceService;
import org.onosproject.store.cluster.messaging.ClusterCommunicationService;
import org.onosproject.store.primitives.DistributedPrimitiveCreator;
import org.onosproject.store.primitives.MapUpdate;
import org.onosproject.store.primitives.PartitionAdminService;
import org.onosproject.store.primitives.PartitionService;
import org.onosproject.store.primitives.TransactionId;
import org.onosproject.store.serializers.KryoNamespaces;
......@@ -57,7 +58,6 @@ import org.onosproject.store.service.StorageService;
import org.onosproject.store.service.TransactionContextBuilder;
import org.slf4j.Logger;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.util.concurrent.Futures;
......@@ -82,6 +82,9 @@ public class StorageManager implements StorageService, StorageAdminService {
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected PartitionService partitionService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected PartitionAdminService partitionAdminService;
private final Supplier<TransactionId> transactionIdGenerator =
() -> TransactionId.from(UUID.randomUUID().toString());
private DistributedPrimitiveCreator basePrimitiveCreator;
......@@ -198,7 +201,7 @@ public class StorageManager implements StorageService, StorageAdminService {
@Override
public List<PartitionInfo> getPartitionInfo() {
return Lists.newArrayList();
return partitionAdminService.partitionInfo();
}
@Override
......@@ -217,4 +220,4 @@ public class StorageManager implements StorageService, StorageAdminService {
return new MapInfo(name, map.size());
}).collect(Collectors.toList());
}
}
\ No newline at end of file
}
......