Skip to content

Commit

Permalink
Add support for reset in batch API (#269)
Browse files Browse the repository at this point in the history
* Add reset option to batch operations

* fix comments
  • Loading branch information
samanbarghi authored May 2, 2023
1 parent e40424b commit 09fa9cb
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions temporal/api/batch/v1/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import "google/protobuf/timestamp.proto";

import "temporal/api/common/v1/message.proto";
import "temporal/api/enums/v1/batch_operation.proto";
import "temporal/api/enums/v1/reset.proto";

message BatchOperationInfo {
// Batch job ID
Expand Down Expand Up @@ -86,4 +87,15 @@ message BatchOperationCancellation {
message BatchOperationDeletion {
// The identity of the worker/client
string identity = 1;
}

// BatchOperationReset sends reset requests to batch workflows.
// Keep the parameter in sync with temporal.api.workflowservice.v1.ResetWorkflowExecutionRequest.
message BatchOperationReset {
// Reset type.
temporal.api.enums.v1.ResetType reset_type = 1;
// History event reapply options.
temporal.api.enums.v1.ResetReapplyType reset_reapply_type = 2;
// The identity of the worker/client.
string identity = 3;
}
1 change: 1 addition & 0 deletions temporal/api/enums/v1/batch_operation.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ enum BatchOperationType {
BATCH_OPERATION_TYPE_CANCEL = 2;
BATCH_OPERATION_TYPE_SIGNAL = 3;
BATCH_OPERATION_TYPE_DELETE = 4;
BATCH_OPERATION_TYPE_RESET = 5;
}

enum BatchOperationState {
Expand Down
9 changes: 9 additions & 0 deletions temporal/api/enums/v1/reset.proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,12 @@ enum ResetReapplyType {
RESET_REAPPLY_TYPE_SIGNAL = 1;
RESET_REAPPLY_TYPE_NONE = 2;
}

// Reset type options
enum ResetType {
RESET_TYPE_UNSPECIFIED = 0;
// Resets to event of the first workflow task completed, or if it does not exist, the event after task scheduled.
RESET_TYPE_FIRST_WORKFLOW_TASK = 1;
// Resets to event of the last workflow task completed, or if it does not exist, the event after task scheduled.
RESET_TYPE_LAST_WORKFLOW_TASK = 2;
}
1 change: 1 addition & 0 deletions temporal/api/workflowservice/v1/request_response.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,7 @@ message StartBatchOperationRequest {
temporal.api.batch.v1.BatchOperationSignal signal_operation = 11;
temporal.api.batch.v1.BatchOperationCancellation cancellation_operation = 12;
temporal.api.batch.v1.BatchOperationDeletion deletion_operation = 13;
temporal.api.batch.v1.BatchOperationReset reset_operation = 14;
}
}

Expand Down

0 comments on commit 09fa9cb

Please sign in to comment.