@temporalio/core-bridge 1.1.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/Cargo.lock +765 -128
  2. package/Cargo.toml +2 -2
  3. package/common.js +7 -3
  4. package/index.d.ts +118 -5
  5. package/index.js +2 -6
  6. package/package.json +2 -3
  7. package/releases/aarch64-apple-darwin/index.node +0 -0
  8. package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
  9. package/releases/x86_64-apple-darwin/index.node +0 -0
  10. package/releases/x86_64-pc-windows-msvc/index.node +0 -0
  11. package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
  12. package/scripts/build.js +4 -3
  13. package/sdk-core/.buildkite/docker/Dockerfile +2 -1
  14. package/sdk-core/.buildkite/pipeline.yml +2 -0
  15. package/sdk-core/.cargo/config.toml +1 -1
  16. package/sdk-core/ARCHITECTURE.md +2 -2
  17. package/sdk-core/README.md +12 -0
  18. package/sdk-core/bridge-ffi/Cargo.toml +2 -2
  19. package/sdk-core/bridge-ffi/src/lib.rs +2 -2
  20. package/sdk-core/client/Cargo.toml +7 -5
  21. package/sdk-core/client/src/lib.rs +354 -226
  22. package/sdk-core/client/src/metrics.rs +13 -11
  23. package/sdk-core/client/src/raw.rs +352 -107
  24. package/sdk-core/client/src/retry.rs +188 -147
  25. package/sdk-core/client/src/workflow_handle/mod.rs +1 -1
  26. package/sdk-core/core/Cargo.toml +28 -15
  27. package/sdk-core/core/src/core_tests/activity_tasks.rs +98 -33
  28. package/sdk-core/core/src/core_tests/child_workflows.rs +125 -3
  29. package/sdk-core/core/src/core_tests/local_activities.rs +6 -6
  30. package/sdk-core/core/src/core_tests/workers.rs +3 -2
  31. package/sdk-core/core/src/core_tests/workflow_tasks.rs +70 -2
  32. package/sdk-core/core/src/ephemeral_server/mod.rs +515 -0
  33. package/sdk-core/core/src/lib.rs +62 -28
  34. package/sdk-core/core/src/pollers/mod.rs +2 -0
  35. package/sdk-core/core/src/pollers/poll_buffer.rs +4 -4
  36. package/sdk-core/core/src/replay/mod.rs +3 -3
  37. package/sdk-core/core/src/retry_logic.rs +10 -9
  38. package/sdk-core/core/src/telemetry/metrics.rs +48 -39
  39. package/sdk-core/core/src/telemetry/mod.rs +46 -12
  40. package/sdk-core/core/src/telemetry/prometheus_server.rs +17 -13
  41. package/sdk-core/core/src/test_help/mod.rs +18 -8
  42. package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +10 -10
  43. package/sdk-core/core/src/worker/activities/local_activities.rs +13 -13
  44. package/sdk-core/core/src/worker/activities.rs +6 -12
  45. package/sdk-core/core/src/worker/client/mocks.rs +1 -0
  46. package/sdk-core/core/src/worker/client.rs +193 -64
  47. package/sdk-core/core/src/worker/mod.rs +14 -19
  48. package/sdk-core/core/src/worker/workflow/driven_workflow.rs +3 -0
  49. package/sdk-core/core/src/worker/workflow/history_update.rs +5 -5
  50. package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +133 -85
  51. package/sdk-core/core/src/worker/workflow/machines/mod.rs +3 -2
  52. package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +160 -105
  53. package/sdk-core/core/src/worker/workflow/managed_run.rs +2 -1
  54. package/sdk-core/core/src/worker/workflow/mod.rs +62 -58
  55. package/sdk-core/core/src/worker/workflow/run_cache.rs +5 -3
  56. package/sdk-core/core/src/worker/workflow/workflow_stream.rs +7 -5
  57. package/sdk-core/core-api/Cargo.toml +3 -3
  58. package/sdk-core/core-api/src/errors.rs +3 -11
  59. package/sdk-core/core-api/src/worker.rs +7 -0
  60. package/sdk-core/protos/api_upstream/.buildkite/Dockerfile +1 -1
  61. package/sdk-core/protos/api_upstream/.github/CODEOWNERS +1 -1
  62. package/sdk-core/protos/api_upstream/.github/PULL_REQUEST_TEMPLATE.md +2 -6
  63. package/sdk-core/protos/api_upstream/.github/workflows/trigger-api-go-update.yml +29 -0
  64. package/sdk-core/protos/api_upstream/Makefile +2 -2
  65. package/sdk-core/protos/api_upstream/buf.yaml +1 -0
  66. package/sdk-core/protos/api_upstream/temporal/api/batch/v1/message.proto +86 -0
  67. package/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +26 -0
  68. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/batch_operation.proto +46 -0
  69. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/command_type.proto +7 -0
  70. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/event_type.proto +14 -0
  71. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/update.proto +51 -0
  72. package/sdk-core/protos/api_upstream/temporal/api/failure/v1/message.proto +18 -0
  73. package/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +57 -1
  74. package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +1 -3
  75. package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +4 -2
  76. package/sdk-core/protos/api_upstream/temporal/api/replication/v1/message.proto +11 -0
  77. package/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +23 -0
  78. package/sdk-core/protos/api_upstream/temporal/api/update/v1/message.proto +46 -0
  79. package/sdk-core/protos/api_upstream/temporal/api/workflow/v1/message.proto +1 -0
  80. package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +172 -0
  81. package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +30 -0
  82. package/sdk-core/protos/grpc/health/v1/health.proto +63 -0
  83. package/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +18 -15
  84. package/sdk-core/protos/testsrv_upstream/Makefile +80 -0
  85. package/sdk-core/protos/testsrv_upstream/api-linter.yaml +38 -0
  86. package/sdk-core/protos/testsrv_upstream/buf.yaml +13 -0
  87. package/sdk-core/protos/testsrv_upstream/dependencies/gogoproto/gogo.proto +141 -0
  88. package/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +63 -0
  89. package/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto +90 -0
  90. package/sdk-core/sdk/Cargo.toml +2 -2
  91. package/sdk-core/sdk/src/lib.rs +2 -2
  92. package/sdk-core/sdk/src/workflow_context/options.rs +36 -8
  93. package/sdk-core/sdk/src/workflow_context.rs +30 -6
  94. package/sdk-core/sdk/src/workflow_future.rs +4 -4
  95. package/sdk-core/sdk-core-protos/Cargo.toml +5 -5
  96. package/sdk-core/sdk-core-protos/build.rs +9 -1
  97. package/sdk-core/sdk-core-protos/src/history_builder.rs +6 -1
  98. package/sdk-core/sdk-core-protos/src/lib.rs +93 -32
  99. package/sdk-core/test-utils/Cargo.toml +3 -3
  100. package/sdk-core/test-utils/src/canned_histories.rs +58 -0
  101. package/sdk-core/test-utils/src/lib.rs +35 -12
  102. package/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +128 -0
  103. package/sdk-core/tests/integ_tests/heartbeat_tests.rs +55 -5
  104. package/sdk-core/tests/integ_tests/polling_tests.rs +2 -1
  105. package/sdk-core/tests/integ_tests/queries_tests.rs +5 -5
  106. package/sdk-core/tests/integ_tests/visibility_tests.rs +93 -0
  107. package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +93 -10
  108. package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +1 -1
  109. package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +14 -14
  110. package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +2 -6
  111. package/sdk-core/tests/integ_tests/workflow_tests/resets.rs +12 -12
  112. package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +12 -1
  113. package/sdk-core/tests/integ_tests/workflow_tests/timers.rs +3 -3
  114. package/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +8 -2
  115. package/sdk-core/tests/integ_tests/workflow_tests.rs +19 -4
  116. package/sdk-core/tests/load_tests.rs +2 -1
  117. package/sdk-core/tests/main.rs +17 -0
  118. package/sdk-core/tests/runner.rs +93 -0
  119. package/src/conversions.rs +157 -94
  120. package/src/helpers.rs +190 -0
  121. package/src/lib.rs +10 -912
  122. package/src/runtime.rs +436 -0
  123. package/src/testing.rs +67 -0
  124. package/src/worker.rs +465 -0
