Package voldemort.store

Examples of voldemort.store.StoreDefinitionBuilder


        List<StoreDefinition> storeDefs = new LinkedList<StoreDefinition>();
        int totalReplicationFactor = 0;
        for (Integer value : zoneRep.values()) {
            totalReplicationFactor += value;
        }
        StoreDefinition storeDef = new StoreDefinitionBuilder().setName(storeName)
                                                               .setType(storageType)
                                                               .setRoutingPolicy(RoutingTier.CLIENT)
                                                               .setRoutingStrategyType(RoutingStrategyType.ZONE_STRATEGY)
                                                               .setKeySerializer(new SerializerDefinition("string"))
                                                               .setValueSerializer(new SerializerDefinition("string"))
View Full Code Here


            oldMd5ToNewMd5.put(new ByteArray(oldMd5), currentMd5);
            entryId++;
        }
        FileUtils.writeStringToFile(inputFile, contents.toString());

        StoreDefinition def = new StoreDefinitionBuilder().setName(storeName)
                                                          .setType(ReadOnlyStorageConfiguration.TYPE_NAME)
                                                          .setKeySerializer(serDef)
                                                          .setValueSerializer(serDef)
                                                          .setRoutingPolicy(RoutingTier.CLIENT)
                                                          .setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY)
View Full Code Here

                { HintedHandoffStrategyType.PROXIMITY_STRATEGY, 2, 1, 2 } });
    }

    private StoreDefinition getStoreDef() {
        SerializerDefinition serDef = new SerializerDefinition("string");
        return new StoreDefinitionBuilder().setName(STORE_NAME)
                                           .setType(InMemoryStorageConfiguration.TYPE_NAME)
                                           .setKeySerializer(serDef)
                                           .setValueSerializer(serDef)
                                           .setRoutingPolicy(RoutingTier.CLIENT)
                                           .setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY)
View Full Code Here

    private Cluster cluster;
    private AdminClient adminClient;
    private File baseDirs[];

    protected String constructStoresXml() throws IOException {
        StoreDefinition storeDef = new StoreDefinitionBuilder().setName(STORE_NAME)
                                                               .setType(ReadOnlyStorageConfiguration.TYPE_NAME)
                                                               .setKeySerializer(serializerDef)
                                                               .setValueSerializer(serializerDef)
                                                               .setRoutingPolicy(RoutingTier.SERVER)
                                                               .setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY)
View Full Code Here

                2, 3 }, {} });
        targetCluster = UpdateClusterUtils.createUpdatedCluster(currentCluster, 2,
                                                            Arrays.asList(0));
        this.primaryPartitionsMoved = Lists.newArrayList(0);
        this.secondaryPartitionsMoved = Lists.newArrayList(2, 3);
        this.storeDef = new StoreDefinitionBuilder().setName("test")
                                                    .setType(BdbStorageConfiguration.TYPE_NAME)
                                                    .setKeySerializer(new SerializerDefinition("string"))
                                                    .setValueSerializer(new SerializerDefinition("string"))
                                                    .setRoutingPolicy(RoutingTier.CLIENT)
                                                    .setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY)
View Full Code Here

                               6666 + i,
                               7000 + i,
                               Arrays.asList(4 * i, 4 * i + 1, 4 * i + 2, 4 * i + 3)));
        }
        Cluster cluster = new Cluster("test", nodes);
        StoreDefinition storeDef = new StoreDefinitionBuilder().setName("test")
                                                               .setType(ReadOnlyStorageConfiguration.TYPE_NAME)
                                                               .setKeySerializer(keySerDef)
                                                               .setValueSerializer(valueSerDef)
                                                               .setRoutingPolicy(RoutingTier.CLIENT)
                                                               .setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY)
View Full Code Here

        // Create a store definition for an existing store with a different
        // replication factor
        List<StoreDefinition> storesToBeUpdatedList = new ArrayList<StoreDefinition>();
        String storeName = "test-replication-memory";
        StoreDefinition definitionNew = new StoreDefinitionBuilder().setName(storeName)
                                                                    .setType(InMemoryStorageConfiguration.TYPE_NAME)
                                                                    .setKeySerializer(new SerializerDefinition("string"))
                                                                    .setValueSerializer(new SerializerDefinition("string"))
                                                                    .setRoutingPolicy(RoutingTier.CLIENT)
                                                                    .setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY)
