use of org.ethereum.datasource.DataSourceWithCache 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.DataSourceWithCache in project rskj by rsksmart.
the class RskContext method buildReceiptStore.
protected synchronized ReceiptStore buildReceiptStore() {
checkIfNotClosed();
int receiptsCacheSize = getRskSystemProperties().getReceiptsCacheSize();
KeyValueDataSource ds = LevelDbDataSource.makeDataSource(Paths.get(getRskSystemProperties().databaseDir(), "receipts"));
if (receiptsCacheSize != 0) {
ds = new DataSourceWithCache(ds, receiptsCacheSize);
}
return new ReceiptStoreImplV2(ds);
}
use of org.ethereum.datasource.DataSourceWithCache 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;
}
use of org.ethereum.datasource.DataSourceWithCache in project rskj by rsksmart.
the class RskContext method buildStateRootsStore.
protected StateRootsStore buildStateRootsStore() {
checkIfNotClosed();
int stateRootsCacheSize = getRskSystemProperties().getStateRootsCacheSize();
KeyValueDataSource stateRootsDB = LevelDbDataSource.makeDataSource(Paths.get(getRskSystemProperties().databaseDir(), "stateRoots"));
if (stateRootsCacheSize > 0) {
stateRootsDB = new DataSourceWithCache(stateRootsDB, stateRootsCacheSize);
}
return new StateRootsStoreImpl(stateRootsDB);
}
Aggregations