Package krati.core

Examples of krati.core.StoreConfig


                                double segmentCompactFactor) throws Exception {
        this._homeDir = homeDirectory;
        this._homePath = homeDirectory.getCanonicalPath();
       
        // Create/validate/store config
        _config = new StoreConfig(_homeDir, length);
        _config.setBatchSize(batchSize);
        _config.setNumSyncBatches(numSyncBatches);
        _config.setSegmentFactory(segmentFactory);
        _config.setSegmentFileSizeMB(segmentFileSizeMB);
        _config.setSegmentCompactFactor(segmentCompactFactor);
View Full Code Here


        return new IntSerializer(ByteOrder.BIG_ENDIAN);
    }
   
    @Override
    protected AvroStore<Integer> createAvroStore(File storeDir, int capacity, Schema schema, Serializer<Integer> keySerializer) throws Exception {
        StoreConfig config = new StoreConfig(storeDir, capacity);
        config.setSegmentFactory(createSegmentFactory());
        config.setSegmentFileSizeMB(32);
        config.setNumSyncBatches(2);
        config.setBatchSize(100);
       
        return new SimpleAvroArray(
                StoreFactory.createStaticArrayStore(config),
                schema);
    }
View Full Code Here

        SourceWaterMarks sourceWaterMarks = new SourceWaterMarks(new File(homeDir, "sourceWaterMarks.scn"));
        WaterMarksClock waterMarksClock = new SourceWaterMarksClock(sources, sourceWaterMarks);
       
        // STEP-3
        // Create store configuration template
        StoreConfig configTemplate = new StorePartitionConfig(homeDir, arrayStoreIndexStart, arrayStoreCapacity);
        configTemplate.setSegmentCompactFactor(0.68);
        configTemplate.setSegmentFactory(new MappedSegmentFactory());
        configTemplate.setSegmentFileSizeMB(32);
        configTemplate.setNumSyncBatches(2);
        configTemplate.setBatchSize(100);
       
        // Create multi-tenant store responder
        ArrayStoreFactory storeFactory = new StaticArrayStoreFactory();
        StoreResponderFactory responderFactory = new BasicArrayStoreResponderFactory(storeFactory);
        MultiTenantStoreResponder mtStoreResponder = new MultiTenantStoreResponder(homeDir, configTemplate, responderFactory);
View Full Code Here

       
        // Change initialCapacity accordingly for different data sets
        int initialCapacity = 10000;
       
        // Create store configuration template
        StoreConfig configTemplate = new StoreConfig(homeDir, initialCapacity);
        configTemplate.setSegmentCompactFactor(0.68);
        configTemplate.setSegmentFactory(new MappedSegmentFactory());
        configTemplate.setSegmentFileSizeMB(32);
        configTemplate.setNumSyncBatches(2);
        configTemplate.setBatchSize(100);
       
        // Create multi-tenant store responder
        DataStoreFactory storeFactory = new IndexedDataStoreFactory();
        StoreResponderFactory responderFactory = new BasicDataStoreResponderFactory(storeFactory);
        MultiTenantStoreResponder mtStoreResponder = new MultiTenantStoreResponder(homeDir, configTemplate, responderFactory);
View Full Code Here

* @since 08/07, 2011
*/
public class SingleAvroStoreHttpServer {
   
    static DataStore<byte[], byte[]> createDataStore(File storeDir, int capacity) throws Exception {
        StoreConfig config = new StoreConfig(storeDir, capacity);
        config.setSegmentFactory(new MemorySegmentFactory());
        config.setSegmentFileSizeMB(32);
        config.setNumSyncBatches(2);
        config.setBatchSize(100);
       
        return StoreFactory.createStaticDataStore(config);
    }
View Full Code Here

       
        // Change initialCapacity accordingly for different data sets
        int initialCapacity = 10000;
       
        // Create store configuration template
        StoreConfig configTemplate = new StoreConfig(homeDir, initialCapacity);
        configTemplate.setSegmentCompactFactor(0.68);
        configTemplate.setSegmentFactory(new MappedSegmentFactory());
        configTemplate.setSegmentFileSizeMB(32);
        configTemplate.setNumSyncBatches(2);
        configTemplate.setBatchSize(100);
       
        // Create store responder and server
        DataStoreFactory storeFactory = new IndexedDataStoreFactory();
        MultiTenantStoreResponder storeResponder = new MultiTenantStoreResponder(homeDir, configTemplate, new BasicDataStoreResponderFactory(storeFactory));
        HttpServer server = new HttpServer(storeResponder, 8080);
View Full Code Here

        SourceWaterMarks sourceWaterMarks = new SourceWaterMarks(new File(homeDir, "sourceWaterMarks.scn"));
        WaterMarksClock waterMarksClock = new SourceWaterMarksClock(sources, sourceWaterMarks);
       
        // STEP-3
        // Create store configuration template
        StoreConfig configTemplate = new StoreConfig(homeDir, initialCapacity);
        configTemplate.setSegmentCompactFactor(0.68);
        configTemplate.setSegmentFactory(new MappedSegmentFactory());
        configTemplate.setSegmentFileSizeMB(32);
        configTemplate.setNumSyncBatches(2);
        configTemplate.setBatchSize(100);
       
        // Create multi-tenant store responder
        DataStoreFactory storeFactory = new IndexedDataStoreFactory();
        StoreResponderFactory responderFactory = new BasicDataStoreResponderFactory(storeFactory);
        MultiTenantStoreResponder mtStoreResponder = new MultiTenantStoreResponder(homeDir, configTemplate, responderFactory);
View Full Code Here

       
        // Create bytesDB
        _storeHome = new File(_homeDir, "store");
       