View Full Code Here

        doClientOperation();

        // Create store definitions for existing stores with a different
        // replication factor
        List<StoreDefinition> storesToBeUpdatedList = new ArrayList<StoreDefinition>();
        StoreDefinition definition1 = new StoreDefinitionBuilder().setName("test-replication-memory")
                                                                  .setType(InMemoryStorageConfiguration.TYPE_NAME)
                                                                  .setKeySerializer(new SerializerDefinition("string"))
                                                                  .setValueSerializer(new SerializerDefinition("string"))
                                                                  .setRoutingPolicy(RoutingTier.CLIENT)
                                                                  .setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY)
                                                                  .setReplicationFactor(2)
                                                                  .setPreferredReads(1)
                                                                  .setRequiredReads(1)
                                                                  .setPreferredWrites(1)
                                                                  .setRequiredWrites(1)
                                                                  .build();

        StoreDefinition definition2 = new StoreDefinitionBuilder().setName("test-recovery-data")
                                                                  .setType(InMemoryStorageConfiguration.TYPE_NAME)
                                                                  .setKeySerializer(new SerializerDefinition("string"))
                                                                  .setValueSerializer(new SerializerDefinition("string"))
                                                                  .setRoutingPolicy(RoutingTier.CLIENT)
                                                                  .setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY)
                                                                  .setReplicationFactor(1)
                                                                  .setPreferredReads(1)
                                                                  .setRequiredReads(1)
                                                                  .setPreferredWrites(1)
                                                                  .setRequiredWrites(1)
                                                                  .build();

        StoreDefinition definition3 = new StoreDefinitionBuilder().setName("test-basic-replication-memory")
                                                                  .setType(InMemoryStorageConfiguration.TYPE_NAME)
                                                                  .setKeySerializer(new SerializerDefinition("string"))
                                                                  .setValueSerializer(new SerializerDefinition("string"))
                                                                  .setRoutingPolicy(RoutingTier.CLIENT)
                                                                  .setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY)
View Full Code Here

        // Fetch the original list of stores
        Versioned<List<StoreDefinition>> originalStoreDefinitions = client.metadataMgmtOps.getRemoteStoreDefList(nodeId);
        List<StoreDefinition> updatedStoreDefList = new ArrayList<StoreDefinition>();

        // Create an updated store definition for store: 'users'
        StoreDefinition newDefinition = new StoreDefinitionBuilder().setName(storeNameToBeUpdated)
                                                                    .setType(BdbStorageConfiguration.TYPE_NAME)
                                                                    .setKeySerializer(new SerializerDefinition("string"))
                                                                    .setValueSerializer(new SerializerDefinition("string"))
                                                                    .setRoutingPolicy(RoutingTier.CLIENT)
                                                                    .setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY)
View Full Code Here

        doClientOperation();

        // Try to add a store whose replication factor is greater than the
        // number of nodes
        StoreDefinition definition = new StoreDefinitionBuilder().setName("updateTest")
                                                                 .setType(InMemoryStorageConfiguration.TYPE_NAME)
                                                                 .setKeySerializer(new SerializerDefinition("string"))
                                                                 .setValueSerializer(new SerializerDefinition("string"))
                                                                 .setRoutingPolicy(RoutingTier.CLIENT)
                                                                 .setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY)
                                                                 .setReplicationFactor(3)
                                                                 .setPreferredReads(1)
                                                                 .setRequiredReads(1)
                                                                 .setPreferredWrites(1)
                                                                 .setRequiredWrites(1)
                                                                 .build();
        try {
            adminClient.storeMgmtOps.addStore(definition);
            fail("Should have thrown an exception because we cannot add a store with a replication factor greater than number of nodes");
        } catch(Exception e) {}

        // Try adding a legit store using inmemorystorage engine
        definition = new StoreDefinitionBuilder().setName("updateTest")
                                                 .setType(InMemoryStorageConfiguration.TYPE_NAME)
                                                 .setKeySerializer(new SerializerDefinition("string"))
                                                 .setValueSerializer(new SerializerDefinition("string"))
                                                 .setRoutingPolicy(RoutingTier.CLIENT)
                                                 .setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY)
                                                 .setReplicationFactor(1)
                                                 .setPreferredReads(1)
                                                 .setRequiredReads(1)
                                                 .setPreferredWrites(1)
                                                 .setRequiredWrites(1)
                                                 .build();
        adminClient.storeMgmtOps.addStore(definition);

        // now test the store
        StoreClientFactory factory = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(cluster.getNodeById(0)
                                                                                                             .getSocketUrl()
                                                                                                             .toString()));

        StoreClient<Object, Object> client = factory.getStoreClient("updateTest");
        client.put("abc", "123");
        String s = (String) client.get("abc").getValue();
        assertEquals(s, "123");

        // test again with a unknown store
        try {
            client = factory.getStoreClient("updateTest2");
            client.put("abc", "123");
            s = (String) client.get("abc").getValue();
            assertEquals(s, "123");
            fail("Should have received bootstrap failure exception");
        } catch(Exception e) {
            if(!(e instanceof BootstrapFailureException))
                throw e;
        }

        // make sure that the store list we get back from AdminClient
        Versioned<List<StoreDefinition>> list = adminClient.metadataMgmtOps.getRemoteStoreDefList(0);
        assertTrue(list.getValue().contains(definition));

        // Now add a RO store
        definition = new StoreDefinitionBuilder().setName("addStoreROFormatTest")
                                                 .setType(ReadOnlyStorageConfiguration.TYPE_NAME)
                                                 .setKeySerializer(new SerializerDefinition("string"))
                                                 .setValueSerializer(new SerializerDefinition("string"))
                                                 .setRoutingPolicy(RoutingTier.CLIENT)
                                                 .setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY)
View Full Code Here

TOP

Related Classes of voldemort.store.StoreDefinitionBuilder

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.