use of com.bakdata.conquery.io.storage.xodus.stores.CachedStore in project conquery by bakdata.
the class XodusStoreFactory method createStore.
public <KEY, VALUE> Store<KEY, VALUE> createStore(Environment environment, Validator validator, StoreMappings storeId, ObjectMapper objectMapper) {
final StoreInfo<KEY, VALUE> storeInfo = storeId.storeInfo();
synchronized (openStoresInEnv) {
if (openStoresInEnv.get(environment).stream().map(XodusStore::getName).anyMatch(name -> storeInfo.getName().equals(name))) {
throw new IllegalStateException("Attempted to open an already opened store:" + storeInfo.getName());
}
final XodusStore store = new XodusStore(environment, storeInfo.getName(), this::closeStore, this::removeStore);
openStoresInEnv.put(environment, store);
return new CachedStore<>(new SerializingStore<>(store, validator, objectMapper, storeInfo.getKeyType(), storeInfo.getValueType(), this.isValidateOnWrite(), this.isRemoveUnreadableFromStore(), this.getUnreadableDataDumpDirectory()));
}
}
Aggregations