Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update protos and related use for Dapr 1.13. #1236

Merged
merged 4 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/itests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
GOARCH: amd64
GOPROXY: https://proxy.golang.org
DAPR_CLI_VER: 1.12.0
DAPR_RUNTIME_VER: 1.12.0
DAPR_RUNTIME_VER: 1.13.0-rc.2
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/release-1.12/install/install.sh
DAPR_CLI_REF: ''
steps:
Expand Down
6 changes: 3 additions & 3 deletions src/Dapr.Client/DaprClientGrpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2340,7 +2340,7 @@ public override async Task WaitForSidecarAsync(CancellationToken cancellationTok
/// <inheritdoc/>
public async override Task ShutdownSidecarAsync(CancellationToken cancellationToken = default)
{
await client.ShutdownAsync(new Empty(), CreateCallOptions(null, cancellationToken));
await client.ShutdownAsync(new Autogenerated.ShutdownRequest(), CreateCallOptions(null, cancellationToken));
}

/// <inheritdoc/>
Expand All @@ -2349,9 +2349,9 @@ public override async Task<DaprMetadata> GetMetadataAsync(CancellationToken canc
var options = CreateCallOptions(headers: null, cancellationToken);
try
{
var response = await client.GetMetadataAsync(new Empty(), options);
var response = await client.GetMetadataAsync(new Autogenerated.GetMetadataRequest(), options);
return new DaprMetadata(response.Id,
response.ActiveActorsCount.Select(c => new DaprActorMetadata(c.Type, c.Count)).ToList(),
response.ActorRuntime.ActiveActors.Select(c => new DaprActorMetadata(c.Type, c.Count)).ToList(),
response.ExtendedMetadata.ToDictionary(c => c.Key, c => c.Value),
response.RegisteredComponents.Select(c => new DaprComponentsMetadata(c.Name, c.Type, c.Version, c.Capabilities.ToArray())).ToList());
}
Expand Down
1 change: 1 addition & 0 deletions src/Dapr.Client/DaprMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// limitations under the License.
// ------------------------------------------------------------------------

using System;
using System.Collections.Generic;

namespace Dapr.Client
Expand Down
54 changes: 37 additions & 17 deletions src/Dapr.Client/Protos/dapr/proto/dapr/v1/dapr.proto
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ service Dapr {
// Unregister an actor reminder.
rpc UnregisterActorReminder(UnregisterActorReminderRequest) returns (google.protobuf.Empty) {}

// Rename an actor reminder.
rpc RenameActorReminder(RenameActorReminderRequest) returns (google.protobuf.Empty) {}

// Gets the state for a specific actor.
rpc GetActorState(GetActorStateRequest) returns (GetActorStateResponse) {}

Expand Down Expand Up @@ -122,7 +119,7 @@ service Dapr {
rpc DecryptAlpha1(stream DecryptRequest) returns (stream DecryptResponse);

// Gets metadata of the sidecar
rpc GetMetadata (google.protobuf.Empty) returns (GetMetadataResponse) {}
rpc GetMetadata (GetMetadataRequest) returns (GetMetadataResponse) {}

// Sets value in extended metadata of the sidecar
rpc SetMetadata (SetMetadataRequest) returns (google.protobuf.Empty) {}
Expand Down Expand Up @@ -190,7 +187,7 @@ service Dapr {
// Raise an event to a running workflow instance
rpc RaiseEventWorkflowBeta1 (RaiseEventWorkflowRequest) returns (google.protobuf.Empty) {}
// Shutdown the sidecar
rpc Shutdown (google.protobuf.Empty) returns (google.protobuf.Empty) {}
rpc Shutdown (ShutdownRequest) returns (google.protobuf.Empty) {}
}

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

// BulkPublishResponseFailedEntry is the message containing the entryID and error of a failed event in BulkPublishEvent call
message BulkPublishResponseFailedEntry {

// The response scoped unique ID referring to this message
string entry_id = 1;

// The error message if any on failure
string error = 2;
}


// InvokeBindingRequest is the message to send data to output bindings
message InvokeBindingRequest {
// The name of the output binding to invoke.
Expand Down Expand Up @@ -544,14 +539,6 @@ message UnregisterActorReminderRequest {
string name = 3;
}

// RenameActorReminderRequest is the message to rename an actor reminder.
message RenameActorReminderRequest {
string actor_type = 1;
string actor_id = 2;
string old_name = 3;
string new_name = 4;
}

// GetActorStateRequest is the message to get key-value states from specific actor.
message GetActorStateRequest {
string actor_type = 1;
Expand Down Expand Up @@ -600,17 +587,45 @@ message InvokeActorResponse {
bytes data = 1;
}

// GetMetadataResponse is a message that is returned on GetMetadata rpc call
// GetMetadataRequest is the message for the GetMetadata request.
message GetMetadataRequest {
// Empty
}

// GetMetadataResponse is a message that is returned on GetMetadata rpc call.
message GetMetadataResponse {
string id = 1;
repeated ActiveActorsCount active_actors_count = 2 [json_name = "actors"];
// Deprecated alias for actor_runtime.active_actors.
repeated ActiveActorsCount active_actors_count = 2 [json_name = "actors", deprecated = true];
repeated RegisteredComponents registered_components = 3 [json_name = "components"];
map<string, string> extended_metadata = 4 [json_name = "extended"];
repeated PubsubSubscription subscriptions = 5 [json_name = "subscriptions"];
repeated MetadataHTTPEndpoint http_endpoints = 6 [json_name = "httpEndpoints"];
AppConnectionProperties app_connection_properties = 7 [json_name = "appConnectionProperties"];
string runtime_version = 8 [json_name = "runtimeVersion"];
repeated string enabled_features = 9 [json_name = "enabledFeatures"];
ActorRuntime actor_runtime = 10 [json_name = "actorRuntime"];
}

message ActorRuntime {
enum ActorRuntimeStatus {
// Indicates that the actor runtime is still being initialized.
INITIALIZING = 0;
// Indicates that the actor runtime is disabled.
// This normally happens when Dapr is started without "placement-host-address"
DISABLED = 1;
// Indicates the actor runtime is running, either as an actor host or client.
RUNNING = 2;
}

// Contains an enum indicating whether the actor runtime has been initialized.
ActorRuntimeStatus runtime_status = 1 [json_name = "runtimeStatus"];
// Count of active actors per type.
repeated ActiveActorsCount active_actors = 2 [json_name = "activeActors"];
// Indicates whether the actor runtime is ready to host actors.
bool host_ready = 3 [json_name = "hostReady"];
// Custom message from the placement provider.
string placement = 4 [json_name = "placement"];
}

message ActiveActorsCount {
Expand Down Expand Up @@ -1088,3 +1103,8 @@ message PurgeWorkflowRequest {
// Name of the workflow component.
string workflow_component = 2 [json_name = "workflowComponent"];
}

// ShutdownRequest is the request for Shutdown.
message ShutdownRequest {
// Empty
}
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public async Task GetMetadataAsync_WrapsRpcException()
var rpcException = new RpcException(rpcStatus, new Metadata(), rpcExceptionMessage);

client.Mock
.Setup(m => m.GetMetadataAsync(It.IsAny<Empty>(), It.IsAny<CallOptions>()))
.Setup(m => m.GetMetadataAsync(It.IsAny<GetMetadataRequest>(), It.IsAny<CallOptions>()))
.Throws(rpcException);

var ex = await Assert.ThrowsAsync<DaprException>(async () =>
Expand All @@ -395,9 +395,10 @@ public async Task GetMetadataAsync_WithReturnTypeAndData()
// Create Response & Respond
var response = new Autogen.Grpc.v1.GetMetadataResponse()
{
ActorRuntime = new(),
Id = "testId",
};
response.ActiveActorsCount.Add(new ActiveActorsCount { Type = "testType", Count = 1 });
response.ActorRuntime.ActiveActors.Add(new ActiveActorsCount { Type = "testType", Count = 1 });
response.RegisteredComponents.Add(new RegisteredComponents { Name = "testName", Type = "testType", Version = "V1" });
response.ExtendedMetadata.Add("e1", "v1");

Expand Down