Skip to content

Commit

Permalink
Consuming proto files for 0.6.0 dapr runtime and updating DaprClient …
Browse files Browse the repository at this point in the history
…for it. (#274)
  • Loading branch information
amanbha authored Mar 31, 2020
1 parent 20fabb2 commit d8157b9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 53 deletions.
40 changes: 1 addition & 39 deletions src/Dapr.Client/DaprClientGrpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ internal async ValueTask MakeSaveStateCallAsync<TValue>(

if (stateOptions != null)
{
stateRequest.Options = ToAutoGeneratedStateRequestOptions(stateOptions);
stateRequest.Options = ToAutoGeneratedStateOptions(stateOptions);
}

if (value != null)
Expand Down Expand Up @@ -506,44 +506,6 @@ private async Task<TResponse> MakeGrpcCallHandleError<TResponse>(Func<CallOption
return await callFunc.Invoke(callOptions);
}

private StateRequestOptions ToAutoGeneratedStateRequestOptions(StateOptions stateOptions)
{
var stateRequestOptions = new Autogenerated.StateRequestOptions();

if (stateOptions.Consistency != null)
{
stateRequestOptions.Consistency = GetStringForConsistencyMode(stateOptions.Consistency.Value);
}

if (stateOptions.Concurrency != null)
{
stateRequestOptions.Concurrency = GetStringForConcurrencyMode(stateOptions.Concurrency.Value);
}

if (stateOptions.RetryOptions != null)
{
var retryPolicy = new Autogenerated.StateRetryPolicy();
if (stateOptions.RetryOptions.RetryMode != null)
{
retryPolicy.Pattern = GetStringForRetryMode(stateOptions.RetryOptions.RetryMode.Value);
}

if (stateOptions.RetryOptions.RetryInterval != null)
{
retryPolicy.Interval = Duration.FromTimeSpan(stateOptions.RetryOptions.RetryInterval.Value);
}

if (stateOptions.RetryOptions.RetryThreshold != null)
{
retryPolicy.Threshold = stateOptions.RetryOptions.RetryThreshold.Value;
}

stateRequestOptions.RetryPolicy = retryPolicy;
}

return stateRequestOptions;
}

private Autogenerated.StateOptions ToAutoGeneratedStateOptions(StateOptions stateOptions)
{
var stateRequestOptions = new Autogenerated.StateOptions();
Expand Down
14 changes: 1 addition & 13 deletions src/Dapr.Client/Protos/dapr.proto
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,5 @@ message StateRequest {
google.protobuf.Any value = 2;
string etag = 3;
map<string,string> metadata = 4;
StateRequestOptions options = 5;
}

message StateRequestOptions {
string concurrency = 1;
string consistency = 2;
StateRetryPolicy retryPolicy = 3;
}

message StateRetryPolicy {
int32 threshold = 1;
string pattern = 2;
google.protobuf.Duration interval = 3;
StateOptions options = 5;
}
2 changes: 1 addition & 1 deletion src/Dapr.Client/Protos/daprclient.proto
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ message RetryPolicy {
int32 threshold = 1;
string pattern = 2;
google.protobuf.Duration interval = 3;
}
}

0 comments on commit d8157b9

Please sign in to comment.