public DocumentsRegistryGrain([PersistentState("state",
                                                "MemoryGrainStorage")] IPersistentState <List <Document> > state,
                               IAuthorizationService authorizationService)
 {
     _state = state;
     _authorizationService = authorizationService;
 }
示例#2
0
 public IdentityRoleGrain(
     ILookupNormalizer normalizer,
     [PersistentState("IdentityRole", OrleansIdentityConstants.OrleansStorageProvider)] IPersistentState <RoleGrainState <TRole> > data)
 {
     _data       = data;
     _normalizer = normalizer;
 }
示例#3
0
 public GameProvider(
     [PersistentState("games", "GameProviderStore")] IPersistentState <GameProviderState> games,
     ILogger <GameProvider> logger)
 {
     _games  = games;
     _logger = logger;
 }
示例#4
0
 public BMSService(
     [PersistentState("TDXX", "TDXXCache")] IPersistentState <VOCache> tdxx,
     [PersistentState("LYXX", "LYXXCache")] IPersistentState <VOCache> lyxx)
 {
     _tdxx = tdxx;
     _lyxx = lyxx;
 }
 public UserIdFactoryGrain(
     [PersistentState("CurUserId", StorageProviders.DefaultProviderName)] IPersistentState <Int64> curUserId,
     ILogger <UserGrain> logger)
 {
     _curUserId = curUserId;
     _logger    = logger;
 }
示例#6
0
 public TodoGrain(
     ILogger <TodoGrain> logger,
     [PersistentState("State")] IPersistentState <State> state)
 {
     _logger = logger;
     _state  = state;
 }
示例#7
0
 public ClientGrain(
     ILogger <ClientGrain> logger,
     [PersistentState(CLIENT_STORAGE, Constants.STORAGE_PROVIDER)] IPersistentState <ClientState> clientState)
 {
     _logger      = logger;
     _clientState = clientState;
 }
示例#8
0
 public JobIdGrain(
     [PersistentState(nameof(JobIdGrain), Constants.JobIdStoreName)]
     IPersistentState <JobIdState> state, IOptions <JobTrackerConfig> options)
 {
     _state   = state;
     _options = options;
 }
示例#9
0
 public MessageGrain(
     ILogger <MessageGrain> logger,
     [PersistentState("messages", "sqlite")] IPersistentState <List <string> > messageState)
 {
     _messageState = messageState;
     _subsManager  = new(TimeSpan.FromMinutes(5), logger, "subs");
 }
示例#10
0
 public WorkflowExecutorGrain(
     [PersistentState(nameof(_flowState))] IPersistentState <WorkflowState> flowState,
     ILogger <WorkflowExecutorGrain> logger)
 {
     _flowState = flowState;
     _logger    = logger;
 }
        private void CreateSmartContractState()
        {
            var block = new TestBlock
            {
                Coinbase = contractOwnerAddress,
                Number   = 2
            };

            var message = new TestMessage
            {
                ContractAddress = contractAddress,
                GasLimit        = (Gas)(ulong)10000,
                Sender          = punter1Address,
                Value           = 0
            };

            this.transactionExecutor = Substitute.For <IInternalTransactionExecutor>();
            persistentState          = new InMemoryState();

            this.smartContractState = new TestSmartContractState(
                block,
                message,
                persistentState,
                null,
                transactionExecutor,
                () => (ulong)0,
                new TestInternalHashHelper()
                );
        }
示例#12
0
 public ServerDirectoryGrain(
     ILogger <ServerDirectoryGrain> logger,
     [PersistentState(Constants.STORAGE_PROVIDER)] IPersistentState <ServerDirectoryState> directoryState)
 {
     _logger    = logger;
     _directory = directoryState;
 }
示例#13
0
 public CMSService(
     [PersistentState("CustomerManager", "CustomerManagerCache")] IPersistentState <CustomerManager> customerManager,
     [PersistentState("GroupManager", "GroupManagerCache")] IPersistentState <GroupManager> groupManager)
 {
     _customerManager = customerManager;
     _groupManager    = groupManager;
 }
