* @param valueSerializer The serializer used for values,defaults to {@link org.apache.camel.component.krati.serializer.KratiDefaultSerializer}.
* @return
*/
public static DataStore createDataStore(String path, int initialCapacity, int segmentFileSize, SegmentFactory segmentFactory,
HashFunction hashFunction, Serializer keySerializer, Serializer valueSerializer) {
DataStore 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 dynamicDataStore = new DynamicDataStore(storeConfig);
result = new SerializableObjectStore(dynamicDataStore, keySerializer, valueSerializer);
} catch (Exception e) {
throw new RuntimeCamelException("Failed to create Krati DataStore.", e);
}
return result;