WIP: Consistent map implementation.
Change-Id: I51b2d954b7a8ff2c51c425d9a8125937d4eaa6b0
Change-Id: Ib27799d4eb60fc4bfaa8d2f21a904365ff5437eb
Change-Id: I95c937600ceb8f282a482280217671c471f40b9c
diff --git a/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/SimpleTableHashPartitioner.java b/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/SimpleTableHashPartitioner.java
new file mode 100644
index 0000000..367e3f2
--- /dev/null
+++ b/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/SimpleTableHashPartitioner.java
@@ -0,0 +1,23 @@
+package org.onosproject.store.consistent.impl;
+
+import java.util.Map;
+
+/**
+ * A simple Partitioner that uses the table name hash to
+ * pick a partition.
+ * <p>
+ * This class uses a md5 hash based hashing scheme for hashing the table name to
+ * a partition. This partitioner maps all keys for a table to the same database
+ * partition.
+ */
+public class SimpleTableHashPartitioner extends DatabasePartitioner {
+
+ public SimpleTableHashPartitioner(Map<String, Database> partitionMap) {
+ super(partitionMap);
+ }
+
+ @Override
+ public Database getPartition(String tableName, String key) {
+ return sortedPartitions[hash(tableName) % sortedPartitions.length];
+ }
+}
\ No newline at end of file