@@ -0,0 +1,46 @@
1
+ // The MIT License
2
+ //
3
+ // Copyright (c) 2022 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.enums.v1;
26
+
27
+ option go_package = "go.temporal.io/api/enums/v1;enums";
28
+ option java_package = "io.temporal.api.enums.v1";
29
+ option java_multiple_files = true;
30
+ option java_outer_classname = "BatchOperationProto";
31
+ option ruby_package = "Temporal::Api::Enums::V1";
32
+ option csharp_namespace = "Temporal.Api.Enums.V1";
33
+
34
+ enum BatchOperationType {
35
+ BATCH_OPERATION_TYPE_UNSPECIFIED = 0;
36
+ BATCH_OPERATION_TYPE_TERMINATE = 1;
37
+ BATCH_OPERATION_TYPE_CANCEL = 2;
38
+ BATCH_OPERATION_TYPE_SIGNAL = 3;
39
+ }
40
+
41
+ enum BatchOperationState {
42
+ BATCH_OPERATION_STATE_UNSPECIFIED = 0;
43
+ BATCH_OPERATION_STATE_RUNNING = 1;
44
+ BATCH_OPERATION_STATE_COMPLETED = 2;
45
+ BATCH_OPERATION_STATE_FAILED = 3;
46
+ }
@@ -47,4 +47,11 @@ enum CommandType {
47
47
  COMMAND_TYPE_START_CHILD_WORKFLOW_EXECUTION = 11;
48
48
  COMMAND_TYPE_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION = 12;
49
49
  COMMAND_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES = 13;
50
+
51
+ // Indicates that an update has been accepted for processing workflow code
52
+ COMMAND_TYPE_ACCEPT_WORKFLOW_UPDATE = 14;
53
+
54
+ // Indicates that an update has completed and carries either the success or
55
+ // failure outcome of said update.
56
+ COMMAND_TYPE_COMPLETE_WORKFLOW_UPDATE = 15;
50
57
  }
