Package krati.core

Examples of krati.core.StoreConfig


            Serializer<T> eventValueSerializer, Serializer<Clock> eventClockSerializer) throws Exception {
        this._id = id;
        this._eventBatchSize = batchSize;
       
        // Create config
        _clockStoreConfig = new StoreConfig(homeDir, initialCapacity);
        _clockStoreConfig.setBatchSize(batchSize);
        _clockStoreConfig.setNumSyncBatches(numSyncBatches);
        _clockStoreConfig.setSegmentFactory(storeSegmentFactory);
        _clockStoreConfig.setSegmentFileSizeMB(storeSegmentFileSizeMB);
       
View Full Code Here


   
    @Override
    protected void setUp() {
        try {
            File storeDir = DirUtils.getTestDir(getClass());
            StoreConfig config = new StoreConfig(storeDir, 100000);
            config.setBatchSize(getBatchSize());
            config.setNumSyncBatches(10);
            config.setSegmentFileSizeMB(32);
            config.setSegmentFactory(new WriteBufferSegmentFactory());
            config.setInt(StoreParams.PARAM_INDEX_SEGMENT_FILE_SIZE_MB, 8);
            config.setClass(StoreParams.PARAM_SEGMENT_FACTORY_CLASS, MemorySegmentFactory.class);
           
            _store = new IndexedDataStore(config);
        } catch(Exception e) {
            e.printStackTrace();
        }
View Full Code Here

*/
public class TestRandomKeyNumStaticStore extends TestRandomKeyNumStore {
   
    @Override
    protected DataStore<byte[], byte[]> createStore(File homeDir) throws Exception {
        StoreConfig config = new StoreConfig(homeDir, getCapacity());
        config.setSegmentFileSizeMB(getSegmentFileSizeMB());
        config.setSegmentFactory(createSegmentFactory());
       
        return StoreFactory.createStaticDataStore(config);
    }
View Full Code Here

    }
   
    public void testStoreConfig() throws Exception {
        File dir = FileUtils.getTestDir(getClass().getSimpleName());
       
        StoreConfig config = new StoreConfig(dir, 10000);
        assertTrue(config.getDataHandler() == null);
       
        config.setDataHandler(new DefaultDataSetHandler());
        config.save();
       
        StoreConfig config2 = new StoreConfig(dir, 10000);
        assertTrue(config2.getDataHandler() == null);
       
        config.setDataHandler(new DataSetHandler2());
        config.save();
       
        StoreConfig config3 = new StoreConfig(dir, 10000);
        assertTrue(config3.getDataHandler() != null);
        assertTrue(config3.getDataHandler().getClass() == DataSetHandler2.class);
       
        FileUtils.deleteDirectory(dir);
    }
View Full Code Here

        return getInitialCapacity() / 8;
    }
   
    @Override
    protected DataStore<byte[], byte[]> getDataStore(File storeDir) throws Exception {
        StoreConfig config = new StoreConfig(storeDir, getInitialCapacity());
       
        config.setBatchSize(10000);
        config.setNumSyncBatches(100);
       
        // Configure store segments
        config.setSegmentFactory(new krati.core.segment.WriteBufferSegmentFactory());
        config.setSegmentFileSizeMB(_segFileSizeMB);
        config.setSegmentCompactFactor(0.67);
       
        // Configure index segments
        config.setInt(StoreParams.PARAM_INDEX_SEGMENT_FILE_SIZE_MB, 32);
        config.setDouble(StoreParams.PARAM_INDEX_SEGMENT_COMPACT_FACTOR, 0.5);
       
        // Configure index initial capacity
        config.setInt(StoreParams.PARAM_INDEX_INITIAL_CAPACITY, getIndexInitialCapacity());
       
        // Configure to reduce memory footprint
        config.setDataHandler(new HashIndexDataHandler());
       
        // Disable linear hashing
        config.setHashLoadFactor(1.0);
       
        return StoreFactory.createIndexedDataStore(config);
    }
View Full Code Here

    protected int getCapacity() {
        return (int)Math.min((long)(getKeyCount() * 1.5), Integer.MAX_VALUE);
    }
   
    protected DataStore<byte[], byte[]> createStore(File homeDir) throws Exception {
        StoreConfig config = new StoreConfig(homeDir, getCapacity());
        config.setSegmentFileSizeMB(getSegmentFileSizeMB());
        config.setSegmentFactory(createSegmentFactory());
       
        return StoreFactory.createDynamicDataStore(config);
    }
View Full Code Here

*/
public class TestRandomKeyNumStoreIOType extends TestRandomKeyNumStore {
   
    @Override
    protected DataStore<byte[], byte[]> createStore(File homeDir) throws Exception {
        StoreConfig config = new StoreConfig(homeDir, getCapacity());
        config.setSegmentFileSizeMB(getSegmentFileSizeMB());
        config.setSegmentFactory(createSegmentFactory());
       
        // Do not cache indexes in memory
        config.setIndexesCached(false);
       
        return StoreFactory.createDynamicDataStore(config);
    }
View Full Code Here

    protected SegmentFactory getSegmentFactory() {
        return new krati.core.segment.WriteBufferSegmentFactory();
    }
   
    protected DataStore<byte[], byte[]> create(File storeDir) throws Exception {
        StoreConfig config = new StoreConfig(storeDir, getInitialCapacity());
        config.setSegmentFileSizeMB(16);
        config.setSegmentFactory(getSegmentFactory());
        config.setBatchSize(5000);
        config.setNumSyncBatches(10);
       
        return StoreFactory.createDynamicDataStore(config);
    }
View Full Code Here

*/
public class TestRandomKeyNumStaticStoreIOType extends TestRandomKeyNumStore {
   
    @Override
    protected DataStore<byte[], byte[]> createStore(File homeDir) throws Exception {
        StoreConfig config = new StoreConfig(homeDir, getCapacity());
        config.setSegmentFileSizeMB(getSegmentFileSizeMB());
        config.setSegmentFactory(createSegmentFactory());
       
        // Do not cache indexes in memory
        config.setIndexesCached(false);
       
        return StoreFactory.createStaticDataStore(config);
    }
View Full Code Here

            e.printStackTrace();
        }
    }
   
    protected DataSet<byte[]> createDataSet(File homeDir, int initialCapacity) throws Exception {
        StoreConfig config = new StoreConfig(homeDir, initialCapacity);
        config.setSegmentFactory(new MemorySegmentFactory());
        config.setSegmentFileSizeMB(32);
       
        return StoreFactory.createDynamicDataSet(config);
    }
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.