Skip to content

Commit 3cab20a

Browse files
authored
Update protos and related use for Dapr 1.13. (#1236)
* Update protos and related use. Signed-off-by: Phillip Hoff <[email protected]> * Update Dapr runtime version. Signed-off-by: Phillip Hoff <[email protected]> * Init properties. Signed-off-by: Phillip Hoff <[email protected]> --------- Signed-off-by: Phillip Hoff <[email protected]>
1 parent c07eb69 commit 3cab20a

File tree

5 files changed

+45
-23
lines changed

5 files changed

+45
-23
lines changed

.github/workflows/itests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
GOARCH: amd64
4444
GOPROXY: https://proxy.golang.org
4545
DAPR_CLI_VER: 1.12.0
46-
DAPR_RUNTIME_VER: 1.12.0
46+
DAPR_RUNTIME_VER: 1.13.0-rc.2
4747
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/release-1.12/install/install.sh
4848
DAPR_CLI_REF: ''
4949
steps:

src/Dapr.Client/DaprClientGrpc.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2340,7 +2340,7 @@ public override async Task WaitForSidecarAsync(CancellationToken cancellationTok
23402340
/// <inheritdoc/>
23412341
public async override Task ShutdownSidecarAsync(CancellationToken cancellationToken = default)
23422342
{
2343-
await client.ShutdownAsync(new Empty(), CreateCallOptions(null, cancellationToken));
2343+
await client.ShutdownAsync(new Autogenerated.ShutdownRequest(), CreateCallOptions(null, cancellationToken));
23442344
}
23452345

23462346
/// <inheritdoc/>
@@ -2349,9 +2349,9 @@ public override async Task<DaprMetadata> GetMetadataAsync(CancellationToken canc
23492349
var options = CreateCallOptions(headers: null, cancellationToken);
23502350
try
23512351
{
2352-
var response = await client.GetMetadataAsync(new Empty(), options);
2352+
var response = await client.GetMetadataAsync(new Autogenerated.GetMetadataRequest(), options);
23532353
return new DaprMetadata(response.Id,
2354-
response.ActiveActorsCount.Select(c => new DaprActorMetadata(c.Type, c.Count)).ToList(),
2354+
response.ActorRuntime.ActiveActors.Select(c => new DaprActorMetadata(c.Type, c.Count)).ToList(),
23552355
response.ExtendedMetadata.ToDictionary(c => c.Key, c => c.Value),
23562356
response.RegisteredComponents.Select(c => new DaprComponentsMetadata(c.Name, c.Type, c.Version, c.Capabilities.ToArray())).ToList());
23572357
}

src/Dapr.Client/DaprMetadata.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// limitations under the License.
1212
// ------------------------------------------------------------------------
1313

14+
using System;
1415
using System.Collections.Generic;
1516

1617
namespace Dapr.Client

src/Dapr.Client/Protos/dapr/proto/dapr/v1/dapr.proto

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ service Dapr {
7979
// Unregister an actor reminder.
8080
rpc UnregisterActorReminder(UnregisterActorReminderRequest) returns (google.protobuf.Empty) {}
8181

82-
// Rename an actor reminder.
83-
rpc RenameActorReminder(RenameActorReminderRequest) returns (google.protobuf.Empty) {}
84-
8582
// Gets the state for a specific actor.
8683
rpc GetActorState(GetActorStateRequest) returns (GetActorStateResponse) {}
8784

@@ -122,7 +119,7 @@ service Dapr {
122119
rpc DecryptAlpha1(stream DecryptRequest) returns (stream DecryptResponse);
123120

124121
// Gets metadata of the sidecar
125-
rpc GetMetadata (google.protobuf.Empty) returns (GetMetadataResponse) {}
122+
rpc GetMetadata (GetMetadataRequest) returns (GetMetadataResponse) {}
126123

127124
// Sets value in extended metadata of the sidecar
128125
rpc SetMetadata (SetMetadataRequest) returns (google.protobuf.Empty) {}
@@ -190,7 +187,7 @@ service Dapr {
190187
// Raise an event to a running workflow instance
191188
rpc RaiseEventWorkflowBeta1 (RaiseEventWorkflowRequest) returns (google.protobuf.Empty) {}
192189
// Shutdown the sidecar
193-
rpc Shutdown (google.protobuf.Empty) returns (google.protobuf.Empty) {}
190+
rpc Shutdown (ShutdownRequest) returns (google.protobuf.Empty) {}
194191
}
195192

196193
// InvokeServiceRequest represents the request message for Service invocation.
@@ -407,15 +404,13 @@ message BulkPublishResponse {
407404

408405
// BulkPublishResponseFailedEntry is the message containing the entryID and error of a failed event in BulkPublishEvent call
409406
message BulkPublishResponseFailedEntry {
410-
411407
// The response scoped unique ID referring to this message
412408
string entry_id = 1;
413409

414410
// The error message if any on failure
415411
string error = 2;
416412
}
417413

418-
419414
// InvokeBindingRequest is the message to send data to output bindings
420415
message InvokeBindingRequest {
421416
// The name of the output binding to invoke.
@@ -544,14 +539,6 @@ message UnregisterActorReminderRequest {
544539
string name = 3;
545540
}
546541

547-
// RenameActorReminderRequest is the message to rename an actor reminder.
548-
message RenameActorReminderRequest {
549-
string actor_type = 1;
550-
string actor_id = 2;
551-
string old_name = 3;
552-
string new_name = 4;
553-
}
554-
555542
// GetActorStateRequest is the message to get key-value states from specific actor.
556543
message GetActorStateRequest {
557544
string actor_type = 1;
@@ -600,17 +587,45 @@ message InvokeActorResponse {
600587
bytes data = 1;
601588
}
602589

603-
// GetMetadataResponse is a message that is returned on GetMetadata rpc call
590+
// GetMetadataRequest is the message for the GetMetadata request.
591+
message GetMetadataRequest {
592+
// Empty
593+
}
594+
595+
// GetMetadataResponse is a message that is returned on GetMetadata rpc call.
604596
message GetMetadataResponse {
605597
string id = 1;
606-
repeated ActiveActorsCount active_actors_count = 2 [json_name = "actors"];
598+
// Deprecated alias for actor_runtime.active_actors.
599+
repeated ActiveActorsCount active_actors_count = 2 [json_name = "actors", deprecated = true];
607600
repeated RegisteredComponents registered_components = 3 [json_name = "components"];
608601
map<string, string> extended_metadata = 4 [json_name = "extended"];
609602
repeated PubsubSubscription subscriptions = 5 [json_name = "subscriptions"];
610603
repeated MetadataHTTPEndpoint http_endpoints = 6 [json_name = "httpEndpoints"];
611604
AppConnectionProperties app_connection_properties = 7 [json_name = "appConnectionProperties"];
612605
string runtime_version = 8 [json_name = "runtimeVersion"];
613606
repeated string enabled_features = 9 [json_name = "enabledFeatures"];
607+
ActorRuntime actor_runtime = 10 [json_name = "actorRuntime"];
608+
}
609+
610+
message ActorRuntime {
611+
enum ActorRuntimeStatus {
612+
// Indicates that the actor runtime is still being initialized.
613+
INITIALIZING = 0;
614+
// Indicates that the actor runtime is disabled.
615+
// This normally happens when Dapr is started without "placement-host-address"
616+
DISABLED = 1;
617+
// Indicates the actor runtime is running, either as an actor host or client.
618+
RUNNING = 2;
619+
}
620+
621+
// Contains an enum indicating whether the actor runtime has been initialized.
622+
ActorRuntimeStatus runtime_status = 1 [json_name = "runtimeStatus"];
623+
// Count of active actors per type.
624+
repeated ActiveActorsCount active_actors = 2 [json_name = "activeActors"];
625+
// Indicates whether the actor runtime is ready to host actors.
626+
bool host_ready = 3 [json_name = "hostReady"];
627+
// Custom message from the placement provider.
628+
string placement = 4 [json_name = "placement"];
614629
}
615630

616631
message ActiveActorsCount {
@@ -1088,3 +1103,8 @@ message PurgeWorkflowRequest {
10881103
// Name of the workflow component.
10891104
string workflow_component = 2 [json_name = "workflowComponent"];
10901105
}
1106+
1107+
// ShutdownRequest is the request for Shutdown.
1108+
message ShutdownRequest {
1109+
// Empty
1110+
}

test/Dapr.Client.Test/DaprClientTest.InvokeMethodGrpcAsync.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public async Task GetMetadataAsync_WrapsRpcException()
368368
var rpcException = new RpcException(rpcStatus, new Metadata(), rpcExceptionMessage);
369369

370370
client.Mock
371-
.Setup(m => m.GetMetadataAsync(It.IsAny<Empty>(), It.IsAny<CallOptions>()))
371+
.Setup(m => m.GetMetadataAsync(It.IsAny<GetMetadataRequest>(), It.IsAny<CallOptions>()))
372372
.Throws(rpcException);
373373

374374
var ex = await Assert.ThrowsAsync<DaprException>(async () =>
@@ -395,9 +395,10 @@ public async Task GetMetadataAsync_WithReturnTypeAndData()
395395
// Create Response & Respond
396396
var response = new Autogen.Grpc.v1.GetMetadataResponse()
397397
{
398+
ActorRuntime = new(),
398399
Id = "testId",
399400
};
400-
response.ActiveActorsCount.Add(new ActiveActorsCount { Type = "testType", Count = 1 });
401+
response.ActorRuntime.ActiveActors.Add(new ActiveActorsCount { Type = "testType", Count = 1 });
401402
response.RegisteredComponents.Add(new RegisteredComponents { Name = "testName", Type = "testType", Version = "V1" });
402403
response.ExtendedMetadata.Add("e1", "v1");
403404

0 commit comments

Comments
 (0)