blob: 13a4ce911ef8d3dd30f17ab7be07bbc129f441ce [file] [log] [blame]
package org.onosproject.store.consistent.impl;
import java.util.Map;
/**
* A simple Partitioner for mapping keys to database partitions.
* <p>
* This class uses a md5 hash based hashing scheme for hashing the key to
* a partition.
*
*/
public class SimpleKeyHashPartitioner extends DatabasePartitioner {
public SimpleKeyHashPartitioner(Map<String, Database> partitionMap) {
super(partitionMap);
}
@Override
public Database getPartition(String tableName, String key) {
return sortedPartitions[hash(key) % sortedPartitions.length];
}
}