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);
}
Aggregations