diff --git a/.github/workflows/itests.yml b/.github/workflows/itests.yml index 3267783c0..2c97343ed 100644 --- a/.github/workflows/itests.yml +++ b/.github/workflows/itests.yml @@ -42,9 +42,9 @@ jobs: GOOS: linux GOARCH: amd64 GOPROXY: https://proxy.golang.org - DAPR_CLI_VER: 1.12.0 - DAPR_RUNTIME_VER: 1.12.0 - DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/release-1.12/install/install.sh + DAPR_CLI_VER: 1.13.0 + DAPR_RUNTIME_VER: 1.13.0 + DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/release-1.13/install/install.sh DAPR_CLI_REF: '' steps: - name: Set up Dapr CLI diff --git a/.github/workflows/sdk_build.yml b/.github/workflows/sdk_build.yml index 4fde80610..fe935bfb8 100644 --- a/.github/workflows/sdk_build.yml +++ b/.github/workflows/sdk_build.yml @@ -32,7 +32,7 @@ jobs: - name: Generate Packages run: dotnet pack --configuration release - name: Upload packages - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v4 with: name: packages path: ${{ env.NUPKG_OUTDIR }} @@ -116,7 +116,7 @@ jobs: if: startswith(github.ref, 'refs/tags/v') && !(endsWith(github.ref, '-rc') || endsWith(github.ref, '-dev') || endsWith(github.ref, '-prerelease')) steps: - name: Download release artifacts - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: packages path: packages diff --git a/src/Dapr.Client/DaprClientGrpc.cs b/src/Dapr.Client/DaprClientGrpc.cs index f856b87e6..3cd7de526 100644 --- a/src/Dapr.Client/DaprClientGrpc.cs +++ b/src/Dapr.Client/DaprClientGrpc.cs @@ -2340,7 +2340,7 @@ public override async Task WaitForSidecarAsync(CancellationToken cancellationTok /// 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)); } /// @@ -2349,9 +2349,9 @@ public override async Task 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()); } diff --git a/src/Dapr.Client/DaprMetadata.cs b/src/Dapr.Client/DaprMetadata.cs index 4cd812e04..a58707c99 100644 --- a/src/Dapr.Client/DaprMetadata.cs +++ b/src/Dapr.Client/DaprMetadata.cs @@ -11,6 +11,7 @@ // limitations under the License. // ------------------------------------------------------------------------ +using System; using System.Collections.Generic; namespace Dapr.Client diff --git a/src/Dapr.Client/Protos/dapr/proto/dapr/v1/dapr.proto b/src/Dapr.Client/Protos/dapr/proto/dapr/v1/dapr.proto index eafb5452e..5ec1cc9d8 100644 --- a/src/Dapr.Client/Protos/dapr/proto/dapr/v1/dapr.proto +++ b/src/Dapr.Client/Protos/dapr/proto/dapr/v1/dapr.proto @@ -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) {} @@ -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) {} @@ -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. @@ -407,7 +404,6 @@ 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; @@ -415,7 +411,6 @@ message BulkPublishResponseFailedEntry { string error = 2; } - // InvokeBindingRequest is the message to send data to output bindings message InvokeBindingRequest { // The name of the output binding to invoke. @@ -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; @@ -600,10 +587,16 @@ 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 extended_metadata = 4 [json_name = "extended"]; repeated PubsubSubscription subscriptions = 5 [json_name = "subscriptions"]; @@ -611,6 +604,28 @@ message GetMetadataResponse { 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 { @@ -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 +} diff --git a/src/Dapr.Workflow/Dapr.Workflow.csproj b/src/Dapr.Workflow/Dapr.Workflow.csproj index d5820deb1..9092b101a 100644 --- a/src/Dapr.Workflow/Dapr.Workflow.csproj +++ b/src/Dapr.Workflow/Dapr.Workflow.csproj @@ -13,8 +13,8 @@ - - + + diff --git a/src/Dapr.Workflow/DaprWorkflowClient.cs b/src/Dapr.Workflow/DaprWorkflowClient.cs index 4c4902dbb..e4c88f0ef 100644 --- a/src/Dapr.Workflow/DaprWorkflowClient.cs +++ b/src/Dapr.Workflow/DaprWorkflowClient.cs @@ -158,10 +158,10 @@ public async Task WaitForWorkflowCompletionAsync( /// the terminated state. /// /// - /// Terminating a workflow instance has no effect on any in-flight activity function executions - /// or child workflows that were started by the terminated instance. Those actions will continue to run - /// without interruption. However, their results will be discarded. If you want to terminate child-workflows, - /// you must issue separate terminate commands for each child workflow instance individually. + /// Terminating a workflow terminates all of the child workflow instances that were created by the target. But it + /// has no effect on any in-flight activity function executions + /// that were started by the terminated instance. Those actions will continue to run + /// without interruption. However, their results will be discarded. /// /// At the time of writing, there is no way to terminate an in-flight activity execution. /// @@ -178,7 +178,11 @@ public Task TerminateWorkflowAsync( string? output = null, CancellationToken cancellation = default) { - return this.innerClient.TerminateInstanceAsync(instanceId, output, cancellation); + TerminateInstanceOptions options = new TerminateInstanceOptions { + Output = output, + Recursive = true, + }; + return this.innerClient.TerminateInstanceAsync(instanceId, options, cancellation); } /// @@ -269,6 +273,9 @@ public Task ResumeWorkflowAsync( /// , , or /// state can be purged. /// + /// + /// Purging a workflow purges all of the child workflows that were created by the target. + /// /// /// The unique ID of the workflow instance to purge. /// @@ -280,7 +287,8 @@ public Task ResumeWorkflowAsync( /// public async Task PurgeInstanceAsync(string instanceId, CancellationToken cancellation = default) { - PurgeResult result = await this.innerClient.PurgeInstanceAsync(instanceId, cancellation); + PurgeInstanceOptions options = new PurgeInstanceOptions {Recursive = true}; + PurgeResult result = await this.innerClient.PurgeInstanceAsync(instanceId, options, cancellation); return result.PurgedInstanceCount > 0; } diff --git a/test/Dapr.Client.Test/DaprClientTest.InvokeMethodGrpcAsync.cs b/test/Dapr.Client.Test/DaprClientTest.InvokeMethodGrpcAsync.cs index 5412c4063..4001e4b06 100644 --- a/test/Dapr.Client.Test/DaprClientTest.InvokeMethodGrpcAsync.cs +++ b/test/Dapr.Client.Test/DaprClientTest.InvokeMethodGrpcAsync.cs @@ -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(), It.IsAny())) + .Setup(m => m.GetMetadataAsync(It.IsAny(), It.IsAny())) .Throws(rpcException); var ex = await Assert.ThrowsAsync(async () => @@ -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");