Пример #1
0
 public SynchronizationBlocksHandler(IStatesRepository statesRepository, ISynchronizationProducer synchronizationProducer, ISerializersFactory serializersFactory,
                                     IIdentityKeyProvidersRegistry identityKeyProvidersRegistry, INodesRatingProviderFactory nodesRatingProvidersFactory, IServerCommunicationServicesRegistry communicationServicesRegistry, ISyncRegistryMemPool syncRegistryMemPool)
 {
     _synchronizationContext        = statesRepository.GetInstance <ISynchronizationContext>();
     _synchronizationProducer       = synchronizationProducer;
     _nodeContext                   = statesRepository.GetInstance <INodeContext>();
     _neighborhoodState             = statesRepository.GetInstance <INeighborhoodState>();
     _serializersFactory            = serializersFactory;
     _communicationServicesRegistry = communicationServicesRegistry;
     _syncRegistryMemPool           = syncRegistryMemPool;
     _identityKeyProvider           = identityKeyProvidersRegistry.GetInstance();
     _synchronizationBlocks         = new BlockingCollection <SynchronizationBlockBase>();
     _retransmittedBlocks           = new BlockingCollection <SynchronizationBlockRetransmissionV1>();
     _synchronizationBlocksByHeight = new Dictionary <ulong, Dictionary <IKey, List <SynchronizationBlockRetransmissionV1> > >();
     _nodesRatingProvider           = nodesRatingProvidersFactory.GetInstance(PacketType.Transactional);
 }
Пример #2
0
 public SynchronizationGroupParticipationService(ISynchronizationProducer synchronizationProducer, IStatesRepository statesRepository,
                                                 INodesRatingProviderFactory nodesRatingProvidersFactory, ILoggerService loggerService)
 {
     _synchronizationProducer   = synchronizationProducer;
     _nodesRatingProvider       = nodesRatingProvidersFactory.GetInstance(PacketType.Transactional);
     _synchronizationContext    = statesRepository.GetInstance <ISynchronizationContext>();
     _accountState              = statesRepository.GetInstance <IAccountState>();
     _synchronizationGroupState = statesRepository.GetInstance <ISynchronizationGroupState>();
     _synchronizationGroupParticipationCheckAction = new TransformBlock <string, string>((Func <string, string>)SynchronizationGroupParticipationCheckAction, new ExecutionDataflowBlockOptions {
         MaxDegreeOfParallelism = 1
     });
     _synchronizationGroupLeaderCheckAction = new ActionBlock <string>((Action <string>)SynchronizationGroupLeaderCheckAction, new ExecutionDataflowBlockOptions {
         MaxDegreeOfParallelism = 1
     });
     _logger = loggerService.GetLogger(nameof(SynchronizationGroupParticipationService));
 }