Esempio n. 1
0
        // Overwrites the Store, canceling potential subscriptions, therefore marked private
        private async Task ReadStateAsync()
        {
            var state = Tuple.Create <TState, uint>(null, 0);
            var storageActonObservable = storage.ReadObservable(this.tableKey, this.GetLogger());

            state = await storageActonObservable.Aggregate(state, (s, a) =>
            {
                s = Tuple.Create(this.reducer(s.Item1, a.Action), a.Serial);
                return(s);
            });

            this.Store = new ReduxGrainStore <TState>(this.reducer, state.Item1, state.Item2);
        }
Esempio n. 2
0
        // Overwrites the Store, canceling potential subscriptions, therefore marked private
        private async Task ReadStateAsync()
        {
            var state = Tuple.Create <TState, uint>(null, 0);

            try
            {
                var storageActonObservable = storage.ReadObservable(this.tableKey, this.GetLogger());
                state = await storageActonObservable.Aggregate(state, (s, a) =>
                {
                    s = Tuple.Create(this.reducer(s.Item1, a.Action), a.Serial);
                    return(s);
                });

                this.Store = new ReduxGrainStore <TState>(this.reducer, state.Item1, state.Item2);
            }
            catch (Exception e)
            {
                // Can't connect to table storage server. Throw a serializable exception
                throw new Exception("Can't connect to table storage service: " + e.Message);
            }
        }