temporalio 0.0.2 → 0.1.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 (202) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +25 -23
  3. data/bridge/Cargo.lock +168 -59
  4. data/bridge/Cargo.toml +4 -2
  5. data/bridge/sdk-core/README.md +19 -6
  6. data/bridge/sdk-core/client/src/lib.rs +215 -39
  7. data/bridge/sdk-core/client/src/metrics.rs +17 -8
  8. data/bridge/sdk-core/client/src/raw.rs +4 -4
  9. data/bridge/sdk-core/client/src/retry.rs +32 -20
  10. data/bridge/sdk-core/core/Cargo.toml +22 -9
  11. data/bridge/sdk-core/core/src/abstractions.rs +203 -14
  12. data/bridge/sdk-core/core/src/core_tests/activity_tasks.rs +76 -41
  13. data/bridge/sdk-core/core/src/core_tests/determinism.rs +165 -2
  14. data/bridge/sdk-core/core/src/core_tests/local_activities.rs +204 -83
  15. data/bridge/sdk-core/core/src/core_tests/queries.rs +3 -4
  16. data/bridge/sdk-core/core/src/core_tests/workers.rs +1 -3
  17. data/bridge/sdk-core/core/src/core_tests/workflow_tasks.rs +397 -54
  18. data/bridge/sdk-core/core/src/ephemeral_server/mod.rs +106 -12
  19. data/bridge/sdk-core/core/src/internal_flags.rs +136 -0
  20. data/bridge/sdk-core/core/src/lib.rs +16 -9
  21. data/bridge/sdk-core/core/src/telemetry/log_export.rs +1 -1
  22. data/bridge/sdk-core/core/src/telemetry/metrics.rs +69 -35
  23. data/bridge/sdk-core/core/src/telemetry/mod.rs +29 -13
  24. data/bridge/sdk-core/core/src/telemetry/prometheus_server.rs +17 -12
  25. data/bridge/sdk-core/core/src/test_help/mod.rs +62 -12
  26. data/bridge/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +112 -156
  27. data/bridge/sdk-core/core/src/worker/activities/activity_task_poller_stream.rs +89 -0
  28. data/bridge/sdk-core/core/src/worker/activities/local_activities.rs +352 -122
  29. data/bridge/sdk-core/core/src/worker/activities.rs +233 -157
  30. data/bridge/sdk-core/core/src/worker/client/mocks.rs +22 -2
  31. data/bridge/sdk-core/core/src/worker/client.rs +18 -2
  32. data/bridge/sdk-core/core/src/worker/mod.rs +165 -58
  33. data/bridge/sdk-core/core/src/worker/workflow/bridge.rs +1 -3
  34. data/bridge/sdk-core/core/src/worker/workflow/driven_workflow.rs +3 -5
  35. data/bridge/sdk-core/core/src/worker/workflow/history_update.rs +856 -277
  36. data/bridge/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +100 -43
  37. data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +7 -7
  38. data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +5 -4
  39. data/bridge/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +87 -27
  40. data/bridge/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +5 -4
  41. data/bridge/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +5 -4
  42. data/bridge/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +5 -4
  43. data/bridge/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +137 -62
  44. data/bridge/sdk-core/core/src/worker/workflow/machines/mod.rs +25 -17
  45. data/bridge/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +7 -6
  46. data/bridge/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +103 -152
  47. data/bridge/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +7 -7
  48. data/bridge/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +9 -9
  49. data/bridge/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +2 -2
  50. data/bridge/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +14 -7
  51. data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines/local_acts.rs +5 -16
  52. data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +201 -121
  53. data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +11 -14
  54. data/bridge/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +30 -15
  55. data/bridge/sdk-core/core/src/worker/workflow/managed_run.rs +1026 -376
  56. data/bridge/sdk-core/core/src/worker/workflow/mod.rs +460 -384
  57. data/bridge/sdk-core/core/src/worker/workflow/run_cache.rs +40 -57
  58. data/bridge/sdk-core/core/src/worker/workflow/wft_extraction.rs +125 -0
  59. data/bridge/sdk-core/core/src/worker/workflow/wft_poller.rs +1 -4
  60. data/bridge/sdk-core/core/src/worker/workflow/workflow_stream/saved_wf_inputs.rs +117 -0
  61. data/bridge/sdk-core/core/src/worker/workflow/workflow_stream/tonic_status_serde.rs +24 -0
  62. data/bridge/sdk-core/core/src/worker/workflow/workflow_stream.rs +448 -718
  63. data/bridge/sdk-core/core-api/Cargo.toml +2 -1
  64. data/bridge/sdk-core/core-api/src/errors.rs +1 -34
  65. data/bridge/sdk-core/core-api/src/lib.rs +6 -2
  66. data/bridge/sdk-core/core-api/src/telemetry.rs +0 -6
  67. data/bridge/sdk-core/core-api/src/worker.rs +14 -1
  68. data/bridge/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +18 -15
  69. data/bridge/sdk-core/fsm/rustfsm_trait/src/lib.rs +8 -3
  70. data/bridge/sdk-core/histories/evict_while_la_running_no_interference-16_history.bin +0 -0
  71. data/bridge/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +5 -17
  72. data/bridge/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +11 -0
  73. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/command_type.proto +1 -6
  74. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/event_type.proto +6 -6
  75. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +5 -0
  76. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/update.proto +22 -6
  77. data/bridge/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +48 -19
  78. data/bridge/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +2 -0
  79. data/bridge/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +3 -0
  80. data/bridge/sdk-core/protos/api_upstream/temporal/api/{enums/v1/interaction_type.proto → protocol/v1/message.proto} +29 -11
  81. data/bridge/sdk-core/protos/api_upstream/temporal/api/sdk/v1/task_complete_metadata.proto +63 -0
  82. data/bridge/sdk-core/protos/api_upstream/temporal/api/update/v1/message.proto +111 -0
  83. data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +59 -28
  84. data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +2 -2
  85. data/bridge/sdk-core/protos/local/temporal/sdk/core/activity_result/activity_result.proto +1 -0
  86. data/bridge/sdk-core/protos/local/temporal/sdk/core/activity_task/activity_task.proto +1 -0
  87. data/bridge/sdk-core/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +1 -0
  88. data/bridge/sdk-core/protos/local/temporal/sdk/core/common/common.proto +1 -0
  89. data/bridge/sdk-core/protos/local/temporal/sdk/core/core_interface.proto +1 -0
  90. data/bridge/sdk-core/protos/local/temporal/sdk/core/external_data/external_data.proto +1 -0
  91. data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +7 -0
  92. data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +1 -0
  93. data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +6 -0
  94. data/bridge/sdk-core/sdk/Cargo.toml +3 -2
  95. data/bridge/sdk-core/sdk/src/lib.rs +87 -20
  96. data/bridge/sdk-core/sdk/src/workflow_future.rs +9 -8
  97. data/bridge/sdk-core/sdk-core-protos/Cargo.toml +5 -2
  98. data/bridge/sdk-core/sdk-core-protos/build.rs +36 -1
  99. data/bridge/sdk-core/sdk-core-protos/src/history_builder.rs +100 -87
  100. data/bridge/sdk-core/sdk-core-protos/src/history_info.rs +5 -1
  101. data/bridge/sdk-core/sdk-core-protos/src/lib.rs +175 -57
  102. data/bridge/sdk-core/sdk-core-protos/src/task_token.rs +12 -2
  103. data/bridge/sdk-core/test-utils/Cargo.toml +3 -1
  104. data/bridge/sdk-core/test-utils/src/canned_histories.rs +106 -296
  105. data/bridge/sdk-core/test-utils/src/histfetch.rs +1 -1
  106. data/bridge/sdk-core/test-utils/src/lib.rs +82 -23
  107. data/bridge/sdk-core/test-utils/src/wf_input_saver.rs +50 -0
  108. data/bridge/sdk-core/test-utils/src/workflows.rs +29 -0
  109. data/bridge/sdk-core/tests/fuzzy_workflow.rs +130 -0
  110. data/bridge/sdk-core/tests/{load_tests.rs → heavy_tests.rs} +125 -51
  111. data/bridge/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +25 -3
  112. data/bridge/sdk-core/tests/integ_tests/heartbeat_tests.rs +5 -3
  113. data/bridge/sdk-core/tests/integ_tests/metrics_tests.rs +218 -16
  114. data/bridge/sdk-core/tests/integ_tests/polling_tests.rs +4 -47
  115. data/bridge/sdk-core/tests/integ_tests/queries_tests.rs +5 -128
  116. data/bridge/sdk-core/tests/integ_tests/visibility_tests.rs +83 -25
  117. data/bridge/sdk-core/tests/integ_tests/workflow_tests/activities.rs +93 -69
  118. data/bridge/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +1 -0
  119. data/bridge/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +6 -13
  120. data/bridge/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +1 -0
  121. data/bridge/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +6 -2
  122. data/bridge/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +3 -10
  123. data/bridge/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +72 -191
  124. data/bridge/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +1 -0
  125. data/bridge/sdk-core/tests/integ_tests/workflow_tests/patches.rs +7 -28
  126. data/bridge/sdk-core/tests/integ_tests/workflow_tests/replay.rs +12 -7
  127. data/bridge/sdk-core/tests/integ_tests/workflow_tests/resets.rs +1 -0
  128. data/bridge/sdk-core/tests/integ_tests/workflow_tests/signals.rs +18 -14
  129. data/bridge/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +6 -20
  130. data/bridge/sdk-core/tests/integ_tests/workflow_tests/timers.rs +10 -21
  131. data/bridge/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +6 -4
  132. data/bridge/sdk-core/tests/integ_tests/workflow_tests.rs +10 -11
  133. data/bridge/sdk-core/tests/main.rs +3 -13
  134. data/bridge/sdk-core/tests/runner.rs +75 -36
  135. data/bridge/sdk-core/tests/wf_input_replay.rs +32 -0
  136. data/bridge/src/connection.rs +41 -25
  137. data/bridge/src/lib.rs +269 -14
  138. data/bridge/src/runtime.rs +1 -1
  139. data/bridge/src/test_server.rs +153 -0
  140. data/bridge/src/worker.rs +89 -16
  141. data/lib/gen/temporal/api/command/v1/message_pb.rb +4 -18
  142. data/lib/gen/temporal/api/common/v1/message_pb.rb +4 -0
  143. data/lib/gen/temporal/api/enums/v1/command_type_pb.rb +1 -3
  144. data/lib/gen/temporal/api/enums/v1/event_type_pb.rb +3 -3
  145. data/lib/gen/temporal/api/enums/v1/failed_cause_pb.rb +2 -0
  146. data/lib/gen/temporal/api/enums/v1/update_pb.rb +6 -4
  147. data/lib/gen/temporal/api/history/v1/message_pb.rb +27 -19
  148. data/lib/gen/temporal/api/namespace/v1/message_pb.rb +1 -0
  149. data/lib/gen/temporal/api/operatorservice/v1/request_response_pb.rb +3 -0
  150. data/lib/gen/temporal/api/protocol/v1/message_pb.rb +30 -0
  151. data/lib/gen/temporal/api/sdk/v1/task_complete_metadata_pb.rb +23 -0
  152. data/lib/gen/temporal/api/testservice/v1/request_response_pb.rb +49 -0
  153. data/lib/gen/temporal/api/testservice/v1/service_pb.rb +21 -0
  154. data/lib/gen/temporal/api/update/v1/message_pb.rb +72 -0
  155. data/lib/gen/temporal/api/workflowservice/v1/request_response_pb.rb +26 -16
  156. data/lib/gen/temporal/sdk/core/activity_result/activity_result_pb.rb +13 -9
  157. data/lib/gen/temporal/sdk/core/activity_task/activity_task_pb.rb +10 -6
  158. data/lib/gen/temporal/sdk/core/child_workflow/child_workflow_pb.rb +13 -9
  159. data/lib/gen/temporal/sdk/core/common/common_pb.rb +7 -3
  160. data/lib/gen/temporal/sdk/core/core_interface_pb.rb +9 -3
  161. data/lib/gen/temporal/sdk/core/external_data/external_data_pb.rb +7 -3
  162. data/lib/gen/temporal/sdk/core/workflow_activation/workflow_activation_pb.rb +27 -21
  163. data/lib/gen/temporal/sdk/core/workflow_commands/workflow_commands_pb.rb +28 -24
  164. data/lib/gen/temporal/sdk/core/workflow_completion/workflow_completion_pb.rb +12 -5
  165. data/lib/temporalio/activity/context.rb +13 -8
  166. data/lib/temporalio/activity/info.rb +1 -1
  167. data/lib/temporalio/bridge/connect_options.rb +15 -0
  168. data/lib/temporalio/bridge/retry_config.rb +24 -0
  169. data/lib/temporalio/bridge/tls_options.rb +19 -0
  170. data/lib/temporalio/client/implementation.rb +8 -8
  171. data/lib/temporalio/connection/retry_config.rb +44 -0
  172. data/lib/temporalio/connection/service.rb +20 -0
  173. data/lib/temporalio/connection/test_service.rb +92 -0
  174. data/lib/temporalio/connection/tls_options.rb +51 -0
  175. data/lib/temporalio/connection/workflow_service.rb +731 -0
  176. data/lib/temporalio/connection.rb +55 -720
  177. data/lib/temporalio/interceptor/activity_inbound.rb +22 -0
  178. data/lib/temporalio/interceptor/activity_outbound.rb +24 -0
  179. data/lib/temporalio/interceptor/chain.rb +5 -5
  180. data/lib/temporalio/interceptor/client.rb +8 -4
  181. data/lib/temporalio/interceptor.rb +22 -0
  182. data/lib/temporalio/retry_policy.rb +13 -3
  183. data/lib/temporalio/testing/time_skipping_handle.rb +32 -0
  184. data/lib/temporalio/testing/time_skipping_interceptor.rb +23 -0
  185. data/lib/temporalio/testing/workflow_environment.rb +112 -0
  186. data/lib/temporalio/testing.rb +175 -0
  187. data/lib/temporalio/version.rb +1 -1
  188. data/lib/temporalio/worker/activity_runner.rb +26 -4
  189. data/lib/temporalio/worker/activity_worker.rb +44 -18
  190. data/lib/temporalio/worker/sync_worker.rb +47 -11
  191. data/lib/temporalio/worker.rb +27 -21
  192. data/lib/temporalio/workflow/async.rb +46 -0
  193. data/lib/temporalio/workflow/future.rb +138 -0
  194. data/lib/temporalio/workflow/info.rb +76 -0
  195. data/temporalio.gemspec +4 -3
  196. metadata +67 -17
  197. data/bridge/sdk-core/Cargo.lock +0 -2606
  198. data/bridge/sdk-core/protos/api_upstream/temporal/api/interaction/v1/message.proto +0 -87
  199. data/lib/bridge.so +0 -0
  200. data/lib/gen/temporal/api/enums/v1/interaction_type_pb.rb +0 -25
  201. data/lib/gen/temporal/api/interaction/v1/message_pb.rb +0 -49
  202. data/lib/gen/temporal/sdk/core/bridge/bridge_pb.rb +0 -222
