예제 #1
0
 public TieredStateCache(IStateCache parent)
 {
     if (parent != null)
     {
         _parent = parent;
     }
 }
        private async Task <SmartContractRegistration> GetSmartContractRegistrationAsync(
            SmartContractRegistrationCache smartContractRegistrationCache, Address address,
            IStateCache stateCache = null)
        {
            //Cannot find registration in fork cache and lib cache
            if (smartContractRegistrationCache == null)
            {
                //Check whether stateCache has smartContract registration
                var smartContractRegistration = await GetSmartContractRegistrationFromZeroAsync(new ChainContext
                {
                    BlockHash   = _initLibBlockHash,
                    BlockHeight = _initLibBlockHeight,
                    StateCache  = stateCache
                }, address);

                if (smartContractRegistration == null)
                {
                    throw new SmartContractFindRegistrationException("failed to find registration from zero contract");
                }
                return(smartContractRegistration);
            }

            if (smartContractRegistrationCache.SmartContractRegistration.Code.IsEmpty)
            {
                smartContractRegistrationCache.SmartContractRegistration =
                    await GetSmartContractRegistrationFromZeroAsync(new ChainContext
                {
                    BlockHash   = smartContractRegistrationCache.BlockHash,
                    BlockHeight = smartContractRegistrationCache.BlockHeight
                },
                                                                    smartContractRegistrationCache.Address);
            }

            return(smartContractRegistrationCache.SmartContractRegistration);
        }
예제 #3
0
 public OrderImportor(IOrderManager orderManager,
                      IStoreManager storeManager,
                      IProductManager productManager,
                      IShipmentManager shipmentManager,
                      IProductAttributeFormatter productAttributeFormatter,
                      IProductAttributeManager productAttributeManager,
                      ILogisticsManager logisticsManager,
                      ILogger logger,
                      IPriceCalculator priceCalculator,
                      IStateManager stateManager,
                      IAddressManager addressManager,
                      IStateCache stateCache)
 {
     this._orderManager              = orderManager;
     this._storeManager              = storeManager;
     this._productManager            = productManager;
     this._shipmentManager           = shipmentManager;
     this._productAttributeFormatter = productAttributeFormatter;
     this._productAttributeManager   = productAttributeManager;
     this._logisticsManager          = logisticsManager;
     this._logger          = logger;
     this._stateManager    = stateManager;
     this._addressManager  = addressManager;
     this._stateCache      = stateCache;
     this._priceCalculator = priceCalculator;
 }
예제 #4
0
        internal static List <ExpressionFilterDefinition> GetFilterDefinitions(
            this IStateCache stateCache,
            ImutableGridRendererContext imutableGridRendererContext)
        {
            var definitions = new List <ExpressionFilterDefinition>();

            foreach (var property in imutableGridRendererContext.GridItemProperties)
            {
                var config = imutableGridRendererContext.GridEntityConfiguration.FindColumnConfiguration(property.Name);
                if (stateCache.TryGetStateValue <ColumnFilterState>(property.Name, out var state))
                {
                    definitions.Add(new ExpressionFilterDefinition(
                                        property.Name,
                                        state.FilterOperation,
                                        state.FilterValue,
                                        config.TextComparison));
                }
            }

            return(definitions);
        }
 private ITransactionContext Create(Transaction transaction, Hash previousBlockHash, long blockHeight,
                                    IStateCache stateCache, int callDepth, Timestamp blockTime, IExecutionObserverThreshold executionObserverThreshold)
 {
     return(new TransactionContext
     {
         Trace = new TransactionTrace
         {
             TransactionId = transaction.GetHash()
         },
         Transaction = transaction,
         PreviousBlockHash = previousBlockHash,
         BlockHeight = blockHeight,
         CurrentBlockTime = blockTime ?? TimestampHelper.GetUtcNow(),
         CallDepth = callDepth,
         MaxCallDepth = 64,
         Origin = transaction.From,
         OriginTransactionId = transaction.GetHash(),
         ExecutionObserverThreshold = executionObserverThreshold,
         StateCache = stateCache
     });
 }
예제 #6
0
 public OrderManager(IRepository <Order, long> OrderRepository,
                     IRepository <OrderItem, long> OrderItemRepository,
                     IStoreManager storeManager,
                     IProductManager productManager,
                     IProductAttributeFormatter productAttributeFormatter,
                     IProductAttributeManager productAttributeManager,
                     ILogisticsManager logisticsManager,
                     ILogger logger,
                     IStateManager stateManager,
                     IAddressManager addressManager,
                     IStateCache stateCache)
 {
     this.OrderRepository            = OrderRepository;
     this.OrderItemRepository        = OrderItemRepository;
     this._storeManager              = storeManager;
     this._productManager            = productManager;
     this._productAttributeFormatter = productAttributeFormatter;
     this._productAttributeManager   = productAttributeManager;
     this._logisticsManager          = logisticsManager;
     this._logger         = logger;
     this._stateManager   = stateManager;
     this._addressManager = addressManager;
     this._stateCache     = stateCache;
 }
예제 #7
0
 public MstdController(SourcesHelper helper, IStateCache cache, ILogger logger)
 {
     _helper = helper;
     _cache  = cache;
     _logger = logger;
 }
예제 #8
0
 public SiteHealthChecker(SourcesHelper helper, IStateCache cache)
 {
     _helper = helper;
     _cache  = cache;
 }