Package voldemort.routing

Examples of voldemort.routing.ConsistentRoutingStrategy


            nodeId = 0;

            JsonStoreBuilder builder = new JsonStoreBuilder(new JsonReader(r),
                                                            cluster,
                                                            storeDef,
                                                            new ConsistentRoutingStrategy(cluster,
                                                                                          1),
                                                            output,
                                                            tempDir,
                                                            internalSortSize,
                                                            2,
View Full Code Here


        File file = new File(args[0]);
        int repFactor = Integer.parseInt(args[1]);
        int maxVal = Integer.parseInt(args[2]);
        ClusterMapper mapper = new ClusterMapper();
        Cluster cluster = mapper.readCluster(file);
        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

                _storeDef = HadoopUtils.readStoreDef(props.get("voldemort.store.file"),
                                                     props.get("voldemort.store.name"),
                                                     conf);

                _checkPercent = conf.getInt("input.data.check.percent", 0);
                _routingStrategy = new ConsistentRoutingStrategy(_cluster,
                                                                 _storeDef.getReplicationFactor());
                _keySerializer = (Serializer<Object>) new DefaultSerializerFactory().getSerializer(_storeDef.getKeySerializer());
                _valueSerializer = (Serializer<Object>) new DefaultSerializerFactory().getSerializer(_storeDef.getValueSerializer());

                _version = _storeDef.getKeySerializer().getCurrentSchemaVersion();
                _routingStrategy = new ConsistentRoutingStrategy(_cluster,
                                                                 _storeDef.getReplicationFactor());

                if(_routingStrategy == null) {
                    throw new RuntimeException("Failed to create routing strategy");
                }
View Full Code Here

        }

        keyCompressor = new CompressionStrategyFactory().get(keySerializerDefinition.getCompression());
        valueCompressor = new CompressionStrategyFactory().get(valueSerializerDefinition.getCompression());

        routingStrategy = new ConsistentRoutingStrategy(getCluster(),
                                                        getStoreDef().getReplicationFactor());

        Props props = HadoopUtils.getPropsFromJob(conf);

    }
View Full Code Here

        }

        keyCompressor = new CompressionStrategyFactory().get(keySerializerDefinition.getCompression());
        valueCompressor = new CompressionStrategyFactory().get(valueSerializerDefinition.getCompression());

        routingStrategy = new ConsistentRoutingStrategy(getCluster(),
                                                        getStoreDef().getReplicationFactor());
    }
View Full Code Here

    }

    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

                Utils.croak("No store found with name \"" + storeName + "\"");

            if(!outputDir.exists())
                Utils.croak("Directory \"" + outputDir.getAbsolutePath() + " does not exist.");

            ConsistentRoutingStrategy routingStrategy = new ConsistentRoutingStrategy(cluster.getNodes(),
                                                                                      storeDef.getReplicationFactor());

            new JsonStoreBuilder(reader,
                                 cluster,
                                 storeDef,
View Full Code Here

                Utils.croak("No store found with name \"" + storeName + "\"");

            if(!outputDir.exists())
                Utils.croak("Directory \"" + outputDir.getAbsolutePath() + " does not exist.");

            ConsistentRoutingStrategy routingStrategy = new ConsistentRoutingStrategy(cluster.getNodes(),
                                                                                      storeDef.getReplicationFactor());

            new JsonStoreBuilder(reader,
                                 cluster,
                                 storeDef,
View Full Code Here

TOP

Related Classes of voldemort.routing.ConsistentRoutingStrategy

Copyright © 2018 www.massapicom. 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.