Search in sources :

Example 1 with RocksDBConfigurationBuilder

use of org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBConfigurationBuilder in project besu by hyperledger.

the class OperationBenchmarkHelper method create.

public static OperationBenchmarkHelper create() throws IOException {
    final Path storageDirectory = Files.createTempDirectory("benchmark");
    final KeyValueStorage keyValueStorage = new RocksDBKeyValueStorage(new RocksDBConfigurationBuilder().databaseDir(storageDirectory).build(), new NoOpMetricsSystem(), RocksDBMetricsFactory.PUBLIC_ROCKS_DB_METRICS);
    final ExecutionContextTestFixture executionContext = ExecutionContextTestFixture.builder().keyValueStorage(keyValueStorage).build();
    final MutableBlockchain blockchain = executionContext.getBlockchain();
    for (int i = 1; i < 256; i++) {
        blockchain.appendBlock(new Block(new BlockHeaderTestFixture().parentHash(blockchain.getChainHeadHash()).number(i).difficulty(Difficulty.ONE).buildHeader(), new BlockBody(emptyList(), emptyList())), emptyList());
    }
    final MessageFrame messageFrame = new MessageFrameTestFixture().executionContextTestFixture(executionContext).blockHeader(new BlockHeaderTestFixture().parentHash(blockchain.getChainHeadHash()).number(blockchain.getChainHeadBlockNumber() + 1).difficulty(Difficulty.ONE).buildHeader()).build();
    return new OperationBenchmarkHelper(storageDirectory, keyValueStorage, messageFrame, blockchain);
}
Also used : Path(java.nio.file.Path) BlockBody(org.hyperledger.besu.ethereum.core.BlockBody) RocksDBKeyValueStorage(org.hyperledger.besu.plugin.services.storage.rocksdb.unsegmented.RocksDBKeyValueStorage) KeyValueStorage(org.hyperledger.besu.plugin.services.storage.KeyValueStorage) MessageFrame(org.hyperledger.besu.evm.frame.MessageFrame) MessageFrameTestFixture(org.hyperledger.besu.ethereum.core.MessageFrameTestFixture) BlockHeaderTestFixture(org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture) NoOpMetricsSystem(org.hyperledger.besu.metrics.noop.NoOpMetricsSystem) RocksDBKeyValueStorage(org.hyperledger.besu.plugin.services.storage.rocksdb.unsegmented.RocksDBKeyValueStorage) RocksDBConfigurationBuilder(org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBConfigurationBuilder) ExecutionContextTestFixture(org.hyperledger.besu.ethereum.core.ExecutionContextTestFixture) Block(org.hyperledger.besu.ethereum.core.Block) MutableBlockchain(org.hyperledger.besu.ethereum.chain.MutableBlockchain)

Aggregations

Path (java.nio.file.Path)1 MutableBlockchain (org.hyperledger.besu.ethereum.chain.MutableBlockchain)1 Block (org.hyperledger.besu.ethereum.core.Block)1 BlockBody (org.hyperledger.besu.ethereum.core.BlockBody)1 BlockHeaderTestFixture (org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture)1 ExecutionContextTestFixture (org.hyperledger.besu.ethereum.core.ExecutionContextTestFixture)1 MessageFrameTestFixture (org.hyperledger.besu.ethereum.core.MessageFrameTestFixture)1 MessageFrame (org.hyperledger.besu.evm.frame.MessageFrame)1 NoOpMetricsSystem (org.hyperledger.besu.metrics.noop.NoOpMetricsSystem)1 KeyValueStorage (org.hyperledger.besu.plugin.services.storage.KeyValueStorage)1 RocksDBConfigurationBuilder (org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBConfigurationBuilder)1 RocksDBKeyValueStorage (org.hyperledger.besu.plugin.services.storage.rocksdb.unsegmented.RocksDBKeyValueStorage)1