@temporalio/core-bridge 0.17.2 → 0.18.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 (170) hide show
  1. package/Cargo.lock +339 -226
  2. package/Cargo.toml +7 -3
  3. package/common.js +50 -0
  4. package/index.d.ts +7 -0
  5. package/index.js +12 -0
  6. package/package.json +7 -4
  7. package/releases/aarch64-apple-darwin/index.node +0 -0
  8. package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
  9. package/{index.node → releases/index.node} +0 -0
  10. package/releases/x86_64-apple-darwin/index.node +0 -0
  11. package/releases/x86_64-pc-windows-msvc/index.node +0 -0
  12. package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
  13. package/scripts/build.js +10 -50
  14. package/sdk-core/.buildkite/docker/Dockerfile +1 -1
  15. package/sdk-core/.buildkite/docker/docker-compose.yaml +2 -2
  16. package/sdk-core/.buildkite/pipeline.yml +2 -0
  17. package/sdk-core/Cargo.toml +1 -88
  18. package/sdk-core/README.md +30 -6
  19. package/sdk-core/bridge-ffi/Cargo.toml +24 -0
  20. package/sdk-core/bridge-ffi/LICENSE.txt +23 -0
  21. package/sdk-core/bridge-ffi/build.rs +25 -0
  22. package/sdk-core/bridge-ffi/include/sdk-core-bridge.h +216 -0
  23. package/sdk-core/bridge-ffi/src/lib.rs +829 -0
  24. package/sdk-core/bridge-ffi/src/wrappers.rs +193 -0
  25. package/sdk-core/client/Cargo.toml +32 -0
  26. package/sdk-core/{src/pollers/gateway.rs → client/src/lib.rs} +101 -195
  27. package/sdk-core/client/src/metrics.rs +89 -0
  28. package/sdk-core/client/src/mocks.rs +167 -0
  29. package/sdk-core/{src/pollers → client/src}/retry.rs +172 -14
  30. package/sdk-core/core/Cargo.toml +96 -0
  31. package/sdk-core/{src → core/src}/core_tests/activity_tasks.rs +193 -37
  32. package/sdk-core/{src → core/src}/core_tests/child_workflows.rs +14 -14
  33. package/sdk-core/{src → core/src}/core_tests/determinism.rs +8 -8
  34. package/sdk-core/core/src/core_tests/local_activities.rs +328 -0
  35. package/sdk-core/{src → core/src}/core_tests/mod.rs +6 -9
  36. package/sdk-core/{src → core/src}/core_tests/queries.rs +45 -52
  37. package/sdk-core/{src → core/src}/core_tests/replay_flag.rs +8 -12
  38. package/sdk-core/{src → core/src}/core_tests/workers.rs +120 -33
  39. package/sdk-core/{src → core/src}/core_tests/workflow_cancels.rs +16 -26
  40. package/sdk-core/{src → core/src}/core_tests/workflow_tasks.rs +264 -286
  41. package/sdk-core/core/src/lib.rs +374 -0
  42. package/sdk-core/{src → core/src}/log_export.rs +3 -27
  43. package/sdk-core/core/src/pending_activations.rs +162 -0
  44. package/sdk-core/{src → core/src}/pollers/mod.rs +4 -22
  45. package/sdk-core/{src → core/src}/pollers/poll_buffer.rs +1 -1
  46. package/sdk-core/core/src/protosext/mod.rs +396 -0
  47. package/sdk-core/core/src/replay/mod.rs +210 -0
  48. package/sdk-core/core/src/retry_logic.rs +144 -0
  49. package/sdk-core/{src → core/src}/telemetry/metrics.rs +3 -58
  50. package/sdk-core/{src → core/src}/telemetry/mod.rs +8 -8
  51. package/sdk-core/{src → core/src}/telemetry/prometheus_server.rs +0 -0
  52. package/sdk-core/{src → core/src}/test_help/mod.rs +34 -73
  53. package/sdk-core/{src → core/src}/worker/activities/activity_heartbeat_manager.rs +95 -42
  54. package/sdk-core/core/src/worker/activities/local_activities.rs +973 -0
  55. package/sdk-core/{src → core/src}/worker/activities.rs +52 -33
  56. package/sdk-core/{src → core/src}/worker/dispatcher.rs +8 -6
  57. package/sdk-core/{src → core/src}/worker/mod.rs +305 -195
  58. package/sdk-core/core/src/worker/wft_delivery.rs +81 -0
  59. package/sdk-core/{src → core/src}/workflow/bridge.rs +5 -2
  60. package/sdk-core/{src → core/src}/workflow/driven_workflow.rs +17 -7
  61. package/sdk-core/{src → core/src}/workflow/history_update.rs +33 -7
  62. package/sdk-core/{src → core/src/workflow}/machines/activity_state_machine.rs +26 -26
  63. package/sdk-core/{src → core/src/workflow}/machines/cancel_external_state_machine.rs +8 -11
  64. package/sdk-core/{src → core/src/workflow}/machines/cancel_workflow_state_machine.rs +19 -21
  65. package/sdk-core/{src → core/src/workflow}/machines/child_workflow_state_machine.rs +19 -21
  66. package/sdk-core/{src → core/src/workflow}/machines/complete_workflow_state_machine.rs +3 -5
  67. package/sdk-core/{src → core/src/workflow}/machines/continue_as_new_workflow_state_machine.rs +18 -18
  68. package/sdk-core/{src → core/src/workflow}/machines/fail_workflow_state_machine.rs +5 -6
  69. package/sdk-core/core/src/workflow/machines/local_activity_state_machine.rs +1451 -0
  70. package/sdk-core/{src → core/src/workflow}/machines/mod.rs +54 -107
  71. package/sdk-core/{src → core/src/workflow}/machines/mutable_side_effect_state_machine.rs +0 -0
  72. package/sdk-core/{src → core/src/workflow}/machines/patch_state_machine.rs +29 -30
  73. package/sdk-core/{src → core/src/workflow}/machines/side_effect_state_machine.rs +0 -0
  74. package/sdk-core/{src → core/src/workflow}/machines/signal_external_state_machine.rs +17 -19
  75. package/sdk-core/{src → core/src/workflow}/machines/timer_state_machine.rs +20 -21
  76. package/sdk-core/{src → core/src/workflow}/machines/transition_coverage.rs +5 -2
  77. package/sdk-core/{src → core/src/workflow}/machines/upsert_search_attributes_state_machine.rs +0 -0
  78. package/sdk-core/core/src/workflow/machines/workflow_machines/local_acts.rs +96 -0
  79. package/sdk-core/{src → core/src/workflow}/machines/workflow_machines.rs +344 -160
  80. package/sdk-core/{src → core/src/workflow}/machines/workflow_task_state_machine.rs +1 -1
  81. package/sdk-core/{src → core/src}/workflow/mod.rs +200 -39
  82. package/sdk-core/{src → core/src}/workflow/workflow_tasks/cache_manager.rs +0 -0
  83. package/sdk-core/{src → core/src}/workflow/workflow_tasks/concurrency_manager.rs +38 -5
  84. package/sdk-core/{src → core/src}/workflow/workflow_tasks/mod.rs +297 -81
  85. package/sdk-core/{test_utils → core-api}/Cargo.toml +10 -7
  86. package/sdk-core/{src → core-api/src}/errors.rs +42 -90
  87. package/sdk-core/core-api/src/lib.rs +158 -0
  88. package/sdk-core/{src/worker/config.rs → core-api/src/worker.rs} +18 -23
  89. package/sdk-core/etc/deps.svg +156 -0
  90. package/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +5 -5
  91. package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +3 -5
  92. package/sdk-core/fsm/rustfsm_trait/src/lib.rs +7 -1
  93. package/sdk-core/histories/fail_wf_task.bin +0 -0
  94. package/sdk-core/histories/timer_workflow_history.bin +0 -0
  95. package/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +44 -13
  96. package/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +19 -1
  97. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/common.proto +1 -1
  98. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +9 -0
  99. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/namespace.proto +1 -0
  100. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/reset.proto +1 -0
  101. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +13 -0
  102. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/workflow.proto +14 -7
  103. package/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +176 -18
  104. package/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +6 -0
  105. package/sdk-core/protos/api_upstream/temporal/api/query/v1/message.proto +11 -0
  106. package/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +3 -0
  107. package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +156 -7
  108. package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +135 -104
  109. package/sdk-core/protos/local/temporal/sdk/core/activity_result/activity_result.proto +78 -0
  110. package/sdk-core/protos/local/temporal/sdk/core/activity_task/activity_task.proto +78 -0
  111. package/sdk-core/protos/local/temporal/sdk/core/bridge/bridge.proto +205 -0
  112. package/sdk-core/protos/local/temporal/sdk/core/bridge/service.proto +61 -0
  113. package/sdk-core/protos/local/{child_workflow.proto → temporal/sdk/core/child_workflow/child_workflow.proto} +1 -1
  114. package/sdk-core/protos/local/{common.proto → temporal/sdk/core/common/common.proto} +5 -3
  115. package/sdk-core/protos/local/{core_interface.proto → temporal/sdk/core/core_interface.proto} +10 -10
  116. package/sdk-core/protos/local/temporal/sdk/core/external_data/external_data.proto +30 -0
  117. package/sdk-core/protos/local/{workflow_activation.proto → temporal/sdk/core/workflow_activation/workflow_activation.proto} +35 -11
  118. package/sdk-core/protos/local/{workflow_commands.proto → temporal/sdk/core/workflow_commands/workflow_commands.proto} +55 -4
  119. package/sdk-core/protos/local/{workflow_completion.proto → temporal/sdk/core/workflow_completion/workflow_completion.proto} +3 -3
  120. package/sdk-core/sdk/Cargo.toml +32 -0
  121. package/sdk-core/{src/prototype_rust_sdk → sdk/src}/conversions.rs +0 -0
  122. package/sdk-core/sdk/src/lib.rs +699 -0
  123. package/sdk-core/sdk/src/payload_converter.rs +11 -0
  124. package/sdk-core/sdk/src/workflow_context/options.rs +180 -0
  125. package/sdk-core/{src/prototype_rust_sdk → sdk/src}/workflow_context.rs +201 -124
  126. package/sdk-core/{src/prototype_rust_sdk → sdk/src}/workflow_future.rs +63 -30
  127. package/sdk-core/sdk-core-protos/Cargo.toml +10 -0
  128. package/sdk-core/sdk-core-protos/build.rs +28 -6
  129. package/sdk-core/sdk-core-protos/src/constants.rs +7 -0
  130. package/sdk-core/{src/test_help → sdk-core-protos/src}/history_builder.rs +134 -49
  131. package/sdk-core/sdk-core-protos/src/history_info.rs +216 -0
  132. package/sdk-core/sdk-core-protos/src/lib.rs +594 -168
  133. package/sdk-core/sdk-core-protos/src/task_token.rs +38 -0
  134. package/sdk-core/sdk-core-protos/src/utilities.rs +14 -0
  135. package/sdk-core/test-utils/Cargo.toml +32 -0
  136. package/sdk-core/{src/test_help → test-utils/src}/canned_histories.rs +59 -78
  137. package/sdk-core/test-utils/src/histfetch.rs +28 -0
  138. package/sdk-core/{test_utils → test-utils}/src/lib.rs +131 -68
  139. package/sdk-core/tests/integ_tests/client_tests.rs +1 -1
  140. package/sdk-core/tests/integ_tests/heartbeat_tests.rs +11 -7
  141. package/sdk-core/tests/integ_tests/polling_tests.rs +12 -11
  142. package/sdk-core/tests/integ_tests/queries_tests.rs +82 -78
  143. package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +91 -71
  144. package/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +3 -4
  145. package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +2 -4
  146. package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +4 -6
  147. package/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +4 -6
  148. package/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +3 -4
  149. package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +496 -0
  150. package/sdk-core/tests/integ_tests/workflow_tests/patches.rs +5 -8
  151. package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +125 -0
  152. package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +7 -13
  153. package/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +33 -5
  154. package/sdk-core/tests/integ_tests/workflow_tests/timers.rs +12 -16
  155. package/sdk-core/tests/integ_tests/workflow_tests.rs +85 -82
  156. package/sdk-core/tests/load_tests.rs +6 -6
  157. package/sdk-core/tests/main.rs +2 -2
  158. package/src/conversions.rs +24 -21
  159. package/src/errors.rs +8 -0
  160. package/src/lib.rs +323 -211
  161. package/sdk-core/protos/local/activity_result.proto +0 -46
  162. package/sdk-core/protos/local/activity_task.proto +0 -66
  163. package/sdk-core/src/core_tests/retry.rs +0 -147
  164. package/sdk-core/src/lib.rs +0 -403
  165. package/sdk-core/src/machines/local_activity_state_machine.rs +0 -117
  166. package/sdk-core/src/pending_activations.rs +0 -249
  167. package/sdk-core/src/protosext/mod.rs +0 -160
  168. package/sdk-core/src/prototype_rust_sdk.rs +0 -412
  169. package/sdk-core/src/task_token.rs +0 -20
  170. package/sdk-core/src/test_help/history_info.rs +0 -158
