/// <summary>
        /// Public constructor for unit testing
        /// </summary>
        public BlockStoreLoop(IAsyncLoopFactory asyncLoopFactory,
                              StoreBlockPuller blockPuller,
                              BlockRepository blockRepository,
                              BlockStoreCache cache,
                              ConcurrentChain chain,
                              ChainState chainState,
                              NodeSettings nodeArgs,
                              INodeLifetime nodeLifetime,
                              ILoggerFactory loggerFactory,
                              string name = "BlockStore")
        {
            this.name             = name;
            this.asyncLoopFactory = asyncLoopFactory;
            this.BlockPuller      = blockPuller;
            this.BlockRepository  = blockRepository;
            this.Chain            = chain;
            this.ChainState       = chainState;
            this.blockStoreCache  = cache;
            this.nodeLifetime     = nodeLifetime;
            this.nodeArgs         = nodeArgs;
            this.storeLogger      = loggerFactory.CreateLogger(GetType().FullName);

            this.PendingStorage  = new ConcurrentDictionary <uint256, BlockPair>();
            this.blockStoreStats = new BlockStoreStats(this.BlockRepository, this.blockStoreCache, this.storeLogger);
        }
Ejemplo n.º 2
0
 public BlockStoreStats(IBlockRepository blockRepository, IBlockStoreCache blockStoreCache, ILogger logger)
 {
     this.repository             = blockRepository;
     this.cache                  = blockStoreCache as BlockStoreCache;
     this.logger                 = logger;
     this.lastRepositorySnapshot = this.repository?.PerformanceCounter.Snapshot();
     this.lastCacheSnapshot      = this.cache?.PerformanceCounter.Snapshot();
 }
 public BlockStoreFeature(ConcurrentChain chain, IConnectionManager connectionManager, Signals.Signals signals, BlockRepository blockRepository,
                          BlockStoreCache blockStoreCache, StoreBlockPuller blockPuller, BlockStoreLoop blockStoreLoop, BlockStoreManager blockStoreManager,
                          BlockStoreSignaled blockStoreSignaled, INodeLifetime nodeLifetime, NodeSettings nodeSettings, ILoggerFactory loggerFactory)
 {
     this.chain              = chain;
     this.signals            = signals;
     this.blockRepository    = blockRepository;
     this.blockStoreCache    = blockStoreCache;
     this.blockPuller        = blockPuller;
     this.blockStoreLoop     = blockStoreLoop;
     this.blockStoreManager  = blockStoreManager;
     this.blockStoreSignaled = blockStoreSignaled;
     this.nodeLifetime       = nodeLifetime;
     this.connectionManager  = connectionManager;
     this.nodeSettings       = nodeSettings;
     this.storeLogger        = loggerFactory.CreateLogger(this.GetType().FullName);
 }
 public BlockStoreBehavior(ConcurrentChain chain, BlockRepository blockRepository, BlockStoreCache blockStoreCache, ILogger logger)
     : this(chain, blockRepository as IBlockRepository, blockStoreCache as IBlockStoreCache, logger)
 {
 }