Examples of FnvHashFunction


Examples of krati.util.FnvHashFunction

       
        // Set the default segment factory
        this.setSegmentFactory(new MappedSegmentFactory());
       
        // Set the default hash function
        this.setHashFunction(new FnvHashFunction());
       
        // Load properties from the default configuration file
        File file = new File(homeDir, CONFIG_PROPERTIES_FILE);
        if(file.exists()) {
            this.load(file);
View Full Code Here

Examples of krati.util.FnvHashFunction

       
        // Set the default segment factory
        this.setSegmentFactory(new MappedSegmentFactory());
       
        // Set the default hash function
        this.setHashFunction(new FnvHashFunction());
       
        // Load properties from the default configuration file
        File file = new File(homeDir, CONFIG_PROPERTIES_FILE);
        if(file.exists()) {
            this.load(file);
View Full Code Here

Examples of krati.util.FnvHashFunction

            } catch(Exception e) {
                _logger.warn("Invalid HashFunction<byte[]> class: " + paramValue);
            }
        }
        if(hashFunction == null) {
            hashFunction = new FnvHashFunction();
        }
        setHashFunction(hashFunction);
       
        // Create _dataHandler
        paramName = StoreParams.PARAM_DATA_HANDLER_CLASS;
View Full Code Here

Examples of krati.util.FnvHashFunction

        super(TestFnvHashFunction.class.getSimpleName());
    }

    @Override
    protected HashFunction<byte[]> createHashFunction() {
        return new FnvHashFunction();
    }
View Full Code Here

Examples of voldemort.utils.FnvHashFunction

        getRouter(0, 3).getNodes().containsAll(getTestNodes());
    }

    public void testTagAssignment() {
        List<Node> nodes = getTestNodes();
        ConsistentRoutingStrategy router = getRouter(new FnvHashFunction(), 3);
        for(Node n: nodes)
            for(Integer tag: n.getPartitionIds())
                assertEquals(router.getNodeByPartition(tag), n);
        for(int i = 0; i < nodes.size(); i++)
            assertEquals("Unexpected tag assignment for tag " + i + ": ",
View Full Code Here

Examples of voldemort.utils.FnvHashFunction

        // use a seed so that this test is repeatable
        Random random = new Random(2158745224L);
        Collections.shuffle(nodes, random);

        ConsistentRoutingStrategy router = new ConsistentRoutingStrategy(new FnvHashFunction(),
                                                                         nodes,
                                                                         replicationFactor);
        for(Node n: nodes)
            assertEquals(tagsPerNode, router.getPartitionsByNode(n).size());
View Full Code Here

Examples of voldemort.utils.FnvHashFunction

        if(argv.length != 1) {
            System.err.println("USAGE: java voldemort.partition.FnvHashFunctionTester filename");
            System.exit(1);
        }

        FnvHashFunction hash = new FnvHashFunction();
        BufferedReader reader = new BufferedReader(new FileReader(argv[0]));
        while(true) {
            String line = reader.readLine();
            if(line == null)
                break;
            System.out.println(hash.hash(line.trim().getBytes()));
        }

        reader.close();

    }
View Full Code Here

Examples of voldemort.utils.FnvHashFunction

    private HashMap<Integer, Integer> zoneReplicationFactor;

    public ZoneRoutingStrategy(Cluster cluster,
                               HashMap<Integer, Integer> zoneReplicationFactor,
                               int numReplicas) {
        this(new FnvHashFunction(), cluster, zoneReplicationFactor, numReplicas);
    }
View Full Code Here

Examples of voldemort.utils.FnvHashFunction

    private final HashFunction hash;

    private static final Logger logger = Logger.getLogger(ConsistentRoutingStrategy.class);

    public ConsistentRoutingStrategy(Cluster cluster, int numReplicas) {
        this(new FnvHashFunction(), cluster, numReplicas);
    }
View Full Code Here

Examples of voldemort.utils.FnvHashFunction

    @Override
    public void transfer() throws Exception {
        cursor = srcDB.openCursor(null, null);
        DatabaseEntry keyEntry = new DatabaseEntry();
        DatabaseEntry valueEntry = new DatabaseEntry();
        HashFunction hash = new FnvHashFunction();
        int totalPartitions = cluster.getNumberOfPartitions();

        List<Versioned<byte[]>> vals;
        long startTime = System.currentTimeMillis();
        int scanCount = 0;
        int keyCount = 0;
        while(cursor.getNext(keyEntry, valueEntry, LockMode.READ_UNCOMMITTED) == OperationStatus.SUCCESS) {
            keyCount++;

            vals = StoreBinaryFormat.fromByteArray(valueEntry.getData());
            scanCount += vals.size();

            int partition = BdbConvertData.abs(hash.hash(keyEntry.getData()))
                            % (Math.max(1, totalPartitions));

            OperationStatus putStatus = dstDB.put(null,
                                                  new DatabaseEntry(StoreBinaryFormat.makePrefixedKey(keyEntry.getData(),
                                                                                                      partition)),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.