@@ -68,7 +68,7 @@ pub trait StateMachine: Sized {
68
68
  fn shared_state(&self) -> &Self::SharedState;
69
69
 
70
70
  /// Returns true if the machine's current state is a final one
71
- fn on_final_state(&self) -> bool;
71
+ fn has_reached_final_state(&self) -> bool;
72
72
 
73
73
  /// Given the shared data and new state, create a new instance.
74
74
  fn from_parts(shared: Self::SharedState, state: Self::State) -> Self;
@@ -86,6 +86,12 @@ pub enum MachineError<E: Error> {
86
86
  Underlying(E),
87
87
  }
88
88
 
89
+ impl<E: Error> From<E> for MachineError<E> {
90
+ fn from(e: E) -> Self {
91
+ Self::Underlying(e)
92
+ }
93
+ }
94
+
89
95
  impl<E: Error> Display for MachineError<E> {
90
96
  fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
91
97
  match self {
@@ -48,37 +48,46 @@ message ScheduleActivityTaskCommandAttributes {
48
48
  temporal.api.taskqueue.v1.TaskQueue task_queue = 4;
49
49
  temporal.api.common.v1.Header header = 5;
50
50
  temporal.api.common.v1.Payloads input = 6;
51
+ // Indicates how long the caller is willing to wait for activity completion. Limits how long
52
+ // retries will be attempted. Either this or `start_to_close_timeout` must be specified. When
53
+ // not specified, defaults to the workflow execution timeout.
54
+ //
51
55
  // (-- api-linter: core::0140::prepositions=disabled
52
56
  // aip.dev/not-precedent: "to" is used to indicate interval. --)
53
- // Indicates how long the caller is willing to wait for an activity completion.
54
- // Limits for how long retries are happening. Either this or start_to_close_timeout_seconds must be specified.
55
- // When not specified defaults to the workflow execution timeout.
56
57
  google.protobuf.Duration schedule_to_close_timeout = 7 [(gogoproto.stdduration) = true];
58
+ // Limits the time an activity task can stay in a task queue before a worker picks it up. This
59
+ // timeout is always non retryable, as all a retry would achieve is to put it back into the same
60
+ // queue. Defaults to `schedule_to_close_timeout` or workflow execution timeout if that is not
61
+ // specified.
62
+ //
57
63
  // (-- api-linter: core::0140::prepositions=disabled
58
64
  // aip.dev/not-precedent: "to" is used to indicate interval. --)
59
- // Limits time an activity task can stay in a task queue before a worker picks it up.
60
- // This timeout is always non retryable as all a retry would achieve is to put it back into the same queue.
61
- // Defaults to schedule_to_close_timeout_seconds or workflow execution timeout if not specified.
62
65
  google.protobuf.Duration schedule_to_start_timeout = 8 [(gogoproto.stdduration) = true];
66
+ // Maximum time an activity is allowed to execute after being picked up by a worker. This
67
+ // timeout is always retryable. Either this or `schedule_to_close_timeout` must be specified.
68
+ //
63
69
  // (-- api-linter: core::0140::prepositions=disabled
64
70
  // aip.dev/not-precedent: "to" is used to indicate interval. --)
65
- // Maximum time an activity is allowed to execute after a pick up by a worker.
66
- // This timeout is always retryable. Either this or schedule_to_close_timeout_seconds must be specified.
67
71
  google.protobuf.Duration start_to_close_timeout = 9 [(gogoproto.stdduration) = true];
68
- // Maximum time between successful worker heartbeats.
72
+ // Maximum permitted time between successful worker heartbeats.
69
73
  google.protobuf.Duration heartbeat_timeout = 10 [(gogoproto.stdduration) = true];
70
- // Activities are provided by a default retry policy controlled through the service dynamic configuration.
71
- // Retries are happening up to schedule_to_close_timeout.
72
- // To disable retries set retry_policy.maximum_attempts to 1.
74
+ // Activities are provided by a default retry policy which is controlled through the service's
75
+ // dynamic configuration. Retries will be attempted until `schedule_to_close_timeout` has
76
+ // elapsed. To disable retries set retry_policy.maximum_attempts to 1.
73
77
  temporal.api.common.v1.RetryPolicy retry_policy = 11;
74
78
  }
75
79
 
76
80
  message RequestCancelActivityTaskCommandAttributes {
81
+ // The `ACTIVITY_TASK_SCHEDULED` event id for the activity being cancelled.
77
82
  int64 scheduled_event_id = 1;
78
83
  }
79
84
 
80
85
  message StartTimerCommandAttributes {
86
+ // An id for the timer, currently live timers must have different ids. Typically autogenerated
87
+ // by the SDK.
81
88
  string timer_id = 1;
89
+ // How long until the timer fires, producing a `TIMER_FIRED` event.
90
+ //
82
91
  // (-- api-linter: core::0140::prepositions=disabled
83
92
  // aip.dev/not-precedent: "to" is used to indicate interval. --)
84
93
  google.protobuf.Duration start_to_fire_timeout = 2 [(gogoproto.stdduration) = true];
@@ -93,6 +102,7 @@ message FailWorkflowExecutionCommandAttributes {
93
102
  }
94
103
 
95
104
  message CancelTimerCommandAttributes {
105
+ // The same timer id from the start timer command
96
106
  string timer_id = 1;
97
107
  }
98
108
 
@@ -104,17 +114,30 @@ message RequestCancelExternalWorkflowExecutionCommandAttributes {
104
114
  string namespace = 1;
105
115
  string workflow_id = 2;
106
116
  string run_id = 3;
117
+ // Deprecated.
107
118
  string control = 4;
119
+ // Set this to true if the workflow being cancelled is a child of the workflow originating this
120
+ // command. The request will be rejected if it is set to true and the target workflow is *not*
121
+ // a child of the requesting workflow.
108
122
  bool child_workflow_only = 5;
109
123
  }
110
124
 
111
125
  message SignalExternalWorkflowExecutionCommandAttributes {
112
126
  string namespace = 1;
113
127
  temporal.api.common.v1.WorkflowExecution execution = 2;
128
+ // The workflow author-defined name of the signal to send to the workflow.
114
129
  string signal_name = 3;
130
+ // Serialized value(s) to provide with the signal.
115
131
  temporal.api.common.v1.Payloads input = 4;
132
+ // Deprecated
116
133
  string control = 5;
134
+ // Set this to true if the workflow being cancelled is a child of the workflow originating this
135
+ // command. The request will be rejected if it is set to true and the target workflow is *not*
136
+ // a child of the requesting workflow.
117
137
  bool child_workflow_only = 6;
138
+ // Headers that are passed by the workflow that is sending a signal to the external
139
+ // workflow that is receiving this signal.
140
+ temporal.api.common.v1.Header header = 7;
118
141
  }
119
142
 
120
143
  message UpsertWorkflowSearchAttributesCommandAttributes {
@@ -132,20 +155,27 @@ message ContinueAsNewWorkflowExecutionCommandAttributes {
132
155
  temporal.api.common.v1.WorkflowType workflow_type = 1;
133
156
  temporal.api.taskqueue.v1.TaskQueue task_queue = 2;
134
157
  temporal.api.common.v1.Payloads input = 3;
135
- // workflow_execution_timeout is omitted as it shouldn'be overridden from within a workflow.
158
+
136
159
  // Timeout of a single workflow run.
137
160
  google.protobuf.Duration workflow_run_timeout = 4 [(gogoproto.stdduration) = true];
138
161
  // Timeout of a single workflow task.
139
162
  google.protobuf.Duration workflow_task_timeout = 5 [(gogoproto.stdduration) = true];
163
+ // How long the workflow start will be delayed - not really a "backoff" in the traditional sense.
140
164
  google.protobuf.Duration backoff_start_interval = 6 [(gogoproto.stdduration) = true];
141
165
  temporal.api.common.v1.RetryPolicy retry_policy = 7;
166
+ // Should be removed
142
167
  temporal.api.enums.v1.ContinueAsNewInitiator initiator = 8;
168
+ // Should be removed
143
169
  temporal.api.failure.v1.Failure failure = 9;
170
+ // Should be removed
144
171
  temporal.api.common.v1.Payloads last_completion_result = 10;
172
+ // Should be removed. Not necessarily unused but unclear and not exposed by SDKs.
145
173
  string cron_schedule = 11;
146
174
  temporal.api.common.v1.Header header = 12;
147
175
  temporal.api.common.v1.Memo memo = 13;
148
176
  temporal.api.common.v1.SearchAttributes search_attributes = 14;
177
+
178
+ // `workflow_execution_timeout` is omitted as it shouldn't be overridden from within a workflow.
149
179
  }
150
180
 
151
181
  message StartChildWorkflowExecutionCommandAttributes {
@@ -166,6 +196,7 @@ message StartChildWorkflowExecutionCommandAttributes {
166
196
  // Default: WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE.
167
197
  temporal.api.enums.v1.WorkflowIdReusePolicy workflow_id_reuse_policy = 11;
168
198
  temporal.api.common.v1.RetryPolicy retry_policy = 12;
199
+ // Establish a cron schedule for the child workflow.
169
200
  string cron_schedule = 13;
170
201
  temporal.api.common.v1.Header header = 14;
171
202
  temporal.api.common.v1.Memo memo = 15;
@@ -42,40 +42,57 @@ message DataBlob {
42
42
  bytes data = 2;
43
43
  }
44
44
 
45
+ // See `Payload`
45
46
  message Payloads {
46
47
  repeated Payload payloads = 1;
47
48
  }
48
49
 
50
+ // Represents some binary (byte array) data (ex: activity input parameters or workflow result) with
51
+ // metadata which describes this binary data (format, encoding, encryption, etc). Serialization
52
+ // of the data may be user-defined.
49
53
  message Payload {
50
54
  map<string,bytes> metadata = 1;
51
55
  bytes data = 2;
52
56
  }
53
57
 
58
+ // A user-defined set of *indexed* fields that are used/exposed when listing/searching workflows.
59
+ // The payload is not serialized in a user-defined way.
54
60
  message SearchAttributes {
55
61
  map<string, Payload> indexed_fields = 1;
56
62
  }
57
63
 
64
+ // A user-defined set of *unindexed* fields that are exposed when listing/searching workflows
58
65
  message Memo {
59
66
  map<string, Payload> fields = 1;
60
67
  }
61
68
 
69
+ // Contains metadata that can be attached to a variety of requests, like starting a workflow, and
70
+ // can be propagated between, for example, workflows and activities.
62
71
  message Header {
63
72
  map<string, Payload> fields = 1;
64
73
  }
65
74
 
75
+ // Identifies a specific workflow within a namespace. Practically speaking, because run_id is a
76
+ // uuid, a workflow execution is globally unique. Note that many commands allow specifying an empty
77
+ // run id as a way of saying "target the latest run of the workflow".
66
78
  message WorkflowExecution {
67
79
  string workflow_id = 1;
68
80
  string run_id = 2;
69
81
  }
70
82
 
83
+ // Represents the identifier used by a workflow author to define the workflow. Typically, the
84
+ // name of a function. This is sometimes referred to as the workflow's "name"
71
85
  message WorkflowType {
72
86
  string name = 1;
73
87
  }
74
88
 
89
+ // Represents the identifier used by a activity author to define the activity. Typically, the
90
+ // name of a function. This is sometimes referred to as the activity's "name"
75
91
  message ActivityType {
76
92
  string name = 1;
77
93
  }
78
94
 
95
+ // How retries ought to be handled, usable by both workflows and activities
79
96
  message RetryPolicy {
80
97
  // Interval of the first retry. If retryBackoffCoefficient is 1.0 then it is used for all retries.
81
98
  google.protobuf.Duration initial_interval = 1 [(gogoproto.stdduration) = true];
@@ -89,6 +106,7 @@ message RetryPolicy {
89
106
  // Maximum number of attempts. When exceeded the retries stop even if not expired yet.
90
107
  // 1 disables retries. 0 means unlimited (up to the timeouts)
91
108
  int32 maximum_attempts = 4;
92
- // Non-Retryable errors types. Will stop retrying if error type matches this list.
109
+ // Non-Retryable errors types. Will stop retrying if the error type matches this list. Note that
110
+ // this is not a substring match, the error *type* (not message) must match exactly.
93
111
  repeated string non_retryable_error_types = 5;
94
112
  }
@@ -39,7 +39,7 @@ enum EncodingType {
39
39
 
40
40
  enum IndexedValueType {
41
41
  INDEXED_VALUE_TYPE_UNSPECIFIED = 0;
42
- INDEXED_VALUE_TYPE_STRING = 1;
42
+ INDEXED_VALUE_TYPE_TEXT = 1;
43
43
  INDEXED_VALUE_TYPE_KEYWORD = 2;
44
44
  INDEXED_VALUE_TYPE_INT = 3;
45
45
  INDEXED_VALUE_TYPE_DOUBLE = 4;
@@ -31,8 +31,13 @@ option java_outer_classname = "FailedCauseProto";
31
31
  option ruby_package = "Temporal::Api::Enums::V1";
32
32
  option csharp_namespace = "Temporal.Api.Enums.V1";
33
33
 
34
+ // Workflow tasks can fail for various reasons. Note that some of these reasons can only originate
35
+ // from the server, and some of them can only originate from the SDK/worker.
34
36
  enum WorkflowTaskFailedCause {
35
37
  WORKFLOW_TASK_FAILED_CAUSE_UNSPECIFIED = 0;
38
+ // Between starting and completing the workflow task (with a workflow completion command), some
39
+ // new command (like a signal) was processed into workflow history. The outstanding task will be
40
+ // failed with this reason, and a worker must pick up a new task.
36
41
  WORKFLOW_TASK_FAILED_CAUSE_UNHANDLED_COMMAND = 1;
37
42
  WORKFLOW_TASK_FAILED_CAUSE_BAD_SCHEDULE_ACTIVITY_ATTRIBUTES = 2;
38
43
  WORKFLOW_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES = 3;
@@ -45,6 +50,8 @@ enum WorkflowTaskFailedCause {
45
50
  WORKFLOW_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES = 10;
46
51
  WORKFLOW_TASK_FAILED_CAUSE_BAD_CONTINUE_AS_NEW_ATTRIBUTES = 11;
47
52
  WORKFLOW_TASK_FAILED_CAUSE_START_TIMER_DUPLICATE_ID = 12;
53
+ // The worker wishes to fail the task and have the next one be generated on a normal, not sticky
54
+ // queue. Generally workers should prefer to use the explicit `ResetStickyTaskQueue` RPC call.
48
55
  WORKFLOW_TASK_FAILED_CAUSE_RESET_STICKY_TASK_QUEUE = 13;
49
56
  WORKFLOW_TASK_FAILED_CAUSE_WORKFLOW_WORKER_UNHANDLED_FAILURE = 14;
50
57
  WORKFLOW_TASK_FAILED_CAUSE_BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES = 15;
@@ -56,6 +63,8 @@ enum WorkflowTaskFailedCause {
56
63
  WORKFLOW_TASK_FAILED_CAUSE_BAD_BINARY = 21;
57
64
  WORKFLOW_TASK_FAILED_CAUSE_SCHEDULE_ACTIVITY_DUPLICATE_ID = 22;
58
65
  WORKFLOW_TASK_FAILED_CAUSE_BAD_SEARCH_ATTRIBUTES = 23;
66
+ // The worker encountered a mismatch while replaying history between what was expected, and
67
+ // what the workflow code actually did.
59
68
  WORKFLOW_TASK_FAILED_CAUSE_NON_DETERMINISTIC_ERROR = 24;
60
69
  }
61
70
 
@@ -36,6 +36,7 @@ enum NamespaceState {
36
36
  NAMESPACE_STATE_REGISTERED = 1;
37
37
  NAMESPACE_STATE_DEPRECATED = 2;
38
38
  NAMESPACE_STATE_DELETED = 3;
39
+ NAMESPACE_STATE_HANDOVER = 4;
39
40
  }
40
41
 
41
42
  enum ArchivalState {
@@ -31,6 +31,7 @@ option java_outer_classname = "ResetProto";
31
31
  option ruby_package = "Temporal::Api::Enums::V1";
32
32
  option csharp_namespace = "Temporal.Api.Enums.V1";
33
33
 
34
+ // TODO: What is this?
34
35
  enum ResetReapplyType {
35
36
  RESET_REAPPLY_TYPE_UNSPECIFIED = 0;
36
37
  RESET_REAPPLY_TYPE_SIGNAL = 1;
@@ -33,7 +33,20 @@ option csharp_namespace = "Temporal.Api.Enums.V1";
33
33
 
34
34
  enum TaskQueueKind {
35
35
  TASK_QUEUE_KIND_UNSPECIFIED = 0;
36
+ // Tasks from a normal workflow task queue always include complete workflow history
37
+ //
38
+ // The task queue specified by the user is always a normal task queue. There can be as many
39
+ // workers as desired for a single normal task queue. All those workers may pick up tasks from
40
+ // that queue.
36
41
  TASK_QUEUE_KIND_NORMAL = 1;
42
+ // A sticky queue only includes new history since the last workflow task, and they are
43
+ // per-worker.
44
+ //
45
+ // Sticky queues are created dynamically by each worker during their start up. They only exist
46
+ // for the lifetime of the worker process. Tasks in a sticky task queue are only available to
47
+ // the worker that created the sticky queue.
48
+ //
49
+ // Sticky queues are only for workflow tasks. There are no sticky task queues for activities.
37
50
  TASK_QUEUE_KIND_STICKY = 2;
38
51
  }
39
52
 
@@ -31,31 +31,38 @@ option java_outer_classname = "WorkflowProto";
31
31
  option ruby_package = "Temporal::Api::Enums::V1";
32
32
  option csharp_namespace = "Temporal.Api.Enums.V1";
33
33
 
34
+ // Defines how new runs of a workflow with a particular ID may or may not be allowed. Note that
35
+ // it is *never* valid to have two actively running instances of the same workflow id.
34
36
  enum WorkflowIdReusePolicy {
35
37
  WORKFLOW_ID_REUSE_POLICY_UNSPECIFIED = 0;
36
- // Allow start a workflow execution using the same workflow Id, when workflow not running.
38
+ // Allow starting a workflow execution using the same workflow id.
37
39
  WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE = 1;
38
- // Allow start a workflow execution using the same workflow Id, when workflow not running, and the last execution close state is in
39
- // [terminated, cancelled, timed out, failed].
40
+ // Allow starting a workflow execution using the same workflow id, only when the last
41
+ // execution's final state is one of [terminated, cancelled, timed out, failed].
40
42
  WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY = 2;
41
- // Do not allow start a workflow execution using the same workflow Id at all.
43
+ // Do not permit re-use of the workflow id for this workflow. Future start workflow requests
44
+ // could potentially change the policy, allowing re-use of the workflow id.
42
45
  WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE = 3;
43
46
  }
44
47
 
48
+ // Defines how child workflows will react to their parent completing
45
49
  enum ParentClosePolicy {
46
50
  PARENT_CLOSE_POLICY_UNSPECIFIED = 0;
47
- // Terminate means terminating the child workflow.
51
+ // The child workflow will also terminate
48
52
  PARENT_CLOSE_POLICY_TERMINATE = 1;
49
- // Abandon means not doing anything on the child workflow.
53
+ // The child workflow will do nothing
50
54
  PARENT_CLOSE_POLICY_ABANDON = 2;
51
- // Cancel means requesting cancellation on the child workflow.
55
+ // Cancellation will be requested of the child workflow
52
56
  PARENT_CLOSE_POLICY_REQUEST_CANCEL = 3;
53
57
  }
54
58
 
55
59
  enum ContinueAsNewInitiator {
56
60
  CONTINUE_AS_NEW_INITIATOR_UNSPECIFIED = 0;
61
+ // The workflow itself requested to continue as new
57
62
  CONTINUE_AS_NEW_INITIATOR_WORKFLOW = 1;
63
+ // The workflow continued as new because it is retrying
58
64
  CONTINUE_AS_NEW_INITIATOR_RETRY = 2;
65
+ // The workflow continued as new because cron has triggered a new execution
59
66
  CONTINUE_AS_NEW_INITIATOR_CRON_SCHEDULE = 3;
60
67
  }
61
68