public BlockIndexingJob( IBlockService blockService, IIndexingService indexingService, IIndexingSettings indexingSettings, ILog logger, IRpcBlockReader rpcBlockReader) { _blockService = blockService; _firstRun = true; _indexingService = indexingService; _indexingSettings = indexingSettings; _logger = logger; _rpcBlockReader = rpcBlockReader; }
public void State() { ReceiveAsync <Messages.Common.IndexedBlockNumberMessage>(async(message) => { var nextBlock = message.NextBlock; IIndexingSettings settings = null; IActorRef blockIndexingActor = null; _indexerSettingsDict.TryGetValue(message.IndexerId, out settings); _blockIndexingActors.TryGetValue(message.IndexerId, out blockIndexingActor); if (settings == null || blockIndexingActor == null) { return; } if (settings.To != null && nextBlock > settings.To) { return; } blockIndexingActor.Tell(Messages.BlockIndexingActor.CreateIndexBlockMessage(message.IndexerId, nextBlock)); }); }
public IJob GetJob(IIndexingSettings settings) { return(new BlockIndexingJob(_blockService, _indexingService, settings, _logger, _rpcBlockReader)); }