Search in sources :

Example 1 with CachedStore

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()));
    }
}
Also used : XodusStore(com.bakdata.conquery.io.storage.xodus.stores.XodusStore) CachedStore(com.bakdata.conquery.io.storage.xodus.stores.CachedStore) WeakCachedStore(com.bakdata.conquery.io.storage.xodus.stores.WeakCachedStore)

Aggregations

CachedStore (com.bakdata.conquery.io.storage.xodus.stores.CachedStore)1 WeakCachedStore (com.bakdata.conquery.io.storage.xodus.stores.WeakCachedStore)1 XodusStore (com.bakdata.conquery.io.storage.xodus.stores.XodusStore)1