Package krati.store

Examples of krati.store.DynamicDataSet


    public static DataSet<byte[]> createDataSet(String path, int initialCapacity, SegmentFactory segmentFactory) {
        DataSet<byte[]> result = null;
        File homeDir = new File(path);
        homeDir.mkdirs();
        try {
            result = new DynamicDataSet(homeDir, initialCapacity, segmentFactory);
        } catch (Exception e) {
            throw new RuntimeCamelException("Failed to create Krati DataSet. This exception is ignored.", e);
        }
        return result;
    }
View Full Code Here


    public static DataSet<byte[]> createDataSet(String path, int initialCapacity, SegmentFactory segmentFactory) {
        DataSet<byte[]> result = null;
        File homeDir = new File(path);
        homeDir.mkdirs();
        try {
            result = new DynamicDataSet(homeDir, initialCapacity, segmentFactory);
        } catch (Exception e) {
            throw new RuntimeCamelException("Failed to create Krati DataSet.", e);
        }
        return result;
    }
View Full Code Here

     * @param config - DataSet configuration
     * @return A dynamic DataSet with growing capacity as needed.
     * @throws Exception if the set cannot be created.
     */
    public static DynamicDataSet createDynamicDataSet(StoreConfig config) throws Exception {
        return new DynamicDataSet(config);
    }
View Full Code Here

            int numSyncBatches,
            int segmentFileSizeMB,
            SegmentFactory segmentFactory,
            double segmentCompactFactor,
            double hashLoadFactor) throws Exception {
        return new DynamicDataSet(
                homeDir,
                StoreParams.getDynamicStoreInitialLevel(initialCapacity),
                batchSize,
                numSyncBatches,
                segmentFileSizeMB,
View Full Code Here

*/
public class TestDynamicDataSetApi extends AbstractTestDataSetApi {

    @Override
    protected DataSet<byte[]> createStore(File homeDir) throws Exception {
        return new DynamicDataSet(
                homeDir,
                1,     /* initLevel */
                100,   /* batchSize */
                5,     /* numSyncBatches */
                Segment.defaultSegmentFileSizeMB,
View Full Code Here

        super(TestDynamicDataSet.class.getSimpleName());
    }
   
    @Override
    protected DataSet<byte[]> getDataSet(File storeDir) throws Exception {
        return new DynamicDataSet(storeDir, 2 /* initLevel */, _segFileSizeMB, getSegmentFactory());
    }
View Full Code Here

    protected DynamicDataSet create(int initialCapacity) throws Exception {
        File storeDir = DirUtils.getTestDir(getClass());
        StoreConfig config = new StoreConfig(storeDir, initialCapacity);
        config.setSegmentFactory(new ChannelSegmentFactory());
        config.setSegmentFileSizeMB(16);
        return new DynamicDataSet(config);
    }
View Full Code Here

            e.printStackTrace();
        }
    }
   
    protected void doInitialCapacity(int initialCapacity) throws Exception {
        DynamicDataSet store = create(initialCapacity);
        int capacity = store.capacity();
        if(initialCapacity == DynamicConstants.SUB_ARRAY_SIZE) {
            assertEquals(initialCapacity, capacity);
        } else {
            assertTrue(capacity >= initialCapacity);
        }
        store.close();

        int initialCapacity2 = capacity + _rand.nextInt(capacity);
        DynamicDataSet store2 = create(initialCapacity2);
        assertEquals(capacity, store2.capacity());
        store2.close();

        int initialCapacity3 = capacity - _rand.nextInt(capacity);
        DynamicDataSet store3 = create(initialCapacity3);
        assertEquals(capacity, store3.capacity());
        store3.close();
    }
View Full Code Here

        doInitialCapacity(DynamicConstants.SUB_ARRAY_SIZE - _rand.nextInt(10000));
    }
   
    protected void doInitialCapacityLevel(int initLevel) throws Exception {
        int initialCapacity = DynamicConstants.SUB_ARRAY_SIZE << initLevel;
        DynamicDataSet store = create(initialCapacity);
        int capacity = store.capacity();
        assertEquals(initialCapacity, capacity);
        store.close();
       
        int initialCapacity2 = capacity + _rand.nextInt(capacity);
        DynamicDataSet store2 = create(initialCapacity2);
        assertEquals(capacity, store2.capacity());
        store2.close();
       
        int initialCapacity3 = capacity - _rand.nextInt(capacity);
        DynamicDataSet store3 = create(initialCapacity3);
        assertEquals(capacity, store3.capacity());
        store3.close();
    }
View Full Code Here

    public static DataSet createDataSet(String path, int initialCapacity, SegmentFactory segmentFactory) {
        DataSet result = null;
        File homeDir = new File(path);
        homeDir.mkdirs();
        try {
            result = new DynamicDataSet(homeDir, initialCapacity, segmentFactory);
        } catch (Exception e) {
            throw new RuntimeCamelException("Failed to create Krati DataSet.", e);
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of krati.store.DynamicDataSet

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.