Skip to content

Commit

Permalink
Merge 1.13 release branch back to master (#1247)
Browse files Browse the repository at this point in the history
* Update protos and related use for Dapr 1.13. (#1236)

* Update protos and related use.

Signed-off-by: Phillip Hoff <phillip@orst.edu>

* Update Dapr runtime version.

Signed-off-by: Phillip Hoff <phillip@orst.edu>

* Init properties.

Signed-off-by: Phillip Hoff <phillip@orst.edu>

---------

Signed-off-by: Phillip Hoff <phillip@orst.edu>

* Update artifact action versions. (#1240)

Signed-off-by: Phillip Hoff <phillip@orst.edu>

* Make recursive true as default (#1243)

Signed-off-by: Shivam Kumar <shivamkm07@gmail.com>

* Make final 1.13 changes.

Signed-off-by: Phillip Hoff <phillip@orst.edu>

---------

Signed-off-by: Phillip Hoff <phillip@orst.edu>
Signed-off-by: Shivam Kumar <shivamkm07@gmail.com>
Co-authored-by: Shivam Kumar <shivamkm07@gmail.com>
  • Loading branch information
philliphoff and shivamkm07 committed Mar 8, 2024
1 parent c07eb69 commit 1b7c9f4
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 35 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/itests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sdk_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
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
}
4 changes: 2 additions & 2 deletions src/Dapr.Workflow/Dapr.Workflow.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.DurableTask.Client.Grpc" Version="1.0.*" />
<PackageReference Include="Microsoft.DurableTask.Worker.Grpc" Version="1.0.*" />
<PackageReference Include="Microsoft.DurableTask.Client.Grpc" Version="1.2.*" />
<PackageReference Include="Microsoft.DurableTask.Worker.Grpc" Version="1.2.*" />
</ItemGroup>

<ItemGroup>
Expand Down
20 changes: 14 additions & 6 deletions src/Dapr.Workflow/DaprWorkflowClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ public async Task<WorkflowState> GetWorkflowStateAsync(string instanceId, bool g
/// the terminated state.
/// </para>
/// <para>
/// 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.
/// </para><para>
/// At the time of writing, there is no way to terminate an in-flight activity execution.
/// </para>
Expand All @@ -178,7 +178,11 @@ public async Task<WorkflowState> GetWorkflowStateAsync(string instanceId, bool g
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);
}

/// <summary>
Expand Down Expand Up @@ -269,6 +273,9 @@ public async Task<WorkflowState> GetWorkflowStateAsync(string instanceId, bool g
/// <see cref="WorkflowRuntimeStatus.Completed"/>, <see cref="WorkflowRuntimeStatus.Failed"/>, or
/// <see cref="WorkflowRuntimeStatus.Terminated"/> state can be purged.
/// </para>
/// <para>
/// Purging a workflow purges all of the child workflows that were created by the target.
/// </para>
/// </remarks>
/// <param name="instanceId">The unique ID of the workflow instance to purge.</param>
/// <param name="cancellation">
Expand All @@ -280,7 +287,8 @@ public async Task<WorkflowState> GetWorkflowStateAsync(string instanceId, bool g
/// </returns>
public async Task<bool> 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;
}

Expand Down
5 changes: 3 additions & 2 deletions test/Dapr.Client.Test/DaprClientTest.InvokeMethodGrpcAsync.cs
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

0 comments on commit 1b7c9f4

Please sign in to comment.