@@ -151,4 +151,18 @@ enum EventType {
151
151
  EVENT_TYPE_EXTERNAL_WORKFLOW_EXECUTION_SIGNALED = 39;
152
152
  // Workflow search attributes should be updated and synchronized with the visibility store
153
153
  EVENT_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES = 40;
154
+ // Workflow update request has been received
155
+ EVENT_TYPE_WORKFLOW_UPDATE_REQUESTED = 41;
156
+ // Workflow update request has been accepted by user workflow code
157
+ EVENT_TYPE_WORKFLOW_UPDATE_ACCEPTED = 42;
158
+ // Workflow update has been completed
159
+ EVENT_TYPE_WORKFLOW_UPDATE_COMPLETED = 43;
160
+ // Some property or properties of the workflow as a whole have changed by non-workflow code.
161
+ // The distinction of external vs. command-based modification is important so the SDK can
162
+ // maintain determinism when using the command-based approach.
163
+ EVENT_TYPE_WORKFLOW_PROPERTIES_MODIFIED_EXTERNALLY = 44;
164
+ // Some property or properties of an already-scheduled activity have changed by non-workflow code.
165
+ // The distinction of external vs. command-based modification is important so the SDK can
166
+ // maintain determinism when using the command-based approach.
167
+ EVENT_TYPE_ACTIVITY_PROPERTIES_MODIFIED_EXTERNALLY = 45;
154
168
  }
