Search in sources :

Example 1 with CacheSnapshotHandler

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);
}
Also used : TrieStoreImpl(co.rsk.trie.TrieStoreImpl) DataSourceWithCache(org.ethereum.datasource.DataSourceWithCache) KeyValueDataSource(org.ethereum.datasource.KeyValueDataSource) CacheSnapshotHandler(org.ethereum.datasource.CacheSnapshotHandler)

Example 2 with CacheSnapshotHandler

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;
}
Also used : Path(java.nio.file.Path) DataSourceWithCache(org.ethereum.datasource.DataSourceWithCache) KeyValueDataSource(org.ethereum.datasource.KeyValueDataSource) CacheSnapshotHandler(org.ethereum.datasource.CacheSnapshotHandler)

Aggregations

CacheSnapshotHandler (org.ethereum.datasource.CacheSnapshotHandler)2 DataSourceWithCache (org.ethereum.datasource.DataSourceWithCache)2 KeyValueDataSource (org.ethereum.datasource.KeyValueDataSource)2 TrieStoreImpl (co.rsk.trie.TrieStoreImpl)1 Path (java.nio.file.Path)1