Ejemplo n.º 1
0
        /// <summary> Read state data function for this storage provider. </summary>
        /// <see cref="IStorageProvider#ReadStateAsync"/>
        public virtual async Task ReadStateAsync(string grainType, GrainReference grainReference, IGrainState grainState)
        {
            var keys = MakeKeys(grainType, grainReference);

            if (Log.IsVerbose2)
            {
                Log.Verbose2("Read Keys={0}", StorageProviderUtils.PrintKeys(keys));
            }

            string id = HierarchicalKeyStore.MakeStoreKey(keys);
            IMemoryStorageGrain          storageGrain = GetStorageGrain(id);
            IDictionary <string, object> state        = await storageGrain.ReadStateAsync(STATE_STORE_NAME, id);

            grainState.SetAll(state);
        }
Ejemplo n.º 2
0
        /// <summary> Read state data function for this storage provider. </summary>
        /// <see cref="IGrainStorage.ReadStateAsync"/>
        public virtual async Task ReadStateAsync(string grainType, GrainReference grainReference, IGrainState grainState)
        {
            var keys = MakeKeys(grainType, grainReference);

            if (logger.IsEnabled(LogLevel.Trace))
            {
                logger.LogTrace("Read Keys={Keys}", StorageProviderUtils.PrintKeys(keys));
            }

            string id = HierarchicalKeyStore.MakeStoreKey(keys);
            IMemoryStorageGrain storageGrain = GetStorageGrain(id);
            var state = await storageGrain.ReadStateAsync(STATE_STORE_NAME, id);

            if (state != null)
            {
                grainState.ETag  = state.ETag;
                grainState.State = state.State;
            }
        }
Ejemplo n.º 3
0
        /// <summary> Read state data function for this storage provider. </summary>
        /// <see cref="IStorageProvider.ReadStateAsync"/>
        public virtual async Task ReadStateAsync(string grainType, GrainReference grainReference, IGrainState grainState)
        {
            IList <Tuple <string, string> > keys = MakeKeys(grainType, grainReference).ToList();

            if (Log.IsVerbose2)
            {
                Log.Verbose2("Read Keys={0}", StorageProviderUtils.PrintKeys(keys));
            }

            string id = HierarchicalKeyStore.MakeStoreKey(keys);
            IMemoryStorageGrain storageGrain = GetStorageGrain(id);
            var state = await storageGrain.ReadStateAsync(STATE_STORE_NAME, id);

            if (state != null && state.State != null)
            {
                grainState.ETag  = state.ETag;
                grainState.State = state.State;
            }
        }
Ejemplo n.º 4
0
        /// <summary> Read state data function for this storage provider. </summary>
        /// <see cref="IStorageProvider#ReadStateAsync"/>
        public virtual async Task ReadStateAsync(string grainType, GrainReference grainReference, GrainState grainState)
        {
            var keys = MakeKeys(grainType, grainReference);

            if (Log.IsVerbose2)
            {
                Log.Verbose2("Read Keys={0}", StorageProviderUtils.PrintKeys(keys));
            }

            string id = HierarchicalKeyStore.MakeStoreKey(keys);
            IMemoryStorageGrain storageGrain = GetStorageGrain(id);
            Tuple <IDictionary <string, object>, string> result = await storageGrain.ReadStateAsync(STATE_STORE_NAME, id);

            if (result != null && result.Item1 != null)
            {
                grainState.SetAll(result.Item1);
                grainState.Etag = result.Item2;
            }
        }