Examples of RoutingStrategy


Examples of voldemort.routing.RoutingStrategy

            HashMap<ByteArray, byte[]> primaryEntriesMoved = Maps.newHashMap();
            HashMap<ByteArray, byte[]> secondaryEntriesMoved = Maps.newHashMap();
            HashMap<ByteArray, byte[]> tertiaryEntriesMoved = Maps.newHashMap();

            RoutingStrategy strategy = new RoutingStrategyFactory().updateRoutingStrategy(storeDef2,
                                                                                          currentCluster);
            for(Entry<ByteArray, byte[]> entry: entrySet.entrySet()) {
                storeClient1.put(new String(entry.getKey().get()), new String(entry.getValue()));
                storeClient2.put(new String(entry.getKey().get()), new String(entry.getValue()));
                List<Integer> pList = strategy.getPartitionList(entry.getKey().get());
                if(primaryPartitionsMoved.contains(pList.get(0))) {
                    primaryEntriesMoved.put(entry.getKey(), entry.getValue());
                } else if(secondaryPartitionsMoved.contains(pList.get(0))) {
                    secondaryEntriesMoved.put(entry.getKey(), entry.getValue());
                } else if(tertiaryPartitionsMoved.contains(pList.get(0))) {

Examples of voldemort.routing.RoutingStrategy

            node = cluster.getNodeById(nodeId);
        } catch(VoldemortException e) {
            Utils.croak("Can't find a node with id " + nodeId);
        }

        RoutingStrategy routingStrategy = new RoutingStrategyFactory().updateRoutingStrategy(storeDefinition,
                                                                                             cluster);
        try {
            new RequestFileFilter(storeDefinition,
                                  routingStrategy,
                                  inputFile,

Examples of voldemort.routing.RoutingStrategy

        // and have rolled back the updates
        return false;
    }

    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));
    }

Examples of voldemort.routing.RoutingStrategy

        // acquire read lock
        readLock.lock();
        try {
            Map<String, RoutingStrategy> routingStrategyMap = (Map<String, RoutingStrategy>) metadataCache.get(ROUTING_STRATEGY_KEY)
                                                                                                          .getValue();
            RoutingStrategy strategy = routingStrategyMap.get(storeName);
            if(strategy == null) {
                Map<String, RoutingStrategy> systemRoutingStrategyMap = (Map<String, RoutingStrategy>) metadataCache.get(SYSTEM_ROUTING_STRATEGY_KEY)
                                                                                                                    .getValue();
                strategy = systemRoutingStrategyMap.get(storeName);
            }

Examples of voldemort.routing.RoutingStrategy

                                   new Versioned<Object>(routingStrategyMap,
                                                         clock.incremented(getNodeId(),
                                                                           System.currentTimeMillis())));

            for(String storeName: storeNameTolisteners.keySet()) {
                RoutingStrategy updatedRoutingStrategy = routingStrategyMap.get(storeName);
                if(updatedRoutingStrategy != null) {
                    try {
                        for(MetadataStoreListener listener: storeNameTolisteners.get(storeName)) {
                            listener.updateRoutingStrategy(updatedRoutingStrategy);
                            listener.updateStoreDefinition(storeDefMap.get(storeName));

Examples of voldemort.routing.RoutingStrategy

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

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

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

            new JsonStoreBuilder(reader,
                                 cluster,
                                 storeDef,

Examples of voldemort.routing.RoutingStrategy

                datas[partitionId][chunk].close();
            }
        }

        // Start moving files over to their correct node
        RoutingStrategy strategy = new RoutingStrategyFactory().updateRoutingStrategy(storeDefinition,
                                                                                      cluster);
        Map<Integer, Integer> replicaMapping = cluster.getPartitionIdToNodeIdMap();
        for(File file: tempDirectory.listFiles()) {
            String fileName = file.getName();
            if(fileName.matches("^[\\d]+_[\\d]+_[\\d]+\\.(data|index)")) {
                String[] props = fileName.split("_");
                int partitionId = Integer.parseInt(props[0]);
                int replicaType = Integer.parseInt(props[1]);
                int nodeId = replicaMapping.get(strategy.getReplicatingPartitionList(partitionId)
                                                        .get(replicaType));

                Utils.move(file, new File(nodeDirs.get(nodeId), fileName));
            }
        }

Examples of voldemort.routing.RoutingStrategy

    public Map<ByteArray, List<Versioned<byte[]>>> getAll(Iterable<ByteArray> keys,
                                                          Map<ByteArray, byte[]> transforms)
            throws VoldemortException {
        StoreUtils.assertValidKeys(keys);
        StoreUtils.assertValidNode(metadata, nodeId);
        RoutingStrategy routingStrategy = metadata.getRoutingStrategy(getName());
        Node node = metadata.getCluster().getNodeById(nodeId);
        for(ByteArray key: keys)
            StoreUtils.assertValidMetadata(key, routingStrategy, node);

        return getInnerStore().getAll(keys, transforms);

Examples of voldemort.routing.RoutingStrategy

            File baseDir = TestUtils.createTempDir();
            JsonReader reader = ReadOnlyStorageEngineTestInstance.makeTestDataReader(testEntries,
                                                                                     baseDir);

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

            File outputDir = TestUtils.createTempDir(baseDir);
            JsonStoreBuilder storeBuilder = new JsonStoreBuilder(reader,
                                                                 cluster,

Examples of voldemort.routing.RoutingStrategy

    }

    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;
            }
        }
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.