        int storeInitialCapacity = config.getInitialCapacity();
        StoreConfig storeConfig = new StoreConfig(_storeHome, storeInitialCapacity);
        storeConfig.setIndexesCached(config.getIndexesCached());
        storeConfig.setBatchSize(config.getBatchSize());
        storeConfig.setNumSyncBatches(config.getNumSyncBatches());
        storeConfig.setSegmentFileSizeMB(config.getSegmentFileSizeMB());
        storeConfig.setSegmentFactory(config.getSegmentFactory());
        storeConfig.setSegmentCompactFactor(config.getSegmentCompactFactor());
        _bytesDB = new BytesDB(storeConfig);
        _scn = _bytesDB.getHWMark();
       
        // Create hash index
        _indexHome = new File(_homeDir, "index");
        int indexInitialCapacity =
                config.getInt(StoreParams.PARAM_INDEX_INITIAL_CAPACITY,
                              config.getInitialCapacity());
        int indexSegmentFileSizeMB =
                config.getInt(StoreParams.PARAM_INDEX_SEGMENT_FILE_SIZE_MB,
                              StoreParams.INDEX_SEGMENT_FILE_SIZE_MB_DEFAULT);
        double indexSegmentCompactFactor =
                config.getDouble(StoreParams.PARAM_INDEX_SEGMENT_COMPACT_FACTOR,
                                 config.getSegmentCompactFactor());
        SegmentFactory indexSegmentFactory =
                config.getClass(StoreParams.PARAM_INDEX_SEGMENT_FACTORY_CLASS, MemorySegmentFactory.class)
                .asSubclass(SegmentFactory.class).newInstance();
       
        StoreConfig indexConfig = new StoreConfig(_indexHome, indexInitialCapacity);
        indexConfig.setBatchSize(config.getBatchSize());
        indexConfig.setNumSyncBatches(config.getNumSyncBatches());
        indexConfig.setIndexesCached(true);                         // indexes.dat is always cached
        indexConfig.setSegmentFactory(indexSegmentFactory);
        indexConfig.setSegmentFileSizeMB(indexSegmentFileSizeMB);
        indexConfig.setSegmentCompactFactor(indexSegmentCompactFactor);
        indexConfig.setHashLoadFactor(config.getHashLoadFactor());
        indexConfig.setHashFunction(config.getHashFunction());
        indexConfig.setDataHandler(config.getDataHandler());
        _index = new HashIndex(indexConfig);
        initIndexPersistableListener();
       
        _logger.info("opened indexHome=" + _indexHome.getAbsolutePath() + " storeHome=" + _storeHome.getAbsolutePath());
    }
View Full Code Here

       
        // Create bytesDB
        _storeHome = new File(homeDir, "store");
       
        int storeInitialCapacity = initialCapacity;
        StoreConfig storeConfig = new StoreConfig(_storeHome, storeInitialCapacity);
        storeConfig.setBatchSize(batchSize);
        storeConfig.setNumSyncBatches(numSyncBatches);
        storeConfig.setSegmentFileSizeMB(storeSegmentFileSizeMB);
        storeConfig.setSegmentFactory(storeSegmentFactory);
        _bytesDB = new BytesDB(storeConfig);
        _scn = _bytesDB.getHWMark();
       
        // Create index
        _indexHome = new File(homeDir, "index");
       
        int indexInitialCapacity = initialCapacity;
        StoreConfig indexConfig = new StoreConfig(_indexHome, indexInitialCapacity);
        indexConfig.setBatchSize(batchSize);
        indexConfig.setNumSyncBatches(numSyncBatches);
        indexConfig.setSegmentFileSizeMB(indexSegmentFileSizeMB);
        indexConfig.setSegmentFactory(indexSegmentFactory);
        _index = new HashIndex(indexConfig);
        initIndexPersistableListener();
       
        _logger.info("opened indexHome=" + _indexHome.getAbsolutePath() + " storeHome=" + _storeHome.getAbsolutePath());
    }
View Full Code Here

       
        // Create bytesDB
        _storeHome = new File(homeDir, "store");
       
        int storeInitialCapacity = StoreParams.getDynamicStoreInitialCapacity(storeInitLevel);
        StoreConfig storeConfig = new StoreConfig(_storeHome, storeInitialCapacity);
        storeConfig.setBatchSize(batchSize);
        storeConfig.setNumSyncBatches(numSyncBatches);
        storeConfig.setSegmentFileSizeMB(storeSegmentFileSizeMB);
        storeConfig.setSegmentFactory(storeSegmentFactory);
        _bytesDB = new BytesDB(storeConfig);
        _scn = _bytesDB.getHWMark();
       
        // Create index
        _indexHome = new File(homeDir, "index");
       
        int indexInitialCapacity = StoreParams.getDynamicStoreInitialCapacity(indexInitLevel);
        StoreConfig indexConfig = new StoreConfig(_indexHome, indexInitialCapacity);
        indexConfig.setBatchSize(batchSize);
        indexConfig.setNumSyncBatches(numSyncBatches);
        indexConfig.setSegmentFileSizeMB(indexSegmentFileSizeMB);
        indexConfig.setSegmentFactory(indexSegmentFactory);
        _index = new HashIndex(indexConfig);
        initIndexPersistableListener();
       
        _logger.info("opened indexHome=" + _indexHome.getAbsolutePath() + " storeHome=" + _storeHome.getAbsolutePath());
    }
View Full Code Here

TOP

Related Classes of krati.core.StoreConfig

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.