public Erc20BalanceIndexingJobFactory( IErc20BalanceIndexingService indexingService, ILog logger) { _indexingService = indexingService; _logger = logger; }
public Erc20BalanceIndexingActor( IErc20BalanceIndexingService indexingService, ILog logger, ulong startFrom) { _indexingService = indexingService; _logger = logger; _startFrom = startFrom; ReceiveAsync <Messages.Erc20BalanceIndexingActor.IndexBlockMessage>(async(message) => { var sender = Sender; var blockNumber = message.BlockNumber; await _indexingService.IndexBlockAsync(blockNumber, Version); await _logger.WriteInfoAsync ( nameof(Erc20BalanceIndexingJob), nameof(ReceiveAsync), "Block balances indexed", $"Indexed balances of block {blockNumber}.", DateTime.UtcNow ); sender.Tell(new Success(true)); }); }
public Erc20BalanceIndexingJob( IErc20BalanceIndexingService indexingService, ILog logger, ulong startFrom) { _indexingService = indexingService; _logger = logger; _startFrom = startFrom; }
public Erc20BalanceIndexingActorDispatcher( IErc20BalanceIndexingService indexingService, ILog logger, ulong startFrom, IErc20BalanceIndexingActorFactory erc20BalanceIndexingActorFactory) { _indexingService = indexingService; _logger = logger; _startFrom = startFrom; _erc20BalanceIndexingActor = erc20BalanceIndexingActorFactory.Build(Context, "erc20BalanceIndexingActor"); ReceiveAsync <Messages.Common.DoIterationMessage>(async(message) => { var nextBlockToIndex = await _indexingService.GetNextBlockToIndexAsync(_startFrom); if (nextBlockToIndex.HasValue) { await _erc20BalanceIndexingActor.Ask( Messages.Erc20BalanceIndexingActor.CreateIndexBlockMessage(nextBlockToIndex.Value), TimeSpan.FromSeconds(30)); } Self.Tell(Messages.Common.CreateDoIterationMessage()); }); }