Пример #1
0
        public RepositoryHandlerContext(IBlockchainStoreRepositoryFactory repositoryFactory)
        {
            BlockRepository              = repositoryFactory.CreateBlockRepository();
            ContractRepository           = repositoryFactory.CreateContractRepository();
            TransactionRepository        = repositoryFactory.CreateTransactionRepository();
            AddressTransactionRepository = repositoryFactory.CreateAddressTransactionRepository();
            TransactionLogRepository     = repositoryFactory.CreateTransactionLogRepository();
            TransactionVmStackRepository = repositoryFactory.CreateTransactionVmStackRepository();

            _repositories.Add(BlockRepository);
            _repositories.Add(ContractRepository);
            _repositories.Add(TransactionLogRepository);
            _repositories.Add(AddressTransactionRepository);
            _repositories.Add(TransactionLogRepository);
            _repositories.Add(TransactionVmStackRepository);

            Handlers = new HandlerContainer
            {
                BlockHandler              = new BlockRepositoryHandler(BlockRepository),
                ContractHandler           = new ContractRepositoryHandler(ContractRepository),
                TransactionHandler        = new TransactionRepositoryHandler(TransactionRepository),
                TransactionLogHandler     = new TransactionLogRepositoryHandler(TransactionLogRepository),
                TransactionVmStackHandler = new TransactionVMStackRepositoryHandler(TransactionVmStackRepository)
            };
        }
 public virtual async Task BlockRepositoryTests()
 {
     var repo = _repositoryFactory.CreateBlockRepository();
     try
     {
         await new BlockRepositoryTests(repo).RunAsync();
     }
     finally
     {
         if(repo is IDisposable dispRep)
             dispRep.Dispose();
     }
 } 
        public PersistenceStrategy(
            IBlockchainStoreRepositoryFactory repositoryFactory,
            FilterContainer filters,
            IWaitStrategy waitStrategy    = null,
            int maxRetries                = 3,
            long minimumBlockNumber       = 0,
            int minimumBlockConfirmations = 6)
        {
            MinimumBlockNumber        = minimumBlockNumber;
            MaxRetries                = maxRetries;
            MinimumBlockConfirmations = minimumBlockConfirmations;
            Filters             = filters;
            _waitStrategy       = waitStrategy ?? new WaitStrategy();
            _blockRepository    = repositoryFactory.CreateBlockRepository();
            _contractRepository = repositoryFactory.CreateContractRepository();

            var transactionRepository        = repositoryFactory.CreateTransactionRepository();
            var addressTransactionRepository = repositoryFactory.CreateAddressTransactionRepository();
            var logRepository     = repositoryFactory.CreateTransactionLogRepository();
            var vmStackRepository = repositoryFactory.CreateTransactionVmStackRepository();

            _repositories.Add(_blockRepository);
            _repositories.Add(_contractRepository);
            _repositories.Add(transactionRepository);
            _repositories.Add(addressTransactionRepository);
            _repositories.Add(logRepository);
            _repositories.Add(vmStackRepository);

            BlockHandler              = new BlockRepositoryHandler(_blockRepository);
            TransactionHandler        = new TransactionRepositoryHandler(transactionRepository, addressTransactionRepository);
            ContractHandler           = new ContractRepositoryHandler(_contractRepository);
            TransactionVmStackHandler = new TransactionVMStackRepositoryHandler(vmStackRepository);
            TransactionLogHandler     = new TransactionLogRepositoryHandler(logRepository);

            _waitStrategy = new WaitStrategy();
        }
Пример #4
0
        protected virtual void AddBlockStepStorageHandler(IBlockchainStoreRepositoryFactory repositoryFactory)
        {
            var handler = new BlockStorageStepHandler(repositoryFactory.CreateBlockRepository());

            this.BlockStep.AddProcessorHandler(handler);
        }