Package voldemort.store

Examples of voldemort.store.StorageConfiguration


                props = new Props(new File(propsFile));
            props.put("node.id", 0);
            props.put("data.directory", dataDir.getAbsolutePath());
            props.put("voldemort.home", System.getProperty("user.dir"));
            VoldemortConfig config = new VoldemortConfig(props);
            StorageConfiguration storageConfig = (StorageConfiguration) ReflectUtils.callConstructor(ReflectUtils.loadClass(storageEngineClass),
                                                                                                     new Object[] { config });
            StorageEngine<ByteArray, byte[], byte[]> engine = storageConfig.getStore(TestUtils.makeStoreDefinition("test"),
                                                                                     TestUtils.makeSingleNodeRoutingStrategy());
            @SuppressWarnings("unchecked")
            final Store<String, byte[], byte[]> store = new SerializingStore(engine,
                                                                             new StringSerializer(),
                                                                             new IdentitySerializer(),
View Full Code Here


    private void initStorageConfig(String configClassName) {
        // add the configurations of the storage engines needed by user stores
        try {
            Class<?> configClass = ReflectUtils.loadClass(configClassName);
            StorageConfiguration configuration = (StorageConfiguration) ReflectUtils.callConstructor(configClass,
                                                                                                     new Class<?>[] { VoldemortConfig.class },
                                                                                                     new Object[] { voldemortConfig });
            logger.info("Initializing " + configuration.getType() + " storage engine.");
            storageConfigs.put(configuration.getType(), configuration);

            if(voldemortConfig.isJmxEnabled())
                JmxUtils.registerMbean(configuration.getType() + "StorageConfiguration",
                                       configuration);
        } catch(IllegalStateException e) {
            logger.error("Error loading storage configuration '" + configClassName + "'.", e);
        }
View Full Code Here

        /* Register slop store */
        if(voldemortConfig.isSlopEnabled()) {

            logger.info("Initializing the slop store using " + voldemortConfig.getSlopStoreType());
            StorageConfiguration config = storageConfigs.get(voldemortConfig.getSlopStoreType());
            if(config == null)
                throw new ConfigurationException("Attempt to open store "
                                                 + SlopStorageEngine.SLOP_STORE_NAME + " but "
                                                 + voldemortConfig.getSlopStoreType()
                                                 + " storage engine has not been enabled.");

            // make a dummy store definition object
            StoreDefinition slopStoreDefinition = new StoreDefinition(SlopStorageEngine.SLOP_STORE_NAME,
                                                                      null,
                                                                      null,
                                                                      null,
                                                                      null,
                                                                      null,
                                                                      null,
                                                                      RoutingStrategyType.CONSISTENT_STRATEGY,
                                                                      0,
                                                                      null,
                                                                      0,
                                                                      null,
                                                                      0,
                                                                      null,
                                                                      null,
                                                                      null,
                                                                      null,
                                                                      null,
                                                                      null,
                                                                      null,
                                                                      null,
                                                                      null,
                                                                      null,
                                                                      null,
                                                                      null,
                                                                      0);
            SlopStorageEngine slopEngine = new SlopStorageEngine(config.getStore(slopStoreDefinition,
                                                                                 new RoutingStrategyFactory().updateRoutingStrategy(slopStoreDefinition,
                                                                                                                                    metadata.getCluster())),
                                                                 metadata.getCluster());
            registerInternalEngine(slopEngine, false, "slop");
            storeRepository.setSlopStore(slopEngine);
View Full Code Here

    public void openSystemStore(StoreDefinition storeDef) {

        logger.info("Opening system store '" + storeDef.getName() + "' (" + storeDef.getType()
                    + ").");

        StorageConfiguration config = storageConfigs.get(storeDef.getType());
        if(config == null)
            throw new ConfigurationException("Attempt to open system store " + storeDef.getName()
                                             + " but " + storeDef.getType()
                                             + " storage engine has not been enabled.");

        final StorageEngine<ByteArray, byte[], byte[]> engine = config.getStore(storeDef, null);

        // Noted that there is no read-only processing as for user stores.

        // openStore() should have atomic semantics
        try {
View Full Code Here

        engine.close();
    }

    public void updateStore(StoreDefinition storeDef) {
        logger.info("Updating store '" + storeDef.getName() + "' (" + storeDef.getType() + ").");
        StorageConfiguration config = storageConfigs.get(storeDef.getType());
        if(config == null)
            throw new ConfigurationException("Attempt to open store " + storeDef.getName()
                                             + " but " + storeDef.getType()
                                             + " storage engine has not been enabled.");
        config.update(storeDef);
    }
View Full Code Here

    public StorageEngine<ByteArray, byte[], byte[]> openStore(StoreDefinition storeDef) {

        logger.info("Opening store '" + storeDef.getName() + "' (" + storeDef.getType() + ").");

        StorageConfiguration config = storageConfigs.get(storeDef.getType());
        if(config == null)
            throw new ConfigurationException("Attempt to open store " + storeDef.getName()
                                             + " but " + storeDef.getType()
                                             + " storage engine has not been enabled.");

        boolean isReadOnly = storeDef.getType().compareTo(ReadOnlyStorageConfiguration.TYPE_NAME) == 0;
        final RoutingStrategy routingStrategy = new RoutingStrategyFactory().updateRoutingStrategy(storeDef,
                                                                                                   metadata.getCluster());

        final StorageEngine<ByteArray, byte[], byte[]> engine = config.getStore(storeDef,
                                                                                routingStrategy);
        // Update the routing strategy + add listener to metadata
        if(storeDef.getType().compareTo(ReadOnlyStorageConfiguration.TYPE_NAME) == 0) {
            metadata.addMetadataStoreListener(storeDef.getName(), new MetadataStoreListener() {
View Full Code Here

            engine.truncate();
        }
        engine.close();

        // Also remove any state in the StorageConfiguration (if required)
        StorageConfiguration config = storageConfigs.get(storeType);
        if(config == null) {
            throw new ConfigurationException("Attempt to close storage engine " + engine.getName()
                                             + " but " + storeType
                                             + " storage engine has not been enabled.");
        }
        config.removeStorageEngine(engine);

    }
View Full Code Here

            String storageEngineClass = benchmarkProps.getString(STORAGE_CONFIGURATION_CLASS);
            this.keyType = benchmarkProps.getString(KEY_TYPE, STRING_KEY_TYPE);
            Serializer serializer = findKeyType(this.keyType);
            Store<Object, Object, Object> store = null;

            StorageConfiguration conf = (StorageConfiguration) ReflectUtils.callConstructor(ReflectUtils.loadClass(storageEngineClass),
                                                                                            new Object[] { ServerTestUtils.getVoldemortConfig() });

            StorageEngine<ByteArray, byte[], byte[]> engine = conf.getStore(TestUtils.makeStoreDefinition(DUMMY_DB),
                                                                            TestUtils.makeSingleNodeRoutingStrategy());
            if(conf.getType().compareTo(ViewStorageConfiguration.TYPE_NAME) == 0) {
                engine = new ViewStorageEngine(STORE_NAME,
                                               engine,
                                               new StringSerializer(),
                                               new StringSerializer(),
                                               serializer,
View Full Code Here

TOP

Related Classes of voldemort.store.StorageConfiguration

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.