示例#14
0
 public AccountGrain(
     [TransactionalState("balanceState", "Storage1")] ITransactionalState <BalanceState> balanceState,
     [PersistentState("nameState", "Storage1")] IPersistentState <NameState> nameState)
 {
     _balanceState = balanceState ?? throw new ArgumentNullException(nameof(balanceState));
     _nameState    = nameState ?? throw new ArgumentNullException(nameof(nameState));
 }
示例#15
0
 public VoteGrain(
     [PersistentState("votes", storageName: "votes")] IPersistentState <Dictionary <string, int> > state,
     ILogger <VoteGrain> logger)
 {
     _logger = logger;
     _state  = state;
 }
示例#16
0
 public ActivityTestGrain([PersistentState(Constants.StorageProviderName, Constants.StorageProviderName)] IPersistentState <ActivityState> state,
                          IActivityContextAccessor activityContextAccessor, ITenantAccessor tenantAccessor, IStreamFactory streamFactory = null)
 {
     _activityContextAccessor = activityContextAccessor;
     _tenantAccessor          = tenantAccessor;
     _streamFactory           = streamFactory;
     _state = state;
 }
示例#17
0
 public UserGrain(
     // grain state is not loaded at the time it is injected into constructor,
     // so accessing it is invalid at that time, the state will be loaded before `OnActiveAsync` is called.
     [PersistentState("UserState", "sqlite")] IPersistentState <UserState> userState)
 {
     // 注入的时候并没有读取, 在OnActivateAsync调用前保证是读取了的
     _userState = userState;
 }
 public FeedSubscriberGrain(
     [PersistentState("translationGrainState", STORAGE_NAME)] IPersistentState <FeedSubscriberGrainState> state,
     IFeedSubscriber <TranslationState> feedSubscriber
     )
 {
     this.state          = state;
     this.feedSubscriber = feedSubscriber;
 }
示例#19
0
 public PersistentGrain(
     ILogger <PersistentGrain> logger,
     [PersistentState("state")]
     IPersistentState <PersistentGrainState> persistentState)
 {
     this.logger          = logger;
     this.persistentState = persistentState;
 }
示例#20
0
 public UserGrain(
     [PersistentState("profile", "profileStore")] IPersistentState <ProfileState> profile,
     IHttpClientFactory httpClientFactory,
     ILogger <UserGrain> logger)
 {
     _profile           = profile;
     _httpClientFactory = httpClientFactory;
     _logger            = logger;
 }
示例#21
0
 public SensorTypeAProcessorGrain
 (
     [PersistentState(stateName: "Measurements", storageName: nameof(SensorTypeAProcessorGrain))] IPersistentState <SensorTypeAState> persistentState,
     ILogger <SensorTypeAProcessorGrain> logger
 )
 {
     this.persistentState = persistentState;
     this.logger          = logger;
 }
示例#22
0
 public Cow(
     [PersistentState("CowOwnerId", "FileStorage")] IPersistentState <Guid> ownerId,
     [PersistentState("CowLocation", "FileStorage")] IPersistentState <Location> location,
     [PersistentState("CowItinerary", "FileStorage")] IPersistentState <List <Point> > trajectory)
 {
     _trajectory = trajectory;
     _ownerId    = ownerId;
     _location   = location;
 }
 public UserVerificationGrain([PersistentState(nameof(UserVerificationState))]
                              IPersistentState <UserVerificationState> verificationState,
                              IDataRetriever <HashSet <string> > blacklistedEmails,
                              ILogger <UserVerificationGrain> logger)
 {
     _verificationState = verificationState;
     _blacklistedEmails = blacklistedEmails;
     _logger            = logger;
 }
示例#24
0
 public SearchGrain(
     [PersistentState(nameof(SearchGrain))] IPersistentState <SearchState> search,
     ILogger <SearchGrain> logger,
     IHostApplicationLifetime hostAppLifetime)
 {
     _search          = search;
     _logger          = logger;
     _hostAppLifetime = hostAppLifetime;
 }
