Package krati.core

Examples of krati.core.StoreConfig


                                            HashFunction<byte[]> hashFunction, Serializer<K> keySerializer, Serializer<V> valueSerializer) {
        DataStore<K, V> result = null;
        File homeDir = new File(path);
        homeDir.mkdirs();
        try {
            StoreConfig storeConfig = new StoreConfig(homeDir, initialCapacity);
            storeConfig.setSegmentFactory(segmentFactory);
            storeConfig.setHashFunction(hashFunction);
            storeConfig.setSegmentFileSizeMB(segmentFileSize);
            DataStore<byte[], byte[]> dynamicDataStore = new DynamicDataStore(storeConfig);
            result = new SerializableObjectStore<K, V>(dynamicDataStore, keySerializer, valueSerializer);
        } catch (Exception e) {
            throw new RuntimeCamelException("Failed to create Krati DataStore.", e);
        }
View Full Code Here


                                            HashFunction<byte[]> hashFunction, Serializer<K> keySerializer, Serializer<V> valueSerializer) {
        DataStore<K, V> result = null;
        File homeDir = new File(path);
        homeDir.mkdirs();
        try {
            StoreConfig storeConfig = new StoreConfig(homeDir, initialCapacity);
            storeConfig.setSegmentFactory(segmentFactory);
            storeConfig.setHashFunction(hashFunction);
            storeConfig.setSegmentFileSizeMB(segmentFileSize);
            DataStore<byte[], byte[]> dynamicDataStore = new DynamicDataStore(storeConfig);
            result = new SerializableObjectStore<K, V>(dynamicDataStore, keySerializer, valueSerializer);
        } catch (Exception e) {
            throw new RuntimeCamelException("Failed to create Krati DataStore.", e);
        }
View Full Code Here

    this.mainArray.expandCapacity(length - 1);
   
    final int segmentFileSizeMB = 64;
    final File bytesDBHomeDir = new File(homeDir, "BytesDB");
   
    StoreConfig config = new StoreConfig(bytesDBHomeDir, length);
    config.setBatchSize(batchSize);
    config.setNumSyncBatches(numSyncBatches);
    config.setSegmentFileSizeMB(segmentFileSizeMB);
    config.setSegmentFactory(segmentFactory);
    this.internalDB = new BytesDB(config);
  }
View Full Code Here

    protected SegmentFactory createSegmentFactory() {
        return new krati.core.segment.MemorySegmentFactory();
    }
   
    protected DataStore<byte[], byte[]> createDataStore(File storeDir, int capacity) throws Exception {
        StoreConfig config = new StoreConfig(storeDir, capacity);
        config.setSegmentFactory(createSegmentFactory());
        config.setSegmentFileSizeMB(32);
        config.setNumSyncBatches(2);
        config.setBatchSize(100);
       
        return StoreFactory.createStaticDataStore(config);
    }
View Full Code Here

       
        // Set homeDir
        this._homeDir = homeDir;
       
        // Create/validate/store config
        _config = new StoreConfig(_homeDir, initialCapacity);
        _config.setBatchSize(batchSize);
        _config.setNumSyncBatches(numSyncBatches);
        _config.setSegmentFileSizeMB(segmentFileSizeMB);
        _config.setSegmentCompactFactor(segmentCompactFactor);
        _config.setSegmentFactory(segmentFactory);
View Full Code Here

    protected int getRandomIndex() {
        return getIndexStart() + _rand.nextInt(_store.capacity());
    }
   
    protected SerializableObjectArray<String> createStore(File homeDir) throws Exception {
        StoreConfig config = new StoreConfig(homeDir, 1000);
        ArrayStore arrayStore = StoreFactory.createDynamicArrayStore(config);
        return new SerializableObjectArray<String>(arrayStore, new StringSerializerUtf8());
    }
View Full Code Here

*/
public class TestDynamicDataArrayIterator extends AbstractTestArrayStoreIterator {
   
    @Override
    protected ArrayStore createStore(File homeDir) throws Exception {
        StoreConfig config = new StoreConfig(homeDir, 1000);
        return StoreFactory.createDynamicArrayStore(config);
    }
View Full Code Here

            e.printStackTrace();
        }
    }
   
    protected DataStore<byte[], byte[]> createDataStore(File homeDir, int initialCapacity) throws Exception {
        StoreConfig config = new StoreConfig(homeDir, initialCapacity);
        config.setSegmentFactory(new MemorySegmentFactory());
        config.setSegmentFileSizeMB(32);
       
        return StoreFactory.createIndexedDataStore(config);
    }
View Full Code Here

    }
   
    public void testStoreConfig() throws Exception {
        File dir = FileUtils.getTestDir(getClass().getSimpleName());
       
        StoreConfig config;
        DynamicDataStore store;
       
        config = new StoreConfig(dir, 10000);
        config.setSegmentFileSizeMB(32);
        assertTrue(config.getDataHandler() == null);
        config.setDataHandler(createDataStoreHandler());
        assertTrue(config.getDataHandler() != null);
       
        byte[] key = "key".getBytes();
        byte[] value = randomValue();
        store = new DynamicDataStore(config);
        store.put(key, value);
        assertTrue(Arrays.equals(value, store.get(key)));
        store.close();
       
        StoreConfig config2 = StoreConfig.newInstance(dir);
        assertTrue(config2.getDataHandler() != null);
        assertEquals(config.getDataHandler().getClass(), config2.getDataHandler().getClass());
       
        store = new DynamicDataStore(config2);
        assertTrue(Arrays.equals(value, store.get(key)));
        store.close();
       
View Full Code Here

                           double segmentCompactFactor,
                           HashFunction<byte[]> hashFunction) throws Exception {
        this._homeDir = homeDir;
       
        // Create/validate/store config
        _config = new StoreConfig(_homeDir, capacity);
        _config.setBatchSize(batchSize);
        _config.setNumSyncBatches(numSyncBatches);
        _config.setSegmentFactory(segmentFactory);
        _config.setSegmentFileSizeMB(segmentFileSizeMB);
        _config.setSegmentCompactFactor(segmentCompactFactor);
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.