/** * Creates a dynamic {@link krati.store.DataStore DataStore} which grows its capacity as needed. * * <p>It is recommended to have an <code>initialCapacity</code> which is large enough to hold the * total number of keys eventually added to this store. This can reduce hash conflicts and yield * better performance. * * @param homeDir - the store home directory * @param initialCapacity - the initial capacity which should not be changed after the store is * created * @param batchSize - the number of updates per update batch * @param numSyncBatches - the number of update batches required for updating the underlying * indexes * @param segmentFileSizeMB - the segment size in MB * @param segmentFactory - the segment factory * @param segmentCompactFactor - the segment load threshold, below which a segment is eligible for * compaction * @param hashLoadFactor - the load factor of the underlying hash table * @return A dynamic DataStore with growing capacity as needed. * @throws Exception if the store cannot be created. */ public static DynamicDataStore createDynamicDataStore( File homeDir, int initialCapacity, int batchSize, int numSyncBatches, int segmentFileSizeMB, SegmentFactory segmentFactory, double segmentCompactFactor, double hashLoadFactor) throws Exception { return new DynamicDataStore( homeDir, StoreParams.getDynamicStoreInitialLevel(initialCapacity), batchSize, numSyncBatches, segmentFileSizeMB, segmentFactory, segmentCompactFactor, hashLoadFactor, new FnvHashFunction()); }
/** * Creates a dynamic {@link krati.store.DataStore DataStore} which grows its capacity as needed. * The store created has the default parameters below. * * <pre> * segmentCompactFactor : 0.5 * hashLoadFactor : 0.75 * </pre> * * <p>It is recommended to have an <code>initialCapacity</code> which is large enough to hold the * total number of keys eventually added to this store. This can reduce hash conflicts and yield * better performance. * * <p>{@link krati.store.IndexedDataStore IndexedDataStore} is suitable for very large data sets * in which the number of keys can fit into memory and the total bytes of all values is * significantly larger than the available memory. * * @param homeDir - the store home directory * @param initialCapacity - the initial capacity which should not be changed after the store is * created * @param batchSize - the number of updates per update batch * @param numSyncBatches - the number of update batches required for updating the underlying * indexes * @param indexSegmentFileSizeMB - the index segment size in MB with a recommended range from 8 to * 32 * @param indexSegmentFactory - the index segment factory, {@link * krati.core.segment.MemorySegmentFactory MemorySegmentFactory} recommended * @param storeSegmentFileSizeMB - the store segment size in MB with a recommended range from 8 to * 256 * @param storeSegmentFactory - the store segment factory, {@link * krati.core.segment.WriteBufferSegmentFactory WriteBufferSegmentFactory} recommended * @return A dynamic DataStore with growing capacity as needed. * @throws Exception if the store cannot be created. */ public static IndexedDataStore createIndexedDataStore( File homeDir, int initialCapacity, int batchSize, int numSyncBatches, int indexSegmentFileSizeMB, SegmentFactory indexSegmentFactory, int storeSegmentFileSizeMB, SegmentFactory storeSegmentFactory) throws Exception { int initLevel = StoreParams.getDynamicStoreInitialLevel(initialCapacity); return new IndexedDataStore( homeDir, batchSize, numSyncBatches, initLevel, indexSegmentFileSizeMB, indexSegmentFactory, initLevel, storeSegmentFileSizeMB, storeSegmentFactory); }