示例#25
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="factory">factory logger</param>
        /// <param name="client">event store client</param>
        /// <param name="persist">event store persistent subscription client</param>
        public PrimeGrain(ILoggerFactory factory, IESService <int> es_service, IRXService <int> rx_service, [PersistentState("primes", GrainConst.Storage)] IPersistentState <PrimeAggregate> aggregate, EventStorePersistentSubscriptionsClient persist)
        {
            _logger     = factory.CreateLogger <PrimeGrain>();
            _es_service = es_service;
            _rx_service = rx_service;
            _aggregate  = aggregate;

            PrimeGrain_Persist(persist);
            PrimeGrain_Stream(factory);
        }
示例#26
0
 public DictionaryEntryGrain(
     // Inject some storage. We will use the "definitions" storage provider configured in Program.cs
     // and we will call this piece of state "def", to distinguish it from any other state we might want to have
     [PersistentState(stateName: "def", storageName: "definitions")]
     IPersistentState <DictionaryEntryState> defs,
     ReferenceDataService referenceDataService)
 {
     _state = defs;
     _referenceDataService = referenceDataService;
 }
示例#27
0
 public OrderGrain(
     [PersistentState(nameof(OrderGrain))] IPersistentState <OrderState> order,
     IGrainFactory grainFactory,
     ILogger <OrderGrain> logger,
     IHostApplicationLifetime hostAppLifetime)
 {
     _order           = order;
     _grainFactory    = grainFactory;
     _logger          = logger;
     _hostAppLifetime = hostAppLifetime;
 }
        protected SmartContract(ISmartContractState smartContractState)
        {
            CultureInfo.CurrentCulture = new CultureInfo("en-US");

            this.gasMeter   = smartContractState.GasMeter;
            this.Block      = smartContractState.Block;
            this.getBalance = smartContractState.GetBalance;
            this.internalTransactionExecutor = smartContractState.InternalTransactionExecutor;
            this.internalHashHelper          = smartContractState.InternalHashHelper;
            this.Message            = smartContractState.Message;
            this.PersistentState    = smartContractState.PersistentState;
            this.smartContractState = smartContractState;
        }
示例#29
0
 public CacheGrain(
     IOptions <CacheOptions> options,
     ISystemClock clock,
     [PersistentState("State", OutkeepProviderNames.OutkeepCache)] IPersistentState <CacheGrainState> state,
     [PersistentState("Flags", OutkeepProviderNames.OutkeepCache)] IPersistentState <CacheGrainFlags> flags,
     [WeakActivationState(OutkeepProviderNames.OutkeepMemoryResourceGovernor)] IWeakActivationState <ActivityState> activity)
 {
     _options  = options?.Value ?? throw new ArgumentNullException(nameof(options));
     _clock    = clock ?? throw new ArgumentNullException(nameof(clock));
     _state    = state?.AsConflater() ?? throw new ArgumentNullException(nameof(state));
     _flags    = flags?.AsConflater() ?? throw new ArgumentNullException(nameof(flags));
     _activity = activity ?? throw new ArgumentNullException(nameof(activity));
 }
 public AddressMapperTests()
 {
     mContractLogger   = new Mock <IContractLogger>();
     state             = new InMemoryState();
     mContractState    = new Mock <ISmartContractState>();
     mInternalExecutor = new Mock <IInternalTransactionExecutor>();
     mContractState.Setup(x => x.PersistentState).Returns(state);
     mContractState.Setup(x => x.ContractLogger).Returns(mContractLogger.Object);
     mContractState.Setup(x => x.InternalTransactionExecutor).Returns(mInternalExecutor.Object);
     contractAddress  = "0x0000000000000000000000000000000000000001".HexToAddress();
     ownerAddress     = "0x0000000000000000000000000000000000000002".HexToAddress();
     primaryAddress   = "0x0000000000000000000000000000000000000003".HexToAddress();
     secondaryAddress = "0x0000000000000000000000000000000000000004".HexToAddress();
 }