예제 #1
0
 private Task FulfillAsync()
 {
     _sumValue = _sumValue.NextVersion(_leftValue.Value + _rightValue.Value);
     _wait.SetResult(_sumValue);
     _wait = new TaskCompletionSource <VersionedValue <int> >();
     return(Task.CompletedTask);
 }
예제 #2
0
 private Task FulfillAsync()
 {
     _sumValue = _sumValue.NextVersion(_leftValue.Value + _rightValue.Value);
     _logger.LogInformation(
         "{@Time}: {@GrainType} {@GrainKey} updated sum value to {@Value} with version {@Version}",
         DateTime.Now.TimeOfDay, GrainType, GrainKey, _sumValue.Value, _sumValue.Version);
     _wait.SetResult(_sumValue);
     _wait = new TaskCompletionSource <VersionedValue <int> >();
     return(Task.CompletedTask);
 }
예제 #3
0
        private Task IncrementAsync(int increment)
        {
            // update the state
            _state = _state.NextVersion(_state.Value + increment);
            _logger.LogInformation("{@GrainType} {@GrainKey} updated value to {@Value} with version {@Version}",
                                   GrainType, GrainKey, _state.Value, _state.Version);

            // fulfill waiting promises
            _wait.SetResult(_state);
            _wait = new TaskCompletionSource <VersionedValue <int> >();

            return(Task.CompletedTask);
        }
        public Task UpdateValue(OrdersStats value)
        {
            // update the state
            _state = _state.NextVersion(value);
            _logger.LogInformation("{@GrainType} {@GrainKey} updated value to {@Value} with version {@Version}",
                                   GrainType, GrainKey, _state.Value, _state.Version);

            // fulfill waiting promises
            _wait.SetResult(_state);
            _wait = new TaskCompletionSource <VersionedValue <OrdersStats> >();

            return(Task.CompletedTask);
        }