use of org.ethereum.datasource.CacheSnapshotHandler in project rskj by rsksmart.
the class RskContext method buildTrieStore.
protected synchronized TrieStore buildTrieStore(Path trieStorePath) {
checkIfNotClosed();
int statesCacheSize = getRskSystemProperties().getStatesCacheSize();
KeyValueDataSource ds = LevelDbDataSource.makeDataSource(trieStorePath);
if (statesCacheSize != 0) {
CacheSnapshotHandler cacheSnapshotHandler = getRskSystemProperties().shouldPersistStatesCacheSnapshot() ? new CacheSnapshotHandler(resolveCacheSnapshotPath(trieStorePath)) : null;
ds = new DataSourceWithCache(ds, statesCacheSize, cacheSnapshotHandler);
}
return new TrieStoreImpl(ds);
}
use of org.ethereum.datasource.CacheSnapshotHandler in project rskj by rsksmart.
the class RskContext method buildBlocksBloomDataSource.
protected synchronized KeyValueDataSource buildBlocksBloomDataSource() {
checkIfNotClosed();
int bloomsCacheSize = getRskSystemProperties().getBloomsCacheSize();
Path bloomsStorePath = Paths.get(getRskSystemProperties().databaseDir(), "blooms");
KeyValueDataSource ds = LevelDbDataSource.makeDataSource(bloomsStorePath);
if (bloomsCacheSize != 0) {
CacheSnapshotHandler cacheSnapshotHandler = getRskSystemProperties().shouldPersistBloomsCacheSnapshot() ? new CacheSnapshotHandler(resolveCacheSnapshotPath(bloomsStorePath)) : null;
ds = new DataSourceWithCache(ds, bloomsCacheSize, cacheSnapshotHandler);
}
return ds;
}
Aggregations