@@ -0,0 +1,51 @@
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.enums.v1;
26
+
27
+ option go_package = "go.temporal.io/api/enums/v1;enums";
28
+ option java_package = "io.temporal.api.enums.v1";
29
+ option java_multiple_files = true;
30
+ option java_outer_classname = "UpdateProto";
31
+ option ruby_package = "Temporal::Api::Enums::V1";
32
+ option csharp_namespace = "Temporal.Api.Enums.V1";
33
+
34
+ enum WorkflowUpdateResultAccessStyle {
35
+ WORKFLOW_UPDATE_RESULT_ACCESS_STYLE_UNSPECIFIED = 0;
36
+
37
+ // Indicates that the update response _must_ be included as part of the gRPC
38
+ // response body
39
+ WORKFLOW_UPDATE_RESULT_ACCESS_STYLE_REQUIRE_INLINE = 1;
40
+ }
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
+ }
@@ -80,8 +80,26 @@ message ChildWorkflowExecutionFailureInfo {
80
80
 
81
81
  message Failure {
82
82
  string message = 1;
83
+ // The source this Failure originated in, e.g. TypeScriptSDK / JavaSDK
84
+ // In some SDKs this is used to rehydrate the stack trace into an exception object.
83
85
  string source = 2;
84
86
  string stack_trace = 3;
87
+ // Alternative way to supply `message` and `stack_trace` and possibly other attributes, used for encryption of
88
+ // errors originating in user code which might contain sensitive information.
89
+ // The `encoded_attributes` Payload could represent any serializable object, e.g. JSON object or a `Failure` proto
90
+ // message.
91
+ //
92
+ // SDK authors:
93
+ // - The SDK should provide a default `encodeFailureAttributes` and `decodeFailureAttributes` implementation that:
94
+ // - Uses a JSON object to represent `{ message, stack_trace }`.
95
+ // - Overwrites the original message with "Encoded failure" to indicate that more information could be extracted.
96
+ // - Overwrites the original stack_trace with an empty string.
97
+ // - The resulting JSON object is converted to Payload using the default PayloadConverter and should be processed
98
+ // by the user-provided PayloadCodec
99
+ //
100
+ // - If there's demand, we could allow overriding the default SDK implementation to encode other opaque Failure attributes.
101
+ // (-- api-linter: core::0203::optional=disabled --)
102
+ temporal.api.common.v1.Payload encoded_attributes = 20;
85
103
  Failure cause = 4;
86
104
  oneof failure_info {
87
105
  ApplicationFailureInfo application_failure_info = 5;
@@ -41,8 +41,9 @@ import "temporal/api/enums/v1/failed_cause.proto";
41
41
  import "temporal/api/enums/v1/workflow.proto";
42
42
  import "temporal/api/common/v1/message.proto";
43
43
  import "temporal/api/failure/v1/message.proto";
44
- import "temporal/api/workflow/v1/message.proto";
45
44
  import "temporal/api/taskqueue/v1/message.proto";
45
+ import "temporal/api/update/v1/message.proto";
46
+ import "temporal/api/workflow/v1/message.proto";
46
47
 
47
48
  // Always the first event in workflow history
48
49
  message WorkflowExecutionStartedEventAttributes {
@@ -634,6 +635,51 @@ message ChildWorkflowExecutionTerminatedEventAttributes {
634
635
  int64 started_event_id = 5;
635
636
  }
636
637
 
638
+ message WorkflowUpdateRequestedEventAttributes {
639
+ temporal.api.common.v1.Header header = 1;
640
+ string request_id = 2;
641
+ string update_id = 3;
642
+ temporal.api.update.v1.WorkflowUpdate update = 4;
643
+ }
644
+
645
+ message WorkflowUpdateAcceptedEventAttributes {
646
+ temporal.api.common.v1.Header header = 1;
647
+ string update_id = 2;
648
+ }
649
+
650
+ message WorkflowUpdateCompletedEventAttributes {
651
+ temporal.api.common.v1.Header system_header = 1;
652
+ string update_id = 3;
653
+ oneof result {
654
+ temporal.api.common.v1.Payloads success = 4;
655
+ temporal.api.failure.v1.Failure failure = 5;
656
+ }
657
+ }
658
+
659
+ message WorkflowPropertiesModifiedExternallyEventAttributes {
660
+ // If set to a nonempty string, future workflow tasks for this workflow shall be dispatched on
661
+ // the provided queue.
662
+ string new_task_queue = 1;
663
+ // If set, update the workflow task timeout to this value.
664
+ google.protobuf.Duration new_workflow_task_timeout = 2 [(gogoproto.stdduration) = true];
665
+ // If set, update the workflow run timeout to this value. May be set to 0 for no timeout.
666
+ google.protobuf.Duration new_workflow_run_timeout = 3 [(gogoproto.stdduration) = true];
667
+ // If set, update the workflow execution timeout to this value. May be set to 0 for no timeout.
668
+ google.protobuf.Duration new_workflow_execution_timeout = 4 [(gogoproto.stdduration) = true];
669
+ // If set, update the workflow memo with the provided values. The values will be merged with
670
+ // the existing memo. If the user wants to delete values, a default/empty Payload should be
671
+ // used as the value for the key being deleted.
672
+ temporal.api.common.v1.Memo upserted_memo = 5;
673
+ }
674
+
675
+ message ActivityPropertiesModifiedExternallyEventAttributes {
676
+ // The id of the `ACTIVITY_TASK_SCHEDULED` event this modification corresponds to.
677
+ int64 scheduled_event_id = 1;
678
+ // If set, update the retry policy of the activity, replacing it with the specified one.
679
+ // The number of attempts at the activity is preserved.
680
+ temporal.api.common.v1.RetryPolicy new_retry_policy = 2;
681
+ }
682
+
637
683
  // History events are the method by which Temporal SDKs advance (or recreate) workflow state.
638
684
  // See the `EventType` enum for more info about what each event is for.
639
685
  message HistoryEvent {
@@ -645,6 +691,11 @@ message HistoryEvent {
645
691
  int64 version = 4;
646
692
  // TODO: What is this? Appears unused by SDKs
647
693
  int64 task_id = 5;
694
+ // Set to true when the SDK may ignore the event as it does not impact workflow state or
695
+ // information in any way that the SDK need be concerned with. If an SDK encounters an event
696
+ // type which it does not understand, it must error unless this is true. If it is true, it's
697
+ // acceptable for the event type and/or attributes to be uninterpretable.
698
+ bool worker_may_ignore = 300;
648
699
  // The event details. The type must match that in `event_type`.
649
700
  oneof attributes {
650
701
  WorkflowExecutionStartedEventAttributes workflow_execution_started_event_attributes = 6;
@@ -687,6 +738,11 @@ message HistoryEvent {
687
738
  SignalExternalWorkflowExecutionFailedEventAttributes signal_external_workflow_execution_failed_event_attributes = 43;
688
739
  ExternalWorkflowExecutionSignaledEventAttributes external_workflow_execution_signaled_event_attributes = 44;
689
740
  UpsertWorkflowSearchAttributesEventAttributes upsert_workflow_search_attributes_event_attributes = 45;
741
+ WorkflowUpdateRequestedEventAttributes workflow_update_requested_event_attributes = 46;
742
+ WorkflowUpdateAcceptedEventAttributes workflow_update_accepted_event_attributes = 47;
743
+ WorkflowUpdateCompletedEventAttributes workflow_update_completed_event_attributes = 48;
744
+ WorkflowPropertiesModifiedExternallyEventAttributes workflow_properties_modified_externally_event_attributes = 49;
745
+ ActivityPropertiesModifiedExternallyEventAttributes activity_properties_modified_externally_event_attributes = 50;
690
746
  }
691
747
  }
692
748
 
@@ -84,18 +84,16 @@ message DeleteNamespaceResponse {
84
84
  string deleted_namespace = 1;
85
85
  }
86
86
 
87
- // This message is EXPERIMENTAL and may be changed or removed in a later release.
88
87
  // (-- api-linter: core::0135::request-unknown-fields=disabled
89
88
  // aip.dev/not-precedent: DeleteNamespace RPC doesn't follow Google API format. --)
90
89
  // (-- api-linter: core::0135::request-name-required=disabled
91
90
  // aip.dev/not-precedent: DeleteNamespace RPC doesn't follow Google API format. --)
92
91
  message DeleteWorkflowExecutionRequest {
93
92
  string namespace = 1;
94
- // Workflow executions to delete. If run_id is not specified, last one is used.
93
+ // Workflow Execution to delete. If run_id is not specified, the latest one is used.
95
94
  temporal.api.common.v1.WorkflowExecution workflow_execution = 2;
96
95
  }
97
96
 
98
- // This message is EXPERIMENTAL and may be changed or removed in a later release.
99
97
  message DeleteWorkflowExecutionResponse {
100
98
  }
101
99
 
@@ -66,8 +66,10 @@ service OperatorService {
66
66
  rpc DeleteNamespace (DeleteNamespaceRequest) returns (DeleteNamespaceResponse) {
67
67
  }
68
68
 
69
- // DeleteWorkflowExecution deletes a closed workflow execution asynchronously (workflow must be completed or terminated before).
70
- // This method is EXPERIMENTAL and may be changed or removed in a later release.
69
+ // DeleteWorkflowExecution asynchronously deletes a specific Workflow Execution (when
70
+ // WorkflowExecution.run_id is provided) or the latest Workflow Execution (when
71
+ // WorkflowExecution.run_id is not provided). If the Workflow Execution is Running, it will be
72
+ // terminated before deletion.
71
73
  // (-- api-linter: core::0135::method-signature=disabled
72
74
  // aip.dev/not-precedent: DeleteNamespace RPC doesn't follow Google API format. --)
73
75
  // (-- api-linter: core::0135::response-message-name=disabled
@@ -31,6 +31,10 @@ option java_outer_classname = "MessageProto";
31
31
  option ruby_package = "Temporal::Api::Replication::V1";
32
32
  option csharp_namespace = "Temporal.Api.Replication.V1";
33
33
 
34
+ import "google/protobuf/timestamp.proto";
35
+
36
+ import "dependencies/gogoproto/gogo.proto";
37
+
34
38
  import "temporal/api/enums/v1/namespace.proto";
35
39
 
36
40
  message ClusterReplicationConfig {
@@ -42,3 +46,10 @@ message NamespaceReplicationConfig {
42
46
  repeated ClusterReplicationConfig clusters = 2;
43
47
  temporal.api.enums.v1.ReplicationState state = 3;
44
48
  }
49
+
50
+ // Represents a historical replication status of a Namespace
51
+ message FailoverStatus {
52
+ // Timestamp when the Cluster switched to the following failover_version
53
+ google.protobuf.Timestamp failover_time = 1 [(gogoproto.stdtime) = true];
54
+ int64 failover_version = 2;
55
+ }
@@ -75,6 +75,9 @@ message PollerInfo {
75
75
  google.protobuf.Timestamp last_access_time = 1 [(gogoproto.stdtime) = true];
76
76
  string identity = 2;
77
77
  double rate_per_second = 3;
78
+ // If a worker has specified an ID for use with the worker versioning feature while polling,
79
+ // that id must appear here.
80
+ string worker_versioning_build_id = 4;
78
81
  }
79
82
 
80
83
  message StickyExecutionAttributes {
@@ -83,3 +86,23 @@ message StickyExecutionAttributes {
83
86
  // aip.dev/not-precedent: "to" is used to indicate interval. --)
84
87
  google.protobuf.Duration schedule_to_start_timeout = 2 [(gogoproto.stdduration) = true];
85
88
  }
89
+
90
+ // Used by the worker versioning APIs, represents a node in the version graph for a particular
91
+ // task queue
92
+ message VersionIdNode {
93
+ VersionId version = 1;
94
+ // A pointer to the previous version this version is considered to be compatible with
95
+ VersionIdNode previous_compatible = 2;
96
+ // A pointer to the last incompatible version (previous major version)
97
+ VersionIdNode previous_incompatible = 3;
98
+ }
99
+
100
+ // Used by the worker versioning APIs, represents a specific version of something
101
+ // Currently, that's just a whole-worker id. In the future, if we support
102
+ // WASM workflow bundle based versioning, for example, then the inside of this
103
+ // message may become a oneof of different version types.
104
+ message VersionId {
105
+ // An opaque whole-worker identifier
106
+ string worker_build_id = 1;
107
+ }
108
+
@@ -0,0 +1,46 @@
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.update.v1;
26
+
27
+ option go_package = "go.temporal.io/api/update/v1;update";
28
+ option java_package = "io.temporal.api.update.v1";
29
+ 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";
33
+
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;
46
+ }
@@ -142,3 +142,4 @@ message NewWorkflowExecutionInfo {
142
142
  temporal.api.common.v1.SearchAttributes search_attributes = 12;
143
143
  temporal.api.common.v1.Header header = 13;
144
144
  }
145
+
@@ -31,6 +31,7 @@ option java_outer_classname = "RequestResponseProto";
31
31
  option ruby_package = "Temporal::Api::WorkflowService::V1";
32
32
  option csharp_namespace = "Temporal.Api.WorkflowService.V1";
33
33
 
34
+ import "temporal/api/enums/v1/batch_operation.proto";
34
35
  import "temporal/api/enums/v1/workflow.proto";
35
36
  import "temporal/api/enums/v1/namespace.proto";
36
37
  import "temporal/api/enums/v1/failed_cause.proto";
@@ -38,6 +39,7 @@ import "temporal/api/enums/v1/common.proto";
38
39
  import "temporal/api/enums/v1/query.proto";
39
40
  import "temporal/api/enums/v1/reset.proto";
40
41
  import "temporal/api/enums/v1/task_queue.proto";
42
+ import "temporal/api/enums/v1/update.proto";
41
43
  import "temporal/api/common/v1/message.proto";
42
44
  import "temporal/api/history/v1/message.proto";
43
45
  import "temporal/api/workflow/v1/message.proto";
@@ -49,7 +51,9 @@ import "temporal/api/query/v1/message.proto";
49
51
  import "temporal/api/replication/v1/message.proto";
50
52
  import "temporal/api/schedule/v1/message.proto";
51
53
  import "temporal/api/taskqueue/v1/message.proto";
54
+ import "temporal/api/update/v1/message.proto";
52
55
  import "temporal/api/version/v1/message.proto";
56
+ import "temporal/api/batch/v1/message.proto";
53
57
 
54
58
  import "google/protobuf/duration.proto";
55
59
  import "google/protobuf/timestamp.proto";
@@ -100,6 +104,9 @@ message DescribeNamespaceResponse {
100
104
  temporal.api.replication.v1.NamespaceReplicationConfig replication_config = 3;
101
105
  int64 failover_version = 4;
102
106
  bool is_global_namespace = 5;
107
+ // Contains the historical state of failover_versions for the cluster, truncated to contain only the last N
108
+ // states to ensure that the list does not grow unbounded.
109
+ repeated temporal.api.replication.v1.FailoverStatus failover_history = 6;
103
110
  }
104
111
 
105
112
  // (-- api-linter: core::0134::request-mask-required=disabled
@@ -212,7 +219,14 @@ message PollWorkflowTaskQueueRequest {
212
219
  // The identity of the worker/client who is polling this task queue
213
220
  string identity = 3;
214
221
  // Each worker process should provide an ID unique to the specific set of code it is running
222
+ // "checksum" in this field name isn't very accurate, it should be though of as an id.
215
223
  string binary_checksum = 4;
224
+ // If set, the worker is opting in to build-id based versioning and wishes to only
225
+ // receive tasks that are considered compatible with the version provided in the string.
226
+ // Doing so only makes sense in conjunction with the `UpdateWorkerBuildIdOrdering` API.
227
+ // When set, and `binary_checksum` is not, this value should also be considered as the
228
+ // `binary_checksum`.
229
+ string worker_versioning_build_id = 5;
216
230
  }
217
231
 
218
232
  message PollWorkflowTaskQueueResponse {
@@ -311,6 +325,10 @@ message PollActivityTaskQueueRequest {
311
325
  // The identity of the worker/client
312
326
  string identity = 3;
313
327
  temporal.api.taskqueue.v1.TaskQueueMetadata task_queue_metadata = 4;
328
+ // If set, the worker is opting in to build-id based versioning and wishes to only
329
+ // receive tasks that are considered compatible with the version provided in the string.
330
+ // Doing so only makes sense in conjunction with the `UpdateWorkerBuildIdOrdering` API.
331
+ string worker_versioning_build_id = 5;
314
332
  }
315
333
 
316
334
  message PollActivityTaskQueueResponse {
@@ -800,6 +818,9 @@ message GetSystemInfoResponse {
800
818
 
801
819
  // Supports scheduled workflow features.
802
820
  bool supports_schedules = 4;
821
+
822
+ // True if server uses protos that include temporal.api.failure.v1.Failure.encoded_attributes
823
+ bool encoded_failure_attributes = 5;
803
824
  }
804
825
  }
805
826
 
@@ -950,3 +971,154 @@ message ListSchedulesResponse {
950
971
  repeated temporal.api.schedule.v1.ScheduleListEntry schedules = 1;
951
972
  bytes next_page_token = 2;
952
973
  }
974
+
975
+ // (-- api-linter: core::0134::request-mask-required=disabled
976
+ // aip.dev/not-precedent: UpdateWorkerBuildIdOrderingRequest doesn't follow Google API format --)
977
+ // (-- api-linter: core::0134::request-resource-required=disabled
978
+ // aip.dev/not-precedent: UpdateWorkerBuildIdOrderingRequest RPC doesn't follow Google API format. --)
979
+ message UpdateWorkerBuildIdOrderingRequest {
980
+ string namespace = 1;
981
+ // Must be set, the task queue to apply changes to. Because all workers on
982
+ // a given task queue must have the same set of workflow & activity
983
+ // implementations, there is no reason to specify a task queue type here.
984
+ string task_queue = 2;
985
+ // The version id we are targeting.
986
+ temporal.api.taskqueue.v1.VersionId version_id = 3;
987
+ // When set, indicates that the `version_id` in this message is compatible
988
+ // with the one specified in this field. Because compatability should form
989
+ // a DAG, any build id can only be the "next compatible" version for one
990
+ // other ID of a certain type at a time, and any setting which would create a cycle is invalid.
991
+ temporal.api.taskqueue.v1.VersionId previous_compatible = 4;
992
+ // When set, establishes the specified `version_id` as the default of it's type
993
+ // for the queue. Workers matching it will begin processing new workflow executions.
994
+ // The existing default will be marked as a previous incompatible version
995
+ // to this one, assuming it is not also in `is_compatible_with`.
996
+ bool become_default = 5;
997
+ }
998
+ message UpdateWorkerBuildIdOrderingResponse {}
999
+
1000
+ // (-- api-linter: core::0134::request-resource-required=disabled
1001
+ // aip.dev/not-precedent: GetWorkerBuildIdOrderingRequest RPC doesn't follow Google API format. --)
1002
+ message GetWorkerBuildIdOrderingRequest {
1003
+ string namespace = 1;
1004
+ // Must be set, the task queue to interrogate about worker id ordering
1005
+ string task_queue = 2;
1006
+ // Limits how deep the returned DAG will go. 1 will return only the
1007
+ // default build id. A default/0 value will return the entire graph.
1008
+ int32 max_depth = 3;
1009
+ }
1010
+ message GetWorkerBuildIdOrderingResponse {
1011
+ // The currently established default version
1012
+ temporal.api.taskqueue.v1.VersionIdNode current_default = 1;
1013
+ // Other current latest-compatible versions who are not the overall default. These are the
1014
+ // versions that will be used when generating new tasks by following the graph from the
1015
+ // version of the last task out to a leaf.
1016
+ repeated temporal.api.taskqueue.v1.VersionIdNode compatible_leaves = 2;
1017
+ }
1018
+
1019
+ // (-- api-linter: core::0134=disabled
1020
+ // aip.dev/not-precedent: Update RPCs don't follow Google API format. --)
1021
+ message UpdateWorkflowRequest {
1022
+ // A unique ID for this logical request
1023
+ string request_id = 1;
1024
+
1025
+ // The manner in which the update result will be accessed.
1026
+ // This field requires a non-default value; the default value of the enum
1027
+ // will result in an error.
1028
+ temporal.api.enums.v1.WorkflowUpdateResultAccessStyle result_access_style = 2;
1029
+
1030
+ // The namespace name of the target workflow
1031
+ string namespace = 3;
1032
+ // The target workflow id and (optionally) a specific run thereof
1033
+ // (-- api-linter: core::0203::optional=disabled
1034
+ // aip.dev/not-precedent: false positive triggered by the word "optional" --)
1035
+ temporal.api.common.v1.WorkflowExecution workflow_execution = 4;
1036
+ // If set, this call will error if the most recent (if no run id is set on
1037
+ // `workflow_execution`), or specified (if it is) workflow execution is not
1038
+ // part of the same execution chain as this id.
1039
+ string first_execution_run_id = 5;
1040
+
1041
+ // The name under which the workflow update function is registered and the
1042
+ // arguments to pass to said function.
1043
+ temporal.api.update.v1.WorkflowUpdate update = 6;
1044
+ }
1045
+
1046
+ message UpdateWorkflowResponse {
1047
+ // An opaque token that can be used to retrieve the update result via
1048
+ // polling if it is not returned as part of the gRPC response
1049
+ bytes update_token = 1;
1050
+ // The success or failure status of the update
1051
+ oneof result {
1052
+ temporal.api.common.v1.Payloads success = 2;
1053
+ temporal.api.failure.v1.Failure failure = 3;
1054
+ }
1055
+ }
1056
+
1057
+ message StartBatchOperationRequest {
1058
+ // Namespace that contains the batch operation
1059
+ string namespace = 1;
1060
+ // Visibility query defines the the group of workflow to do batch operation
1061
+ string visibility_query = 2;
1062
+ // Operation input
1063
+ oneof operation {
1064
+ temporal.api.batch.v1.BatchOperationTermination termination_operation = 10;
1065
+ temporal.api.batch.v1.BatchOperationSignal signal_operation = 11;
1066
+ temporal.api.batch.v1.BatchOperationCancellation cancellation_operation = 12;
1067
+ }
1068
+ }
1069
+
1070
+ message StartBatchOperationResponse {
1071
+ // Batch job id
1072
+ string job_id = 1;
1073
+ }
1074
+
1075
+ message StopBatchOperationRequest {
1076
+ // Namespace that contains the batch operation
1077
+ string namespace = 1;
1078
+ // Batch job id
1079
+ string job_id = 2;
1080
+ }
1081
+
1082
+ message StopBatchOperationResponse {
1083
+ }
1084
+
1085
+ message DescribeBatchOperationRequest {
1086
+ // Namespace that contains the batch operation
1087
+ string namespace = 1;
1088
+ // Batch job id
1089
+ string job_id = 2;
1090
+ }
1091
+
1092
+ message DescribeBatchOperationResponse {
1093
+ // Batch operation type
1094
+ temporal.api.enums.v1.BatchOperationType operation_type = 1;
1095
+ // Batch job ID
1096
+ string job_id = 2;
1097
+ // Batch operation state
1098
+ temporal.api.enums.v1.BatchOperationState state = 3;
1099
+ // Batch operation start time
1100
+ google.protobuf.Timestamp start_time = 4 [(gogoproto.stdtime) = true];
1101
+ // Batch operation close time
1102
+ google.protobuf.Timestamp close_time = 5 [(gogoproto.stdtime) = true];
1103
+ // Total operation count
1104
+ int64 total_operation_count = 6;
1105
+ // Complete operation count
1106
+ int64 complete_operation_count = 7;
1107
+ // Failure operation count
1108
+ int64 failure_operation_count = 8;
1109
+ }
1110
+
1111
+ message ListBatchOperationsRequest {
1112
+ // Namespace that contains the batch operation
1113
+ string namespace = 1;
1114
+ // List page size
1115
+ int32 page_size = 2;
1116
+ // Next page token
1117
+ bytes next_page_token = 3;
1118
+ }
1119
+
1120
+ message ListBatchOperationsResponse {
1121
+ // BatchOperationInfo contains the basic info about batch operation
1122
+ repeated temporal.api.batch.v1.BatchOperationInfo operation_info = 1;
1123
+ bytes next_page_token = 2;
1124
+ }
@@ -368,4 +368,34 @@ service WorkflowService {
368
368
  // List all schedules in a namespace.
369
369
  rpc ListSchedules (ListSchedulesRequest) returns (ListSchedulesResponse) {
370
370
  }
371
+
372
+ // (-- api-linter: core::0134::response-message-name=disabled
373
+ // aip.dev/not-precedent: UpdateWorkerBuildIdOrdering RPC doesn't follow Google API format. --)
374
+ // (-- api-linter: core::0134::method-signature=disabled
375
+ // aip.dev/not-precedent: UpdateWorkerBuildIdOrdering RPC doesn't follow Google API format. --)
376
+ rpc UpdateWorkerBuildIdOrdering (UpdateWorkerBuildIdOrderingRequest) returns (UpdateWorkerBuildIdOrderingResponse) {}
377
+ // This could / maybe should just be part of `DescribeTaskQueue`, but is broken out here to show easily.
378
+ rpc GetWorkerBuildIdOrdering (GetWorkerBuildIdOrderingRequest) returns (GetWorkerBuildIdOrderingResponse) {}
379
+
380
+ // Invokes the specified update function on user workflow code.
381
+ // (-- api-linter: core::0134=disabled
382
+ // aip.dev/not-precedent: UpdateWorkflow doesn't follow Google API format --)
383
+ rpc UpdateWorkflow(UpdateWorkflowRequest) returns (UpdateWorkflowResponse) {
384
+ }
385
+
386
+ // StartBatchOperation starts a new batch operation
387
+ rpc StartBatchOperation(StartBatchOperationRequest) returns (StartBatchOperationResponse) {
388
+ }
389
+
390
+ // StopBatchOperation stops a batch operation
391
+ rpc StopBatchOperation(StopBatchOperationRequest) returns (StopBatchOperationResponse) {
392
+ }
393
+
394
+ // DescribeBatchOperation returns the information about a batch operation
395
+ rpc DescribeBatchOperation(DescribeBatchOperationRequest) returns (DescribeBatchOperationResponse) {
396
+ }
397
+
398
+ // ListBatchOperations returns a list of batch operations
399
+ rpc ListBatchOperations(ListBatchOperationsRequest) returns (ListBatchOperationsResponse) {
400
+ }
371
401
  }