@@ -15,10 +15,11 @@ categories = ["development-tools"]
15
15
  [dependencies]
16
16
  async-trait = "0.1"
17
17
  derive_builder = "0.12"
18
- opentelemetry = "0.18"
19
18
  prost-types = "0.11"
19
+ serde = { version = "1.0", default_features = false, features = ["derive"] }
20
20
  serde_json = "1.0"
21
21
  thiserror = "1.0"
22
+ tokio = "1.24"
22
23
  tonic = "0.8"
23
24
  tracing-core = "0.1"
24
25
  url = "2.3"
@@ -1,10 +1,6 @@
1
1
  //! Error types exposed by public APIs
2
2
 
3
- use prost_types::TimestampError;
4
- use temporal_sdk_core_protos::coresdk::{
5
- activity_result::ActivityExecutionResult,
6
- workflow_activation::remove_from_cache::EvictionReason,
7
- };
3
+ use temporal_sdk_core_protos::coresdk::activity_result::ActivityExecutionResult;
8
4
 
9
5
  /// Errors thrown by [crate::Worker::poll_workflow_activation]
10
6
  #[derive(thiserror::Error, Debug)]
@@ -64,32 +60,3 @@ pub enum CompleteActivityError {
64
60
  completion: Option<ActivityExecutionResult>,
65
61
  },
