public BlockTransactionsListener( BlockHeaderReadEvent blockHeader, IMessagePublisher messagePublisher, IRawObjectWriteOnlyRepository rawObjectsRepository, int transactionsBatchSize, int maxTransactionsSavingParallelism, BlockchainTransferModel transferModel) { if (transactionsBatchSize <= 0) { throw new ArgumentOutOfRangeException(nameof(transactionsBatchSize), transactionsBatchSize, "Should be positive number"); } if (maxTransactionsSavingParallelism <= 0) { throw new ArgumentOutOfRangeException(nameof(transactionsBatchSize), transactionsBatchSize, "Should be positive number"); } _blockHeader = blockHeader; _messagePublisher = messagePublisher; _rawObjectsRepository = rawObjectsRepository; _transactionsBatchSize = transactionsBatchSize; _tailTransactionsBatchExtensionSize = transactionsBatchSize * 20 / 100; // 20% _transferModel = transferModel; _transferAmountExecutedTransactions = new List <TransferAmountExecutedTransaction>(_transactionsBatchSize); _transferCoinsExecutedTransactions = new List <TransferCoinsExecutedTransaction>(_transactionsBatchSize); _failedTransactions = new List <FailedTransaction>(_transactionsBatchSize); _rawTransactionsPersistenceTasks = new List <Task>(blockHeader.BlockTransactionsCount); _remainedTransactionsCount = blockHeader.BlockTransactionsCount; _rawTransactionsPersistenceParallelismGuard = new SemaphoreSlim(maxTransactionsSavingParallelism); }
public ReadBlockCommandsHandler( IBlockReader blockReader, IRawObjectWriteOnlyRepository rawObjectRepository, int transactionsBatchSize, int maxTransactionsSavingParallelism, BlockchainTransferModel transferModel) { _blockReader = blockReader; _rawObjectRepository = rawObjectRepository; _transactionsBatchSize = transactionsBatchSize; _maxTransactionsSavingParallelism = maxTransactionsSavingParallelism; _transferModel = transferModel; }
public BlockListener( IMessagePublisher messagePublisher, IRawObjectWriteOnlyRepository rawObjectsRepository, int transactionsBatchSize, int maxTransactionsSavingParallelism, BlockchainTransferModel transferModel) { _messagePublisher = messagePublisher; _rawObjectsRepository = rawObjectsRepository; _transactionsBatchSize = transactionsBatchSize; _maxTransactionsSavingParallelism = maxTransactionsSavingParallelism; _transferModel = transferModel; }