Madan Jampani
Committed by Gerrit Code Review

Minor fixes in DatabaseProxy

Change-Id: I2e1ac92a80f652acc324337383dba526e510f353
......@@ -45,7 +45,7 @@ public interface DatabaseProxy<K, V> {
CompletableFuture<Map<String, Long>> counters();
/**
*
* Returns the number of entries in map.
* @param mapName map name
* @return A completable future to be completed with the result once complete.
*/
......
......@@ -18,8 +18,6 @@ package org.onosproject.store.consistent.impl;
import java.nio.ByteBuffer;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.onlab.util.KryoNamespace;
import org.onosproject.cluster.NodeId;
import org.onosproject.store.serializers.KryoNamespaces;
......@@ -72,8 +70,6 @@ public class DatabaseSerializer extends SerializerConfig {
.register(Versioned.class)
.register(DatabaseUpdate.class)
.register(DatabaseUpdate.Type.class)
.register(Pair.class)
.register(ImmutablePair.class)
.register(Result.class)
.register(UpdateResult.class)
.register(Result.Status.class)
......
......@@ -51,7 +51,7 @@ public interface DatabaseState<K, V> {
Map<String, Long> counters();
@Query
int size(String mapName);
int mapSize(String mapName);
@Query
boolean mapIsEmpty(String mapName);
......
......@@ -27,7 +27,6 @@ import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;
import java.util.Set;
import org.apache.commons.lang3.tuple.Pair;
import org.onosproject.cluster.NodeId;
import org.onosproject.store.service.DatabaseUpdate;
import org.onosproject.store.service.Transaction;
......@@ -112,7 +111,7 @@ public class DefaultDatabaseState implements DatabaseState<String, byte[]> {
}
@Override
public int size(String mapName) {
public int mapSize(String mapName) {
return getMap(mapName).size();
}
......@@ -186,7 +185,7 @@ public class DefaultDatabaseState implements DatabaseState<String, byte[]> {
return ImmutableSet.copyOf(getMap(mapName)
.entrySet()
.stream()
.map(entry -> Pair.of(entry.getKey(), entry.getValue()))
.map(entry -> Maps.immutableEntry(entry.getKey(), entry.getValue()))
.collect(Collectors.toSet()));
}
......
......@@ -22,8 +22,6 @@ import java.util.Collection;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.onlab.util.KryoNamespace;
import org.onosproject.store.serializers.KryoNamespaces;
import org.onosproject.store.service.AsyncConsistentMap;
......@@ -47,8 +45,6 @@ public class TransactionManager {
.register(DatabaseUpdate.Type.class)
.register(DefaultTransaction.class)
.register(Transaction.State.class)
.register(Pair.class)
.register(ImmutablePair.class)
.build();
private final Serializer serializer = Serializer.using(Arrays.asList(KRYO_NAMESPACE));
......
......@@ -18,6 +18,7 @@ package org.onosproject.store.serializers;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import org.onlab.packet.ChassisId;
import org.onlab.packet.EthType;
......@@ -222,6 +223,7 @@ public final class KryoNamespaces {
LinkedList.class,
HashSet.class
)
.register(Maps.immutableEntry("a", "b").getClass())
.register(new ArraysAsListSerializer(), Arrays.asList().getClass())
.register(Collections.singletonList(1).getClass())
.register(Duration.class)
......