Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
func Run(ctx context.Context, getBlocks BlocksLoaderFunc, startingBlockNumber, maxBlockNumber uint64, batchSize int, processor BlockProcessorFunc) error
Run loads blocks using "getBlocks" and processes them using "processor" until:
- ctx is cancelled;
- maxBlockNumber param is not zero and block with that number has been processed;
- unrecoverable error is encountered.
Other parameters:
- startingBlockNumber is the first block number to ask for (using getBlocks) must be > 0;
- maxBlockNumber: when zero Run loads new blocks until ctx is cancelled, when not zero blocks are loaded until block with given number has been processed;
- batchSize how big batches to use (used for getBlocks parameter);
Run returns non-nil error unless maxBlockNumber param is not zero and that block is loaded and processed successfully.
Types ¶
type BlocksLoaderFunc ¶
Click to show internal directories.
Click to hide internal directories.