Skip to content

Commit 6eeaff0

Browse files
committed
Enhance PurgeResult to include completion status and update related gRPC response handling. Added new AbandonTask RPCs in orchestrator_service.proto. Updated versions.txt with latest proto file source.
1 parent dc7c09b commit 6eeaff0

File tree

4 files changed

+46
-4
lines changed

4 files changed

+46
-4
lines changed

src/Client/Core/PurgeResult.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,23 @@ public class PurgeResult
1212
/// Initializes a new instance of the <see cref="PurgeResult" /> class.
1313
/// </summary>
1414
/// <param name="count">The count of instances purged.</param>
15-
public PurgeResult(int count)
15+
/// <param name="isComplete">A value indicating whether the purge operation is complete. Default is null.</param>
16+
public PurgeResult(int count, bool? isComplete = null)
1617
{
1718
Check.Argument(count >= 0, nameof(count), "Count must be non-negative");
1819
this.PurgedInstanceCount = count;
20+
this.IsComplete = isComplete;
1921
}
2022

2123
/// <summary>
2224
/// Gets the number of purged instances.
2325
/// </summary>
2426
/// <value>The number of purged instances.</value>
2527
public int PurgedInstanceCount { get; }
28+
29+
/// <summary>
30+
/// Gets a value indicating whether the purge operation is complete.
31+
/// </summary>
32+
/// <value>A value indicating whether the purge operation is complete.</value>
33+
public bool? IsComplete { get; }
2634
}

src/Client/Grpc/GrpcDurableTaskClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ async Task<PurgeResult> PurgeInstancesCoreAsync(
446446
{
447447
P.PurgeInstancesResponse response = await this.sidecarClient.PurgeInstancesAsync(
448448
request, cancellationToken: cancellation);
449-
return new PurgeResult(response.DeletedInstanceCount);
449+
return new PurgeResult(response.DeletedInstanceCount, response.IsComplete);
450450
}
451451
catch (RpcException e) when (e.StatusCode == StatusCode.Cancelled)
452452
{

src/Grpc/orchestrator_service.proto

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ message PurgeInstanceFilter {
463463

464464
message PurgeInstancesResponse {
465465
int32 deletedInstanceCount = 1;
466+
google.protobuf.BoolValue isComplete = 2;
466467
}
467468

468469
message CreateTaskHubRequest {
@@ -617,6 +618,30 @@ message StartNewOrchestrationAction {
617618
google.protobuf.Timestamp scheduledTime = 5;
618619
}
619620

621+
message AbandonActivityTaskRequest {
622+
string completionToken = 1;
623+
}
624+
625+
message AbandonActivityTaskResponse {
626+
// Empty.
627+
}
628+
629+
message AbandonOrchestrationTaskRequest {
630+
string completionToken = 1;
631+
}
632+
633+
message AbandonOrchestrationTaskResponse {
634+
// Empty.
635+
}
636+
637+
message AbandonEntityTaskRequest {
638+
string completionToken = 1;
639+
}
640+
641+
message AbandonEntityTaskResponse {
642+
// Empty.
643+
}
644+
620645
service TaskHubSidecarService {
621646
// Sends a hello request to the sidecar service.
622647
rpc Hello(google.protobuf.Empty) returns (google.protobuf.Empty);
@@ -678,6 +703,15 @@ service TaskHubSidecarService {
678703

679704
// clean entity storage
680705
rpc CleanEntityStorage(CleanEntityStorageRequest) returns (CleanEntityStorageResponse);
706+
707+
// Abandons a single work item
708+
rpc AbandonTaskActivityWorkItem(AbandonActivityTaskRequest) returns (AbandonActivityTaskResponse);
709+
710+
// Abandon an orchestration work item
711+
rpc AbandonTaskOrchestratorWorkItem(AbandonOrchestrationTaskRequest) returns (AbandonOrchestrationTaskResponse);
712+
713+
// Abandon an entity work item
714+
rpc AbandonTaskEntityWorkItem(AbandonEntityTaskRequest) returns (AbandonEntityTaskResponse);
681715
}
682716

683717
message GetWorkItemsRequest {

src/Grpc/versions.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# The following files were downloaded from branch main at 2025-03-19 19:55:31 UTC
2-
https://raw.githubusercontent.com/microsoft/durabletask-protobuf/4792f47019ab2b3e9ea979fb4af72427a4144c51/protos/orchestrator_service.proto
1+
# The following files were downloaded from branch main at 2025-03-24 23:37:31 UTC
2+
https://raw.githubusercontent.com/microsoft/durabletask-protobuf/c85ef11430ff8e10e21105abb545b0803bb86c66/protos/orchestrator_service.proto

0 commit comments

Comments
 (0)