The Block Stream Simulator is designed to simulate block streaming for Hedera Hashgraph. It uses various configuration sources and dependency injection to manage its components.
Uses Dagger2 for dependency injection, the project has a modular structure and divides the Dagger dependencies into modules, but all modules used can be found at the root Injection Module:
src/java/com/hedera/block/simulator/BlockStreamSimulatorInjectionModule.java
Entry point for the project is BlockStreamSimulator.java
, in wich the main method is located and has 2 functions:
- Create/Load the Application Configuration, it does this using Hedera Platform Configuration API.
- Create a DaggerComponent and instantiate the BlockStreamSimulatorApp class using the DaggerComponent and it registered dependencies.
- Start the BlockStreamSimulatorApp, contains the orchestration of the different parts of the simulation using generic interfaces and handles the rate of streaming and the exit conditions.
The BlockStreamSimulatorApp consumes other services that are injected using DaggerComponent, these are:
- generator: responsible for generating blocks, exposes a single interface
BlockStreamManager
and several implementations- BlockAsDirBlockStreamManager: generates blocks from a directory, each folder is a block, and block-items are single 'blk' or 'blk.gz' files.
- BlockAsFileBlockStreamManager: generates blocks from a single file, each file is a block, used to the format of the CN recordings. (since it loads blocks on memory it can stream really fast, really useful for simple streaming tests)
- BlockAsFileLargeDataSets: similar to BlockAsFileBLockStreamManager, but designed to work with GB folders with thousands of big blocks (since it has a high size block and volume of blocks, is useful for performace, load and stress testing)
- grpc: responsible for the communication with the Block-Node, currently only has 1 interface
PublishStreamGrpcClient
and 1 Implementation, however also exposes a `PublishStreamObserver'
Refer to the Configuration for configuration options.
Refer to the Quickstart for a quick guide on how to get started with the application.