66
62
  }
67
-
68
- /// Errors thrown inside of workflow machines
69
- #[derive(thiserror::Error, Debug)]
70
- pub enum WFMachinesError {
71
- #[error("Nondeterminism error: {0}")]
72
- Nondeterminism(String),
73
- #[error("Fatal error in workflow machines: {0}")]
74
- Fatal(String),
75
-
76
- #[error("Unrecoverable network error while fetching history: {0}")]
77
- HistoryFetchingError(tonic::Status),
78
- }
79
-
80
- impl WFMachinesError {
81
- pub fn evict_reason(&self) -> EvictionReason {
82
- match self {
83
- WFMachinesError::Nondeterminism(_) => EvictionReason::Nondeterminism,
84
- WFMachinesError::Fatal(_) | WFMachinesError::HistoryFetchingError(_) => {
85
- EvictionReason::Fatal
86
- }
87
- }
88
- }
89
- }
90
-
91
- impl From<TimestampError> for WFMachinesError {
92
- fn from(_: TimestampError) -> Self {
93
- Self::Fatal("Could not decode timestamp".to_string())
94
- }
95
- }
@@ -45,13 +45,17 @@ pub trait Worker: Send + Sync {
45
45
  /// concurrently internally.
46
46
  async fn poll_activity_task(&self) -> Result<ActivityTask, PollActivityError>;
47
47
 
48
- /// Tell the worker that a workflow activation has completed. May be freely called concurrently.
48
+ /// Tell the worker that a workflow activation has completed. May (and should) be freely called
49
+ /// concurrently. The future may take some time to resolve, as fetching more events might be
50
+ /// necessary for completion to... complete - thus SDK implementers should make sure they do
51
+ /// not serialize completions.
49
52
  async fn complete_workflow_activation(
50
53
  &self,
51
54
  completion: WorkflowActivationCompletion,
52
55
  ) -> Result<(), CompleteWfError>;
53
56
 
54
- /// Tell the worker that an activity has finished executing. May be freely called concurrently.
57
+ /// Tell the worker that an activity has finished executing. May (and should) be freely called
58
+ /// concurrently.
55
59
  async fn complete_activity_task(
56
60
  &self,
57
61
  completion: ActivityTaskCompletion,
@@ -1,4 +1,3 @@
1
- use opentelemetry::metrics::Meter;
2
1
  use std::{
3
2
  collections::HashMap,
4
3
  net::SocketAddr,
@@ -18,11 +17,6 @@ pub trait CoreTelemetry {
18
17
  /// Returns the list of logs from oldest to newest. Returns an empty vec if the feature is not
19
18
  /// configured.
20
19
  fn fetch_buffered_logs(&self) -> Vec<CoreLog>;
21
-
22
- /// If metrics gathering is enabled, returns the OTel meter for core telemetry, which can be
23
- /// used to create metrics instruments, or passed to things that create/record metrics (ex:
24
- /// clients).
25
- fn get_metric_meter(&self) -> Option<&Meter>;
26
20
  }
27
21
 
28
22
  /// Telemetry configuration options. Construct with [TelemetryOptionsBuilder]
@@ -1,7 +1,8 @@
1
1
  use std::time::Duration;
2
+ use tokio::sync::mpsc::UnboundedSender;
2
3
 
3
4
  /// Defines per-worker configuration options
4
- #[derive(Debug, Clone, derive_builder::Builder)]
5
+ #[derive(Debug, Clone, derive_builder::Builder, serde::Serialize, serde::Deserialize)]
5
6
  #[builder(setter(into), build_fn(validate = "Self::validate"))]
6
7
  #[non_exhaustive]
7
8
  pub struct WorkerConfig {
@@ -105,6 +106,18 @@ pub struct WorkerConfig {
105
106
  /// up during shutdown, setting this true saves some back-and-forth.
106
107
  #[builder(default = "false")]
107
108
  pub ignore_evicts_on_shutdown: bool,
109
+
110
+ /// Maximum number of next page (or initial) history event listing requests we'll make
111
+ /// concurrently. I don't this it's worth exposing this to users until we encounter a reason.
112
+ #[builder(default = "5")]
113
+ pub fetching_concurrency: usize,
114
+
115
+ /// If set, and the `save_wf_inputs` feature is enabled in core, will be sent a serialized
116
+ /// instance of every input to workflow state in order. This is for testing purposes, SDK
117
+ /// implementations never need to care about it.
118
+ #[builder(default)]
119
+ #[serde(skip)]
120
+ pub wf_state_inputs: Option<UnboundedSender<Vec<u8>>>,
108
121
  }
109
122
 
110
123
  impl WorkerConfig {
@@ -132,17 +132,17 @@ use syn::{
132
132
  /// The macro will generate a few things:
133
133
  /// * A struct for the overall state machine, named with the provided name. Here:
134
134
  /// ```text
135
- /// struct CardMachine {
136
- /// state: CardMachineState,
137
- /// shared_state: CardId,
135
+ /// struct CardReader {
136
+ /// state: CardReaderState,
137
+ /// shared_state: SharedState,
138
138
  /// }
139
139
  /// ```
140
140
  /// * An enum with a variant for each state, named with the provided name + "State".
141
141
  /// ```text
142
- /// enum CardMachineState {
142
+ /// enum CardReaderState {
143
143
  /// Locked(Locked),
144
144
  /// ReadingCard(ReadingCard),
145
- /// Unlocked(Unlocked),
145
+ /// DoorOpen(DoorOpen),
146
146
  /// }
147
147
  /// ```
148
148
  ///
@@ -154,15 +154,18 @@ use syn::{
154
154
  /// * An enum with a variant for each event. You are expected to define the type (if any) contained
155
155
  /// in the event variant.
156
156
  /// ```text
157
- /// enum CardMachineEvents {
158
- /// CardReadable(CardData)
157
+ /// enum CardReaderEvents {
158
+ /// DoorClosed,
159
+ /// CardAccepted,
160
+ /// CardRejected,
161
+ /// CardReadable(CardData),
159
162
  /// }
160
163
  /// ```
161
164
  /// * An implementation of the [StateMachine](trait.StateMachine.html) trait for the generated state
162
- /// machine enum (in this case, `CardMachine`)
165
+ /// machine enum (in this case, `CardReader`)
163
166
  /// * A type alias for a [TransitionResult](enum.TransitionResult.html) with the appropriate generic
164
167
  /// parameters set for your machine. It is named as your machine with `Transition` appended. In
165
- /// this case, `CardMachineTransition`.
168
+ /// this case, `CardReaderTransition`.
166
169
  #[proc_macro]
167
170
  pub fn fsm(input: TokenStream) -> TokenStream {
168
171
  let def: StateMachineDefinition = parse_macro_input!(input as StateMachineDefinition);
@@ -346,12 +349,12 @@ impl StateMachineDefinition {
346
349
  let name = &self.name;
347
350
  let name_str = &self.name.to_string();
348
351
 
349
- let transition_result_name = Ident::new(&format!("{}Transition", name), name.span());
352
+ let transition_result_name = Ident::new(&format!("{name}Transition"), name.span());
350
353
  let transition_type_alias = quote! {
351
354
  type #transition_result_name<Ds, Sm = #name> = TransitionResult<Sm, Ds>;
352
355
  };
353
356
 
354
- let state_enum_name = Ident::new(&format!("{}State", name), name.span());
357
+ let state_enum_name = Ident::new(&format!("{name}State"), name.span());
355
358
  // If user has not defined any shared state, use the unit type.
356
359
  let shared_state_type = self
357
360
  .shared_state_type
@@ -390,7 +393,7 @@ impl StateMachineDefinition {
390
393
 
391
394
  // Build the events enum
392
395
  let events: HashSet<Variant> = self.transitions.iter().map(|t| t.event.clone()).collect();
393
- let events_enum_name = Ident::new(&format!("{}Events", name), name.span());
396
+ let events_enum_name = Ident::new(&format!("{name}Events"), name.span());
394
397
  let events: Vec<_> = events
395
398
  .into_iter()
396
399
  .map(|v| {
@@ -616,11 +619,11 @@ impl StateMachineDefinition {
616
619
  self.all_states()
617
620
  .iter()
618
621
  .filter(|s| self.is_final_state(s))
619
- .map(|s| format!("{} --> [*]", s)),
622
+ .map(|s| format!("{s} --> [*]")),
620
623
  )
621
624
  .collect();
622
625
  let transitions = transitions.join("\n");
623
- format!("@startuml\n{}\n@enduml", transitions)
626
+ format!("@startuml\n{transitions}\n@enduml")
624
627
  }
625
628
  }
626
629
 
@@ -643,5 +646,5 @@ fn merge_transition_dests(transitions: Vec<Transition>) -> Vec<Transition> {
643
646
  }
644
647
  }
645
648
  }
646
- map.into_iter().map(|(_, v)| v).collect()
649
+ map.into_values().collect()
647
650
  }
@@ -34,6 +34,7 @@ pub trait StateMachine: Sized {
34
34
  where
35
35
  Self: Clone,
36
36
  {
37
+ // TODO: Get rid of this clone. It's pointless.
37
38
  // NOTE: This clone is actually nice in some sense, giving us a kind of transactionality.
38
39
  // However if there are really big things in state it could be an issue.
39
40
  let res = self.clone().on_event(event);
@@ -207,10 +208,14 @@ where
207
208
  new_state: Ds::default(),
208
209
  }
209
210
  }
211
+ }
210
212
 
211
- /// Produce a transition with no commands relying on [Default] for the destination state's
212
- /// value
213
- pub fn default() -> Self {
213
+ impl<Sm, Ds> Default for TransitionResult<Sm, Ds>
214
+ where
215
+ Sm: StateMachine,
216
+ Ds: Into<Sm::State> + Default,
217
+ {
218
+ fn default() -> Self {
214
219
  Self::OkNoShare {
215
220
  commands: vec![],
216
221
  new_state: Ds::default(),
@@ -39,7 +39,6 @@ import "temporal/api/enums/v1/workflow.proto";
39
39
  import "temporal/api/enums/v1/command_type.proto";
40
40
  import "temporal/api/common/v1/message.proto";
41
41
  import "temporal/api/failure/v1/message.proto";
42
- import "temporal/api/interaction/v1/message.proto";
43
42
  import "temporal/api/taskqueue/v1/message.proto";
44
43
 
45
44
  message ScheduleActivityTaskCommandAttributes {
@@ -221,19 +220,9 @@ message StartChildWorkflowExecutionCommandAttributes {
221
220
  temporal.api.common.v1.SearchAttributes search_attributes = 16;
222
221
  }
223
222
 
224
- message AcceptWorkflowUpdateCommandAttributes {
225
- temporal.api.interaction.v1.Meta meta = 1;
226
- temporal.api.interaction.v1.Input input = 2;
227
- }
228
-
229
- message CompleteWorkflowUpdateCommandAttributes {
230
- temporal.api.interaction.v1.Meta meta = 1;
231
- temporal.api.interaction.v1.Output output = 2;
232
- }
233
-
234
- message RejectWorkflowUpdateCommandAttributes {
235
- temporal.api.interaction.v1.Meta meta = 1;
236
- temporal.api.failure.v1.Failure failure = 2;
223
+ message ProtocolMessageCommandAttributes {
224
+ // The message ID of the message to which this command is a pointer.
225
+ string message_id = 1;
237
226
  }
238
227
 
239
228
  message Command {
@@ -252,9 +241,8 @@ message Command {
252
241
  StartChildWorkflowExecutionCommandAttributes start_child_workflow_execution_command_attributes = 12;
253
242
  SignalExternalWorkflowExecutionCommandAttributes signal_external_workflow_execution_command_attributes = 13;
254
243
  UpsertWorkflowSearchAttributesCommandAttributes upsert_workflow_search_attributes_command_attributes = 14;
255
- AcceptWorkflowUpdateCommandAttributes accept_workflow_update_command_attributes = 15;
256
- CompleteWorkflowUpdateCommandAttributes complete_workflow_update_command_attributes = 16;
244
+ ProtocolMessageCommandAttributes protocol_message_command_attributes = 15;
245
+ // 16 is available for use - it was used as part of a prototype that never made it into a release
257
246
  ModifyWorkflowPropertiesCommandAttributes modify_workflow_properties_command_attributes = 17;
258
- RejectWorkflowUpdateCommandAttributes reject_workflow_update_command_attributes = 18;
259
247
  }
260
248
  }
@@ -110,3 +110,14 @@ message RetryPolicy {
110
110
  // this is not a substring match, the error *type* (not message) must match exactly.
111
111
  repeated string non_retryable_error_types = 5;
112
112
  }
113
+
114
+ // Metadata relevant for metering purposes
115
+ message MeteringMetadata {
116
+ // Count of local activities which have begun an execution attempt during this workflow task,
117
+ // and whose first attempt occurred in some previous task. This is used for metering
118
+ // purposes, and does not affect workflow state.
119
+ //
120
+ // (-- api-linter: core::0141::forbidden-types=disabled
121
+ // aip.dev/not-precedent: Negative values make no sense to represent. --)
122
+ uint32 nonfirst_local_activity_execution_attempts = 13;
123
+ }
@@ -47,11 +47,6 @@ 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
- // Indicates that an update has been accepted for processing workflow code
51
- COMMAND_TYPE_ACCEPT_WORKFLOW_UPDATE = 14;
52
- // Indicates that an update has completed and carries either the success or
53
- // failure outcome of said update.
54
- COMMAND_TYPE_COMPLETE_WORKFLOW_UPDATE = 15;
50
+ COMMAND_TYPE_PROTOCOL_MESSAGE = 14;
55
51
  COMMAND_TYPE_MODIFY_WORKFLOW_PROPERTIES = 16;
56
- COMMAND_TYPE_REJECT_WORKFLOW_UPDATE = 17;
57
52
  }
@@ -151,12 +151,12 @@ 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_REJECTED = 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;
154
+ // An update was accepted (i.e. validated)
155
+ EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_ACCEPTED = 41;
156
+ // An update was rejected (i.e. failed validation)
157
+ EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_REJECTED = 42;
158
+ // An update completed
159
+ EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_COMPLETED = 43;
160
160
  // Some property or properties of the workflow as a whole have changed by non-workflow code.
161
161
  // The distinction of external vs. command-based modification is important so the SDK can
162
162
  // maintain determinism when using the command-based approach.
@@ -85,6 +85,11 @@ enum WorkflowTaskFailedCause {
85
85
  // Similarly, we have a buffer of pending requests to cancel other workflows. We return this error
86
86
  // when our capacity for pending cancel requests is already reached.
87
87
  WORKFLOW_TASK_FAILED_CAUSE_PENDING_REQUEST_CANCEL_LIMIT_EXCEEDED = 29;
88
+ // Workflow execution update message (update.Acceptance, update.Rejection, or update.Response)
89
+ // has wrong format, or missing required fields.
90
+ WORKFLOW_TASK_FAILED_CAUSE_BAD_UPDATE_WORKFLOW_EXECUTION_MESSAGE = 30;
91
+ // Similar to WORKFLOW_TASK_FAILED_CAUSE_UNHANDLED_COMMAND, but for updates.
92
+ WORKFLOW_TASK_FAILED_CAUSE_UNHANDLED_UPDATE = 31;
88
93
  }
89
94
 
90
95
  enum StartChildWorkflowExecutionFailedCause {
@@ -31,10 +31,26 @@ option java_outer_classname = "UpdateProto";
31
31
  option ruby_package = "Temporalio::Api::Enums::V1";
32
32
  option csharp_namespace = "Temporalio.Api.Enums.V1";
33
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;
34
+ // UpdateWorkflowExecutionLifecycleStage is specified by clients invoking
35
+ // workflow execution updates and used to indicate to the server how long the
36
+ // client wishes to wait for a return value from the RPC. If any value other
37
+ // than UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_COMPLETED is sent by the
38
+ // client then the RPC will complete before the update is finished and will
39
+ // return a handle to the running update so that it can later be polled for
40
+ // completion.
41
+ enum UpdateWorkflowExecutionLifecycleStage {
42
+ // An unspecified vale for this enum.
43
+ UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_UNSPECIFIED = 0;
44
+ // The gRPC call will not return until the update request has been admitted
45
+ // by the server - it may be the case that due to a considerations like load
46
+ // or resource limits that an update is made to wait before the server will
47
+ // indicate that it has been received and will be processed. This value
48
+ // does not wait for any sort of acknowledgement from a worker.
49
+ UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_ADMITTED = 1;
50
+ // The gRPC call will not return until the update has passed validation on
51
+ // a worker.
52
+ UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_ACCEPTED = 2;
53
+ // The gRPC call will not return until the update has executed to completion
54
+ // on a worker and has either been rejected or returned a value or an error.
55
+ UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_COMPLETED = 3;
40
56
  }
@@ -41,9 +41,10 @@ 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/interaction/v1/message.proto";
45
44
  import "temporal/api/taskqueue/v1/message.proto";
45
+ import "temporal/api/update/v1/message.proto";
46
46
  import "temporal/api/workflow/v1/message.proto";
47
+ import "temporal/api/sdk/v1/task_complete_metadata.proto";
47
48
 
48
49
  // Always the first event in workflow history
49
50
  message WorkflowExecutionStartedEventAttributes {
@@ -195,6 +196,11 @@ message WorkflowTaskCompletedEventAttributes {
195
196
  // ID of the worker who picked up this workflow task, or missing if worker
196
197
  // is not using versioning.
197
198
  temporal.api.taskqueue.v1.VersionId worker_versioning_id = 5;
199
+ // Data the SDK wishes to record for itself, but server need not interpret, and does not
200
+ // directly impact workflow state.
201
+ temporal.api.sdk.v1.WorkflowTaskCompletedMetadata sdk_metadata = 6;
202
+ // Local usage data sent during workflow task completion and recorded here for posterity
203
+ temporal.api.common.v1.MeteringMetadata metering_metadata = 13;
198
204
  }
199
205
 
200
206
  message WorkflowTaskTimedOutEventAttributes {
@@ -647,21 +653,6 @@ message ChildWorkflowExecutionTerminatedEventAttributes {
647
653
  int64 started_event_id = 5;
648
654
  }
649
655
 
650
- message WorkflowUpdateAcceptedEventAttributes {
651
- temporal.api.interaction.v1.Meta meta = 1;
652
- temporal.api.interaction.v1.Input input = 2;
653
- }
654
-
655
- message WorkflowUpdateCompletedEventAttributes {
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;
663
- }
664
-
665
656
  message WorkflowPropertiesModifiedExternallyEventAttributes {
666
657
  // If set to a nonempty string, future workflow tasks for this workflow shall be dispatched on
667
658
  // the provided queue.
@@ -686,6 +677,44 @@ message ActivityPropertiesModifiedExternallyEventAttributes {
686
677
  temporal.api.common.v1.RetryPolicy new_retry_policy = 2;
687
678
  }
688
679
 
680
+ message WorkflowExecutionUpdateAcceptedEventAttributes {
681
+ // The instance ID of the update protocol that generated this event.
682
+ string protocol_instance_id = 1;
683
+ // The message ID of the original request message that initiated this
684
+ // update. Needed so that the worker can recreate and deliver that same
685
+ // message as part of replay.
686
+ string accepted_request_message_id = 2;
687
+ // The event ID used to sequence the original request message.
688
+ int64 accepted_request_sequencing_event_id = 3;
689
+ // The message payload of the original request message that initiated this
690
+ // update.
691
+ temporal.api.update.v1.Request accepted_request = 4;
692
+ }
693
+
694
+ message WorkflowExecutionUpdateCompletedEventAttributes {
695
+ // The metadata about this update.
696
+ temporal.api.update.v1.Meta meta = 1;
697
+ // The outcome of executing the workflow update function.
698
+ temporal.api.update.v1.Outcome outcome = 2;
699
+ }
700
+
701
+ message WorkflowExecutionUpdateRejectedEventAttributes {
702
+ // The instance ID of the update protocol that generated this event.
703
+ string protocol_instance_id = 1;
704
+ // The message ID of the original request message that initiated this
705
+ // update. Needed so that the worker can recreate and deliver that same
706
+ // message as part of replay.
707
+ string rejected_request_message_id = 2;
708
+ // The event ID used to sequence the original request message.
709
+ int64 rejected_request_sequencing_event_id = 3;
710
+ // The message payload of the original request message that initiated this
711
+ // update.
712
+ temporal.api.update.v1.Request rejected_request = 4;
713
+ // The cause of rejection.
714
+ temporal.api.failure.v1.Failure failure = 5;
715
+ }
716
+
717
+
689
718
  // History events are the method by which Temporal SDKs advance (or recreate) workflow state.
690
719
  // See the `EventType` enum for more info about what each event is for.
691
720
  message HistoryEvent {
@@ -744,9 +773,9 @@ message HistoryEvent {
744
773
  SignalExternalWorkflowExecutionFailedEventAttributes signal_external_workflow_execution_failed_event_attributes = 43;
745
774
  ExternalWorkflowExecutionSignaledEventAttributes external_workflow_execution_signaled_event_attributes = 44;
746
775
  UpsertWorkflowSearchAttributesEventAttributes upsert_workflow_search_attributes_event_attributes = 45;
747
- WorkflowUpdateRejectedEventAttributes workflow_update_rejected_event_attributes = 46;
748
- WorkflowUpdateAcceptedEventAttributes workflow_update_accepted_event_attributes = 47;
749
- WorkflowUpdateCompletedEventAttributes workflow_update_completed_event_attributes = 48;
776
+ WorkflowExecutionUpdateAcceptedEventAttributes workflow_execution_update_accepted_event_attributes = 46;
777
+ WorkflowExecutionUpdateRejectedEventAttributes workflow_execution_update_rejected_event_attributes = 47;
778
+ WorkflowExecutionUpdateCompletedEventAttributes workflow_execution_update_completed_event_attributes = 48;
750
779
  WorkflowPropertiesModifiedExternallyEventAttributes workflow_properties_modified_externally_event_attributes = 49;
751
780
  ActivityPropertiesModifiedExternallyEventAttributes activity_properties_modified_externally_event_attributes = 50;
752
781
  WorkflowPropertiesModifiedEventAttributes workflow_properties_modified_event_attributes = 51;
@@ -62,6 +62,8 @@ message NamespaceConfig {
62
62
  // If unspecified (ARCHIVAL_STATE_UNSPECIFIED) then default server configuration is used.
63
63
  temporal.api.enums.v1.ArchivalState visibility_archival_state = 5;
64
64
  string visibility_archival_uri = 6;
65
+ // Map from field name to alias.
66
+ map<string, string> custom_search_attribute_aliases = 7;
65
67
  }
66
68
 
67
69
  message BadBinaries {
@@ -38,6 +38,7 @@ import "temporal/api/enums/v1/common.proto";
38
38
  message AddSearchAttributesRequest {
39
39
  // Mapping between search attribute name and its IndexedValueType.
40
40
  map<string, temporal.api.enums.v1.IndexedValueType> search_attributes = 1;
41
+ string namespace = 2;
41
42
  }
42
43
 
43
44
  message AddSearchAttributesResponse {
@@ -46,12 +47,14 @@ message AddSearchAttributesResponse {
46
47
  message RemoveSearchAttributesRequest {
47
48
  // Search attribute names to delete.
48
49
  repeated string search_attributes = 1;
50
+ string namespace = 2;
49
51
  }
50
52
 
51
53
  message RemoveSearchAttributesResponse {
52
54
  }
53
55
 
54
56
  message ListSearchAttributesRequest {
57
+ string namespace = 1;
55
58
  }
56
59
 
57
60
  message ListSearchAttributesResponse {
@@ -22,18 +22,36 @@
22
22
 
23
23
  syntax = "proto3";
24
24
 
25
- package temporal.api.enums.v1;
25
+ package temporal.api.protocol.v1;
26
26
 
27
- option go_package = "go.temporal.io/api/enums/v1;enums";
28
- option java_package = "io.temporal.api.enums.v1";
27
+ option go_package = "go.temporal.io/api/protocol/v1;protocol";
28
+ option java_package = "io.temporal.api.protocol.v1";
29
29
  option java_multiple_files = true;
30
- option java_outer_classname = "InteractionTypeProto";
31
- option ruby_package = "Temporalio::Api::Enums::V1";
32
- option csharp_namespace = "Temporalio.Api.Enums.V1";
30
+ option java_outer_classname = "MessageProto";
31
+ option ruby_package = "Temporalio::Api::Protocol::V1";
32
+ option csharp_namespace = "Temporalt.Api.Protocol.V1";
33
33
 
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;
34
+ import "google/protobuf/any.proto";
35
+
36
+ // (-- api-linter: core::0146::any=disabled
37
+ // aip.dev/not-precedent: We want runtime extensibility for the body field --)
38
+ message Message {
39
+ // An ID for this specific message.
40
+ string id = 1;
41
+
42
+ // Identifies the specific instance of a protocol to which this message
43
+ // belongs.
44
+ string protocol_instance_id = 2;
45
+
46
+ // The event ID or command ID after which this message can be delivered. The
47
+ // effects of history up to and including this event ID should be visible to
48
+ // the code that handles this message. Omit to opt out of sequencing.
49
+ oneof sequencing_id {
50
+ int64 event_id = 3;
51
+ int64 command_index = 4;
52
+ };
53
+
54
+ // The opaque data carried by this message. The protocol type can be
55
+ // extracted from the package name of the message carried inside the Any.
56
+ google.protobuf.Any body = 5;
39
57
  }
@@ -0,0 +1,63 @@
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.sdk.v1;
26
+
27
+ option go_package = "go.temporal.io/api/sdk/v1;sdk";
28
+ option java_package = "io.temporal.api.sdk.v1";
29
+ option java_multiple_files = true;
30
+ option java_outer_classname = "TaskCompleteMetadataProto";
31
+ option ruby_package = "Temporalio::Api::Sdk::V1";
32
+ option csharp_namespace = "Temporalio.Api.Sdk.V1";
33
+
34
+ message WorkflowTaskCompletedMetadata {
35
+ // Internal flags used by the core SDK. SDKs using flags must comply with the following behavior:
36
+ //
37
+ // During replay:
38
+ // * If a flag is not recognized (value is too high or not defined), it must fail the workflow
39
+ // task.
40
+ // * If a flag is recognized, it is stored in a set of used flags for the run. Code checks for
41
+ // that flag during and after this WFT are allowed to assume that the flag is present.
42
+ // * If a code check for a flag does not find the flag in the set of used flags, it must take
43
+ // the branch corresponding to the absence of that flag.
44
+ //
45
+ // During non-replay execution of new WFTs:
46
+ // * The SDK is free to use all flags it knows about. It must record any newly-used (IE: not
47
+ // previously recorded) flags when completing the WFT.
48
+ //
49
+ // SDKs which are too old to even know about this field at all are considered to produce
50
+ // undefined behavior if they replay workflows which used this mechanism.
51
+ //
52
+ // (-- api-linter: core::0141::forbidden-types=disabled
53
+ // aip.dev/not-precedent: These really shouldn't have negative values. --)
54
+ repeated uint32 core_used_flags = 1;
55
+
56
+ // Flags used by the SDK lang. No attempt is made to distinguish between different SDK languages
57
+ // here as processing a workflow with a different language than the one which authored it is
58
+ // already undefined behavior. See `core_used_patches` for more.
59
+ //
60
+ // (-- api-linter: core::0141::forbidden-types=disabled
61
+ // aip.dev/not-precedent: These really shouldn't have negative values. --)
62
+ repeated uint32 lang_used_flags = 2;
63
+ }