Examples of routeRequest()


Examples of voldemort.routing.RoutingStrategy.routeRequest()

                                                      Lists.newArrayList(0, 1),
                                                      filter);

        // assert none of the filtered entries are returned.
        for(Pair<ByteArray, Versioned<byte[]>> entry: entrySet) {
            if(Utils.nodeListToNodeIdList(strategy.routeRequest(entry.getFirst().get())).contains(0)) {
                if(filter.accept(entry.getFirst(), entry.getSecond())) {
                    assertEquals("All entries should be deleted except the filtered ones.",
                                 0,
                                 store.get(entry.getFirst(), null).size());
                } else {
View Full Code Here

Examples of voldemort.routing.RoutingStrategy.routeRequest()

                                                                        createConfig(OPERATION_TIMEOUT));

        RoutingStrategy routingStrategy = new RoutingStrategyFactory().updateRoutingStrategy(storeDef,
                                                                                             cluster);

        List<Node> nodesRoutedTo = routingStrategy.routeRequest("test".getBytes());
        long start = System.nanoTime(), elapsed;
        try {
            s1.put(new ByteArray("test".getBytes()), versioned, null);
        } finally {
            elapsed = (System.nanoTime() - start) / Time.NS_PER_MS;
View Full Code Here

Examples of voldemort.routing.RoutingStrategy.routeRequest()

        RoutingStrategy strategy = new ConsistentRoutingStrategy(cluster, repFactor);
        JsonTypeSerializer serializer = new JsonTypeSerializer(JsonTypeDefinition.INT32);
        Map<Integer, Integer> counts = new HashMap<Integer, Integer>();

        for(int i = 0; i < maxVal; i++) {
            for(Node node: strategy.routeRequest(serializer.toBytes(i))) {
                int newCount = 1;
                if(counts.get(node.getId()) != null) {
                    newCount = counts.get(node.getId()) + 1;
                }
                counts.put(node.getId(), newCount);
View Full Code Here

Examples of voldemort.routing.RoutingStrategy.routeRequest()

                entrySet = ServerTestUtils.createRandomKeyValuePairs(100);
                keys = entrySet.keySet().iterator();
            }
            key = keys.next();
            value = entrySet.get(key);
            List<Node> routedNodes = strategy.routeRequest(key.get());
            boolean keyShouldBeInNode0 = false;
            boolean keyShouldBeInNode1 = false;
            for(Node node: routedNodes) {
                keyShouldBeInNode0 = keyShouldBeInNode0 || (node.getId() == 0);
                keyShouldBeInNode1 = keyShouldBeInNode1 || (node.getId() == 1);
View Full Code Here

Examples of voldemort.routing.RoutingStrategy.routeRequest()

                        System.err.println("Skipping line: " + line);
                        e.printStackTrace();
                        continue;
                    }
                    ByteArray key = entry.getFirst();
                    List<Node> nodeList = routingStrategy.routeRequest(key.get());
                    for(Node node: nodeList) {
                        if(nodeId == node.getId()) {
                            try {
                                engine.put(key, entry.getSecond(), null);
                                inserted++;
View Full Code Here

Examples of voldemort.routing.RoutingStrategy.routeRequest()

    public List<Node> getResponsibleNodes(K key) {
        RoutingStrategy strategy = (RoutingStrategy) store.getCapability(StoreCapabilityType.ROUTING_STRATEGY);
        @SuppressWarnings("unchecked")
        Serializer<K> keySerializer = (Serializer<K>) store.getCapability(StoreCapabilityType.KEY_SERIALIZER);
        return strategy.routeRequest(keySerializer.toBytes(key));
    }

    @SuppressWarnings("unused")
    protected Version getVersion(K key) {
        List<Version> versions = getVersions(key);
View Full Code Here

Examples of voldemort.routing.RoutingStrategy.routeRequest()

    public static ByteArray generateRandomKey(Cluster cluster, Integer nodeId, Integer replicationFactor) {
        for(;;) {
            byte[] candidate = TestUtils.randomString("ABCDEFGHIJKLMN", 10).getBytes();
            RoutingStrategy rs = new ConsistentRoutingStrategy(cluster, replicationFactor);
            List<Node> routes = rs.routeRequest(candidate);
            if(routes.get(0).getId() == nodeId) {
                ByteArray key = new ByteArray(candidate);
                return key;
            }
        }
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.