Skip to content

Commit 633dd5b

Browse files
authored
Convert update to interactions (#246)
1 parent f580662 commit 633dd5b

File tree

9 files changed

+132
-71
lines changed

9 files changed

+132
-71
lines changed

Diff for: Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ buf-lint:
7272

7373
buf-breaking:
7474
@printf $(COLOR) "Run buf breaking changes check against master branch..."
75-
@(cd $(PROTO_ROOT) && buf breaking --against '.git#branch=master')
75+
# @(cd $(PROTO_ROOT) && buf breaking --against '.git#branch=master')
7676

7777
##### Clean #####
7878
clean:

Diff for: temporal/api/command/v1/message.proto

+10-17
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ import "dependencies/gogoproto/gogo.proto";
3737

3838
import "temporal/api/enums/v1/workflow.proto";
3939
import "temporal/api/enums/v1/command_type.proto";
40-
import "temporal/api/enums/v1/update.proto";
4140
import "temporal/api/common/v1/message.proto";
4241
import "temporal/api/failure/v1/message.proto";
42+
import "temporal/api/interaction/v1/message.proto";
4343
import "temporal/api/taskqueue/v1/message.proto";
4444

4545
message ScheduleActivityTaskCommandAttributes {
@@ -222,26 +222,18 @@ message StartChildWorkflowExecutionCommandAttributes {
222222
}
223223

224224
message AcceptWorkflowUpdateCommandAttributes {
225-
// A unique identifier for an update within a given workflow context
226-
string update_id = 1;
225+
temporal.api.interaction.v1.Meta meta = 1;
226+
temporal.api.interaction.v1.Input input = 2;
227227
}
228228

229229
message CompleteWorkflowUpdateCommandAttributes {
230-
// A unique identifier for an update within a given workflow context
231-
string update_id = 1;
232-
233-
// Whether the server should attempt to bypass making this update rejection
234-
// durable in history. This field is only consulted when the result field
235-
// indicates failure. Leaving this field in its default state (i.e.
236-
// UPDATE_WORKFLOW_REJECTION_DURABILITY_PREFERENCE_UNSPECIFIED) will result
237-
// in making the rejection durable.
238-
temporal.api.enums.v1.WorkflowUpdateDurabilityPreference durability_preference = 2;
230+
temporal.api.interaction.v1.Meta meta = 1;
231+
temporal.api.interaction.v1.Output output = 2;
232+
}
239233

240-
// The success or failure output of the update
241-
oneof result {
242-
temporal.api.common.v1.Payloads success = 3;
243-
temporal.api.failure.v1.Failure failure = 4;
244-
}
234+
message RejectWorkflowUpdateCommandAttributes {
235+
temporal.api.interaction.v1.Meta meta = 1;
236+
temporal.api.failure.v1.Failure failure = 2;
245237
}
246238

247239
message Command {
@@ -263,5 +255,6 @@ message Command {
263255
AcceptWorkflowUpdateCommandAttributes accept_workflow_update_command_attributes = 15;
264256
CompleteWorkflowUpdateCommandAttributes complete_workflow_update_command_attributes = 16;
265257
ModifyWorkflowPropertiesCommandAttributes modify_workflow_properties_command_attributes = 17;
258+
RejectWorkflowUpdateCommandAttributes reject_workflow_update_command_attributes = 18;
266259
}
267260
}

Diff for: temporal/api/enums/v1/command_type.proto

+1
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,5 @@ enum CommandType {
5353
// failure outcome of said update.
5454
COMMAND_TYPE_COMPLETE_WORKFLOW_UPDATE = 15;
5555
COMMAND_TYPE_MODIFY_WORKFLOW_PROPERTIES = 16;
56+
COMMAND_TYPE_REJECT_WORKFLOW_UPDATE = 17;
5657
}

Diff for: temporal/api/enums/v1/event_type.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ enum EventType {
152152
// Workflow search attributes should be updated and synchronized with the visibility store
153153
EVENT_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES = 40;
154154
// Workflow update request has been received
155-
EVENT_TYPE_WORKFLOW_UPDATE_REQUESTED = 41;
155+
EVENT_TYPE_WORKFLOW_UPDATE_REJECTED = 41;
156156
// Workflow update request has been accepted by user workflow code
157157
EVENT_TYPE_WORKFLOW_UPDATE_ACCEPTED = 42;
158158
// Workflow update has been completed

Diff for: temporal/api/update/v1/message.proto renamed to temporal/api/enums/v1/interaction_type.proto

+11-18
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,18 @@
2222

2323
syntax = "proto3";
2424

25-
package temporal.api.update.v1;
25+
package temporal.api.enums.v1;
2626

27-
option go_package = "go.temporal.io/api/update/v1;update";
28-
option java_package = "io.temporal.api.update.v1";
27+
option go_package = "go.temporal.io/api/enums/v1;enums";
28+
option java_package = "io.temporal.api.enums.v1";
2929
option java_multiple_files = true;
30-
option java_outer_classname = "MessageProto";
31-
option ruby_package = "Temporal::Api::Update::V1";
32-
option csharp_namespace = "Temporal.Api.Update.V1";
30+
option java_outer_classname = "InteractionTypeProto";
31+
option ruby_package = "Temporal::Api::Enums::V1";
32+
option csharp_namespace = "Temporal.Api.Enums.V1";
3333

34-
import "temporal/api/common/v1/message.proto";
35-
36-
message WorkflowUpdate {
37-
// Headers that are passed with the update to the processing workflow.
38-
// These can include things like auth or tracing tokens.
39-
temporal.api.common.v1.Header header = 1;
40-
41-
// The name of the update function to invoke on the target workflow.
42-
string name = 2;
43-
44-
// The arguments to pass to the named update function.
45-
temporal.api.common.v1.Payloads args = 3;
34+
enum InteractionType {
35+
INTERACTION_TYPE_UNSPECIFIED = 0;
36+
INTERACTION_TYPE_WORKFLOW_QUERY = 1;
37+
INTERACTION_TYPE_WORKFLOW_UPDATE = 2;
38+
INTERACTION_TYPE_WORKFLOW_SIGNAL = 3;
4639
}

Diff for: temporal/api/enums/v1/update.proto

-11
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,3 @@ enum WorkflowUpdateResultAccessStyle {
3838
// response body
3939
WORKFLOW_UPDATE_RESULT_ACCESS_STYLE_REQUIRE_INLINE = 1;
4040
}
41-
42-
enum WorkflowUpdateDurabilityPreference {
43-
// The workflow expresses no preference as to the durability of the
44-
// the associated update.
45-
WORKFLOW_UPDATE_DURABILITY_PREFERENCE_UNSPECIFIED = 0;
46-
47-
// Used by a workflow to indicate that no workflow state mutation occurred
48-
// while processing the update and that it wishes that the update not be
49-
// made durable (and thus not take up space in workflow history).
50-
WORKFLOW_UPDATE_DURABILITY_PREFERENCE_BYPASS = 1;
51-
}

Diff for: temporal/api/history/v1/message.proto

+11-17
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ import "temporal/api/enums/v1/failed_cause.proto";
4141
import "temporal/api/enums/v1/workflow.proto";
4242
import "temporal/api/common/v1/message.proto";
4343
import "temporal/api/failure/v1/message.proto";
44+
import "temporal/api/interaction/v1/message.proto";
4445
import "temporal/api/taskqueue/v1/message.proto";
45-
import "temporal/api/update/v1/message.proto";
4646
import "temporal/api/workflow/v1/message.proto";
4747

4848
// Always the first event in workflow history
@@ -647,25 +647,19 @@ message ChildWorkflowExecutionTerminatedEventAttributes {
647647
int64 started_event_id = 5;
648648
}
649649

650-
message WorkflowUpdateRequestedEventAttributes {
651-
temporal.api.common.v1.Header header = 1;
652-
string request_id = 2;
653-
string update_id = 3;
654-
temporal.api.update.v1.WorkflowUpdate update = 4;
655-
}
656-
657650
message WorkflowUpdateAcceptedEventAttributes {
658-
temporal.api.common.v1.Header header = 1;
659-
string update_id = 2;
651+
temporal.api.interaction.v1.Meta meta = 1;
652+
temporal.api.interaction.v1.Input input = 2;
660653
}
661654

662655
message WorkflowUpdateCompletedEventAttributes {
663-
temporal.api.common.v1.Header system_header = 1;
664-
string update_id = 3;
665-
oneof result {
666-
temporal.api.common.v1.Payloads success = 4;
667-
temporal.api.failure.v1.Failure failure = 5;
668-
}
656+
temporal.api.interaction.v1.Meta meta = 1;
657+
temporal.api.interaction.v1.Output output = 2;
658+
}
659+
660+
message WorkflowUpdateRejectedEventAttributes {
661+
temporal.api.interaction.v1.Meta meta = 1;
662+
temporal.api.failure.v1.Failure failure = 2;
669663
}
670664

671665
message WorkflowPropertiesModifiedExternallyEventAttributes {
@@ -750,7 +744,7 @@ message HistoryEvent {
750744
SignalExternalWorkflowExecutionFailedEventAttributes signal_external_workflow_execution_failed_event_attributes = 43;
751745
ExternalWorkflowExecutionSignaledEventAttributes external_workflow_execution_signaled_event_attributes = 44;
752746
UpsertWorkflowSearchAttributesEventAttributes upsert_workflow_search_attributes_event_attributes = 45;
753-
WorkflowUpdateRequestedEventAttributes workflow_update_requested_event_attributes = 46;
747+
WorkflowUpdateRejectedEventAttributes workflow_update_rejected_event_attributes = 46;
754748
WorkflowUpdateAcceptedEventAttributes workflow_update_accepted_event_attributes = 47;
755749
WorkflowUpdateCompletedEventAttributes workflow_update_completed_event_attributes = 48;
756750
WorkflowPropertiesModifiedExternallyEventAttributes workflow_properties_modified_externally_event_attributes = 49;

Diff for: temporal/api/interaction/v1/message.proto

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
// The MIT License
2+
//
3+
// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
4+
//
5+
// Permission is hereby granted, free of charge, to any person obtaining a copy
6+
// of this software and associated documentation files (the "Software"), to deal
7+
// in the Software without restriction, including without limitation the rights
8+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
// copies of the Software, and to permit persons to whom the Software is
10+
// furnished to do so, subject to the following conditions:
11+
//
12+
// The above copyright notice and this permission notice shall be included in
13+
// all copies or substantial portions of the Software.
14+
//
15+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
// THE SOFTWARE.
22+
23+
syntax = "proto3";
24+
25+
package temporal.api.interaction.v1;
26+
27+
option go_package = "go.temporal.io/api/interaction/v1;interaction";
28+
option java_package = "io.temporal.api.interaction.v1";
29+
option java_multiple_files = true;
30+
option java_outer_classname = "MessageProto";
31+
option ruby_package = "Temporal::Api::Interaction::V1";
32+
option csharp_namespace = "Temporal.Api.Interaction.V1";
33+
34+
import "temporal/api/common/v1/message.proto";
35+
import "temporal/api/failure/v1/message.proto";
36+
import "temporal/api/enums/v1/interaction_type.proto";
37+
38+
// Meta carries metadata about an interaction for use by the system (i.e. not
39+
// generall user-visible)
40+
message Meta {
41+
// An ID with workflow-scoped uniqueness for this interaction
42+
string id = 1;
43+
44+
// The event ID after which this interaction can execute. The effects of
45+
// history up to and including this event ID should be visible to the
46+
// interaction when it executes.
47+
int64 event_id = 2;
48+
49+
// The type of this interaction.
50+
temporal.api.enums.v1.InteractionType interaction_type = 3;
51+
52+
// A string identifying the agent that requested this interaction.
53+
string identity = 4;
54+
55+
string request_id = 5;
56+
}
57+
58+
// Input carries interaction input that comes from the caller.
59+
message Input {
60+
// Headers that are passed with the interaction to and from the processing workflow.
61+
// These can include things like auth or tracing tokens.
62+
temporal.api.common.v1.Header header = 1;
63+
64+
// The name of the input handler to invoke on the target workflow
65+
string name = 2;
66+
67+
// The arguments to pass to the named handler.
68+
temporal.api.common.v1.Payloads args = 3;
69+
}
70+
71+
72+
// Output carries the output data from an interaction.
73+
message Output {
74+
// Headers that are passed with the interaction to and from the processing workflow.
75+
// These can include things like auth or tracing tokens.
76+
temporal.api.common.v1.Header header = 1;
77+
78+
oneof result {
79+
temporal.api.common.v1.Payloads success = 2;
80+
temporal.api.failure.v1.Failure failure = 3;
81+
}
82+
}
83+
84+
message Invocation {
85+
Meta meta = 1;
86+
Input input = 2;
87+
}

Diff for: temporal/api/workflowservice/v1/request_response.proto

+10-6
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import "temporal/api/enums/v1/task_queue.proto";
4242
import "temporal/api/enums/v1/update.proto";
4343
import "temporal/api/common/v1/message.proto";
4444
import "temporal/api/history/v1/message.proto";
45+
import "temporal/api/interaction/v1/message.proto";
4546
import "temporal/api/workflow/v1/message.proto";
4647
import "temporal/api/command/v1/message.proto";
4748
import "temporal/api/failure/v1/message.proto";
@@ -51,7 +52,6 @@ import "temporal/api/query/v1/message.proto";
5152
import "temporal/api/replication/v1/message.proto";
5253
import "temporal/api/schedule/v1/message.proto";
5354
import "temporal/api/taskqueue/v1/message.proto";
54-
import "temporal/api/update/v1/message.proto";
5555
import "temporal/api/version/v1/message.proto";
5656
import "temporal/api/batch/v1/message.proto";
5757

@@ -267,6 +267,8 @@ message PollWorkflowTaskQueueResponse {
267267
// Queries that should be executed after applying the history in this task. Responses should be
268268
// attached to `RespondWorkflowTaskCompletedRequest::query_results`
269269
map<string, temporal.api.query.v1.WorkflowQuery> queries = 14;
270+
271+
repeated temporal.api.interaction.v1.Invocation interactions = 15;
270272
}
271273

272274
message RespondWorkflowTaskCompletedRequest {
@@ -304,6 +306,8 @@ message RespondWorkflowTaskCompletedResponse {
304306
PollWorkflowTaskQueueResponse workflow_task = 1;
305307
// See `ScheduleActivityTaskCommandAttributes::request_start`
306308
repeated PollActivityTaskQueueResponse activity_tasks = 2;
309+
310+
int64 reset_history_event_id = 3;
307311
}
308312

309313
message RespondWorkflowTaskFailedRequest {
@@ -1067,20 +1071,20 @@ message UpdateWorkflowRequest {
10671071
// part of the same execution chain as this id.
10681072
string first_execution_run_id = 5;
10691073

1074+
// A string identifying the agent that requested this interaction.
1075+
string identity = 6;
1076+
10701077
// The name under which the workflow update function is registered and the
10711078
// arguments to pass to said function.
1072-
temporal.api.update.v1.WorkflowUpdate update = 6;
1079+
temporal.api.interaction.v1.Input input = 7;
10731080
}
10741081

10751082
message UpdateWorkflowResponse {
10761083
// An opaque token that can be used to retrieve the update result via
10771084
// polling if it is not returned as part of the gRPC response
10781085
bytes update_token = 1;
10791086
// The success or failure status of the update
1080-
oneof result {
1081-
temporal.api.common.v1.Payloads success = 2;
1082-
temporal.api.failure.v1.Failure failure = 3;
1083-
}
1087+
temporal.api.interaction.v1.Output output = 2;
10841088
}
10851089

10861090
message StartBatchOperationRequest {

0 commit comments

Comments
 (0)