Example #1
0
        public void Start()
        {
            _logger.Info("Starting");
            if (_isStarted)
            {
                _logger.Info("Already started");
                return;
            }

            lock (_sync)
            {
                if (_isStarted)
                {
                    _logger.Info("Already started");
                    return;
                }

                _synchronizationContext.SubscribeOnStateChange(_synchronizationGroupParticipationCheckAction);

                _isStarted = true;

                _synchronizationGroupParticipationCheckAction.Post(null);
            }

            _logger.Info("Started");
        }
Example #2
0
 public TransactionsRegistrySyncHandler(IStatesRepository statesRepository, ISyncShardsManager syncShardsManager, IIdentityKeyProvidersRegistry identityKeyProvidersRegistry,
                                        ICryptoService cryptoService, ISerializersFactory signatureSupportSerializersFactory, IHashCalculationsRepository hashCalculationsRepository,
                                        IServerCommunicationServicesRegistry communicationServicesRegistry, ISyncRegistryMemPool syncRegistryMemPool, INodesResolutionService nodesResolutionService,
                                        IChainDataServicesManager chainDataServicesManager, IRawPacketProvidersFactory rawPacketProvidersFactory, ILoggerService loggerService)
 {
     _registryBlocks                = new BlockingCollection <RegistryBlockBase>();
     _synchronizationContext        = statesRepository.GetInstance <ISynchronizationContext>();
     _syncRegistryNeighborhoodState = statesRepository.GetInstance <ISyncRegistryNeighborhoodState>();
     _syncContextChangedUnsibsciber = _synchronizationContext.SubscribeOnStateChange(new ActionBlock <string>((Action <string>)SynchronizationStateChanged));
     _syncShardsManager             = syncShardsManager;
     _transactionHashKey            = identityKeyProvidersRegistry.GetTransactionsIdenityKeyProvider();
     _cryptoService = cryptoService;
     _signatureSupportSerializersFactory = signatureSupportSerializersFactory;
     _defaultTransactionHashCalculation  = hashCalculationsRepository.Create(Globals.DEFAULT_HASH);
     _powCalculation = hashCalculationsRepository.Create(Globals.POW_TYPE);
     _communicationServicesRegistry   = communicationServicesRegistry;
     _syncRegistryMemPool             = syncRegistryMemPool;
     _nodesResolutionService          = nodesResolutionService;
     _rawPacketProvidersFactory       = rawPacketProvidersFactory;
     _synchronizationChainDataService = chainDataServicesManager.GetChainDataService(PacketType.Synchronization);
     _registryChainDataService        = chainDataServicesManager.GetChainDataService(PacketType.Registry);
     _logger = loggerService.GetLogger(nameof(TransactionsRegistrySyncHandler));
 }
Example #3
0
 public ShardsManager(IStatesRepository statesRepository, INodesDataService nodesDataService)
 {
     _synchronizationContext         = statesRepository.GetInstance <ISynchronizationContext>();
     _syncContextChangedUnsibscriber = _synchronizationContext.SubscribeOnStateChange(new ActionBlock <string>((Action <string>)OnSyncContextChanged));
     _nodesDataService = nodesDataService;
 }
Example #4
0
 public void Start()
 {
     _syncContextUnsubscriber = _synchronizationContext.SubscribeOnStateChange(new ActionBlock <string>((Action <string>)OnSyncContextChanged));
 }