temporalio 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -23
- data/bridge/Cargo.lock +168 -59
- data/bridge/Cargo.toml +4 -2
- data/bridge/sdk-core/README.md +19 -6
- data/bridge/sdk-core/client/src/lib.rs +215 -39
- data/bridge/sdk-core/client/src/metrics.rs +17 -8
- data/bridge/sdk-core/client/src/raw.rs +4 -4
- data/bridge/sdk-core/client/src/retry.rs +32 -20
- data/bridge/sdk-core/core/Cargo.toml +22 -9
- data/bridge/sdk-core/core/src/abstractions.rs +203 -14
- data/bridge/sdk-core/core/src/core_tests/activity_tasks.rs +76 -41
- data/bridge/sdk-core/core/src/core_tests/determinism.rs +165 -2
- data/bridge/sdk-core/core/src/core_tests/local_activities.rs +204 -83
- data/bridge/sdk-core/core/src/core_tests/queries.rs +3 -4
- data/bridge/sdk-core/core/src/core_tests/workers.rs +1 -3
- data/bridge/sdk-core/core/src/core_tests/workflow_tasks.rs +397 -54
- data/bridge/sdk-core/core/src/ephemeral_server/mod.rs +106 -12
- data/bridge/sdk-core/core/src/internal_flags.rs +136 -0
- data/bridge/sdk-core/core/src/lib.rs +16 -9
- data/bridge/sdk-core/core/src/telemetry/log_export.rs +1 -1
- data/bridge/sdk-core/core/src/telemetry/metrics.rs +69 -35
- data/bridge/sdk-core/core/src/telemetry/mod.rs +29 -13
- data/bridge/sdk-core/core/src/telemetry/prometheus_server.rs +17 -12
- data/bridge/sdk-core/core/src/test_help/mod.rs +62 -12
- data/bridge/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +112 -156
- data/bridge/sdk-core/core/src/worker/activities/activity_task_poller_stream.rs +89 -0
- data/bridge/sdk-core/core/src/worker/activities/local_activities.rs +352 -122
- data/bridge/sdk-core/core/src/worker/activities.rs +233 -157
- data/bridge/sdk-core/core/src/worker/client/mocks.rs +22 -2
- data/bridge/sdk-core/core/src/worker/client.rs +18 -2
- data/bridge/sdk-core/core/src/worker/mod.rs +165 -58
- data/bridge/sdk-core/core/src/worker/workflow/bridge.rs +1 -3
- data/bridge/sdk-core/core/src/worker/workflow/driven_workflow.rs +3 -5
- data/bridge/sdk-core/core/src/worker/workflow/history_update.rs +856 -277
- data/bridge/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +100 -43
- data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +7 -7
- data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +5 -4
- data/bridge/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +87 -27
- data/bridge/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +5 -4
- data/bridge/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +5 -4
- data/bridge/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +5 -4
- data/bridge/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +137 -62
- data/bridge/sdk-core/core/src/worker/workflow/machines/mod.rs +25 -17
- data/bridge/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +7 -6
- data/bridge/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +103 -152
- data/bridge/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +7 -7
- data/bridge/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +9 -9
- data/bridge/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +2 -2
- data/bridge/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +14 -7
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines/local_acts.rs +5 -16
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +201 -121
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +11 -14
- data/bridge/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +30 -15
- data/bridge/sdk-core/core/src/worker/workflow/managed_run.rs +1026 -376
- data/bridge/sdk-core/core/src/worker/workflow/mod.rs +460 -384
- data/bridge/sdk-core/core/src/worker/workflow/run_cache.rs +40 -57
- data/bridge/sdk-core/core/src/worker/workflow/wft_extraction.rs +125 -0
- data/bridge/sdk-core/core/src/worker/workflow/wft_poller.rs +1 -4
- data/bridge/sdk-core/core/src/worker/workflow/workflow_stream/saved_wf_inputs.rs +117 -0
- data/bridge/sdk-core/core/src/worker/workflow/workflow_stream/tonic_status_serde.rs +24 -0
- data/bridge/sdk-core/core/src/worker/workflow/workflow_stream.rs +448 -718
- data/bridge/sdk-core/core-api/Cargo.toml +2 -1
- data/bridge/sdk-core/core-api/src/errors.rs +1 -34
- data/bridge/sdk-core/core-api/src/lib.rs +6 -2
- data/bridge/sdk-core/core-api/src/telemetry.rs +0 -6
- data/bridge/sdk-core/core-api/src/worker.rs +14 -1
- data/bridge/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +18 -15
- data/bridge/sdk-core/fsm/rustfsm_trait/src/lib.rs +8 -3
- data/bridge/sdk-core/histories/evict_while_la_running_no_interference-16_history.bin +0 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +5 -17
- data/bridge/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +11 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/command_type.proto +1 -6
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/event_type.proto +6 -6
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +5 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/update.proto +22 -6
- data/bridge/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +48 -19
- data/bridge/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +2 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +3 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/{enums/v1/interaction_type.proto → protocol/v1/message.proto} +29 -11
- data/bridge/sdk-core/protos/api_upstream/temporal/api/sdk/v1/task_complete_metadata.proto +63 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/update/v1/message.proto +111 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +59 -28
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +2 -2
- data/bridge/sdk-core/protos/local/temporal/sdk/core/activity_result/activity_result.proto +1 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/activity_task/activity_task.proto +1 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +1 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/common/common.proto +1 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/core_interface.proto +1 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/external_data/external_data.proto +1 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +7 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +1 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +6 -0
- data/bridge/sdk-core/sdk/Cargo.toml +3 -2
- data/bridge/sdk-core/sdk/src/lib.rs +87 -20
- data/bridge/sdk-core/sdk/src/workflow_future.rs +9 -8
- data/bridge/sdk-core/sdk-core-protos/Cargo.toml +5 -2
- data/bridge/sdk-core/sdk-core-protos/build.rs +36 -1
- data/bridge/sdk-core/sdk-core-protos/src/history_builder.rs +100 -87
- data/bridge/sdk-core/sdk-core-protos/src/history_info.rs +5 -1
- data/bridge/sdk-core/sdk-core-protos/src/lib.rs +175 -57
- data/bridge/sdk-core/sdk-core-protos/src/task_token.rs +12 -2
- data/bridge/sdk-core/test-utils/Cargo.toml +3 -1
- data/bridge/sdk-core/test-utils/src/canned_histories.rs +106 -296
- data/bridge/sdk-core/test-utils/src/histfetch.rs +1 -1
- data/bridge/sdk-core/test-utils/src/lib.rs +82 -23
- data/bridge/sdk-core/test-utils/src/wf_input_saver.rs +50 -0
- data/bridge/sdk-core/test-utils/src/workflows.rs +29 -0
- data/bridge/sdk-core/tests/fuzzy_workflow.rs +130 -0
- data/bridge/sdk-core/tests/{load_tests.rs → heavy_tests.rs} +125 -51
- data/bridge/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +25 -3
- data/bridge/sdk-core/tests/integ_tests/heartbeat_tests.rs +5 -3
- data/bridge/sdk-core/tests/integ_tests/metrics_tests.rs +218 -16
- data/bridge/sdk-core/tests/integ_tests/polling_tests.rs +4 -47
- data/bridge/sdk-core/tests/integ_tests/queries_tests.rs +5 -128
- data/bridge/sdk-core/tests/integ_tests/visibility_tests.rs +83 -25
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/activities.rs +93 -69
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +1 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +6 -13
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +1 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +6 -2
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +3 -10
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +72 -191
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +1 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/patches.rs +7 -28
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/replay.rs +12 -7
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/resets.rs +1 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/signals.rs +18 -14
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +6 -20
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/timers.rs +10 -21
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +6 -4
- data/bridge/sdk-core/tests/integ_tests/workflow_tests.rs +10 -11
- data/bridge/sdk-core/tests/main.rs +3 -13
- data/bridge/sdk-core/tests/runner.rs +75 -36
- data/bridge/sdk-core/tests/wf_input_replay.rs +32 -0
- data/bridge/src/connection.rs +41 -25
- data/bridge/src/lib.rs +269 -14
- data/bridge/src/runtime.rs +1 -1
- data/bridge/src/test_server.rs +153 -0
- data/bridge/src/worker.rs +89 -16
- data/lib/gen/temporal/api/command/v1/message_pb.rb +4 -18
- data/lib/gen/temporal/api/common/v1/message_pb.rb +4 -0
- data/lib/gen/temporal/api/enums/v1/command_type_pb.rb +1 -3
- data/lib/gen/temporal/api/enums/v1/event_type_pb.rb +3 -3
- data/lib/gen/temporal/api/enums/v1/failed_cause_pb.rb +2 -0
- data/lib/gen/temporal/api/enums/v1/update_pb.rb +6 -4
- data/lib/gen/temporal/api/history/v1/message_pb.rb +27 -19
- data/lib/gen/temporal/api/namespace/v1/message_pb.rb +1 -0
- data/lib/gen/temporal/api/operatorservice/v1/request_response_pb.rb +3 -0
- data/lib/gen/temporal/api/protocol/v1/message_pb.rb +30 -0
- data/lib/gen/temporal/api/sdk/v1/task_complete_metadata_pb.rb +23 -0
- data/lib/gen/temporal/api/testservice/v1/request_response_pb.rb +49 -0
- data/lib/gen/temporal/api/testservice/v1/service_pb.rb +21 -0
- data/lib/gen/temporal/api/update/v1/message_pb.rb +72 -0
- data/lib/gen/temporal/api/workflowservice/v1/request_response_pb.rb +26 -16
- data/lib/gen/temporal/sdk/core/activity_result/activity_result_pb.rb +13 -9
- data/lib/gen/temporal/sdk/core/activity_task/activity_task_pb.rb +10 -6
- data/lib/gen/temporal/sdk/core/child_workflow/child_workflow_pb.rb +13 -9
- data/lib/gen/temporal/sdk/core/common/common_pb.rb +7 -3
- data/lib/gen/temporal/sdk/core/core_interface_pb.rb +9 -3
- data/lib/gen/temporal/sdk/core/external_data/external_data_pb.rb +7 -3
- data/lib/gen/temporal/sdk/core/workflow_activation/workflow_activation_pb.rb +27 -21
- data/lib/gen/temporal/sdk/core/workflow_commands/workflow_commands_pb.rb +28 -24
- data/lib/gen/temporal/sdk/core/workflow_completion/workflow_completion_pb.rb +12 -5
- data/lib/temporalio/activity/context.rb +13 -8
- data/lib/temporalio/activity/info.rb +1 -1
- data/lib/temporalio/bridge/connect_options.rb +15 -0
- data/lib/temporalio/bridge/retry_config.rb +24 -0
- data/lib/temporalio/bridge/tls_options.rb +19 -0
- data/lib/temporalio/client/implementation.rb +8 -8
- data/lib/temporalio/connection/retry_config.rb +44 -0
- data/lib/temporalio/connection/service.rb +20 -0
- data/lib/temporalio/connection/test_service.rb +92 -0
- data/lib/temporalio/connection/tls_options.rb +51 -0
- data/lib/temporalio/connection/workflow_service.rb +731 -0
- data/lib/temporalio/connection.rb +55 -720
- data/lib/temporalio/interceptor/activity_inbound.rb +22 -0
- data/lib/temporalio/interceptor/activity_outbound.rb +24 -0
- data/lib/temporalio/interceptor/chain.rb +5 -5
- data/lib/temporalio/interceptor/client.rb +8 -4
- data/lib/temporalio/interceptor.rb +22 -0
- data/lib/temporalio/retry_policy.rb +13 -3
- data/lib/temporalio/testing/time_skipping_handle.rb +32 -0
- data/lib/temporalio/testing/time_skipping_interceptor.rb +23 -0
- data/lib/temporalio/testing/workflow_environment.rb +112 -0
- data/lib/temporalio/testing.rb +175 -0
- data/lib/temporalio/version.rb +1 -1
- data/lib/temporalio/worker/activity_runner.rb +26 -4
- data/lib/temporalio/worker/activity_worker.rb +44 -18
- data/lib/temporalio/worker/sync_worker.rb +47 -11
- data/lib/temporalio/worker.rb +27 -21
- data/lib/temporalio/workflow/async.rb +46 -0
- data/lib/temporalio/workflow/future.rb +138 -0
- data/lib/temporalio/workflow/info.rb +76 -0
- data/temporalio.gemspec +4 -3
- metadata +67 -17
- data/bridge/sdk-core/Cargo.lock +0 -2606
- data/bridge/sdk-core/protos/api_upstream/temporal/api/interaction/v1/message.proto +0 -87
- data/lib/bridge.so +0 -0
- data/lib/gen/temporal/api/enums/v1/interaction_type_pb.rb +0 -25
- data/lib/gen/temporal/api/interaction/v1/message_pb.rb +0 -49
- data/lib/gen/temporal/sdk/core/bridge/bridge_pb.rb +0 -222
@@ -12,7 +12,10 @@ mod history_info;
|
|
12
12
|
mod task_token;
|
13
13
|
|
14
14
|
#[cfg(feature = "history_builders")]
|
15
|
-
pub use history_builder::{
|
15
|
+
pub use history_builder::{
|
16
|
+
default_act_sched, default_wes_attribs, TestHistoryBuilder, DEFAULT_ACTIVITY_TYPE,
|
17
|
+
DEFAULT_WORKFLOW_TYPE,
|
18
|
+
};
|
16
19
|
#[cfg(feature = "history_builders")]
|
17
20
|
pub use history_info::HistoryInfo;
|
18
21
|
pub use task_token::TaskToken;
|
@@ -26,7 +29,8 @@ pub mod coresdk {
|
|
26
29
|
tonic::include_proto!("coresdk");
|
27
30
|
|
28
31
|
use crate::temporal::api::{
|
29
|
-
common::v1::{
|
32
|
+
common::v1::{Payload, Payloads, WorkflowExecution},
|
33
|
+
enums::v1::WorkflowTaskFailedCause,
|
30
34
|
failure::v1::{failure::FailureInfo, ApplicationFailureInfo, Failure},
|
31
35
|
workflowservice::v1::PollActivityTaskQueueResponse,
|
32
36
|
};
|
@@ -67,7 +71,7 @@ pub mod coresdk {
|
|
67
71
|
fmt_tt(&self.task_token),
|
68
72
|
)?;
|
69
73
|
if let Some(r) = self.result.as_ref().and_then(|r| r.status.as_ref()) {
|
70
|
-
write!(f, ", {}"
|
74
|
+
write!(f, ", {r}")?;
|
71
75
|
} else {
|
72
76
|
write!(f, ", missing result")?;
|
73
77
|
}
|
@@ -125,13 +129,13 @@ pub mod coresdk {
|
|
125
129
|
write!(f, "ActivityExecutionResult(")?;
|
126
130
|
match self {
|
127
131
|
aer::Status::Completed(v) => {
|
128
|
-
write!(f, "{})"
|
132
|
+
write!(f, "{v})")
|
129
133
|
}
|
130
134
|
aer::Status::Failed(v) => {
|
131
|
-
write!(f, "{})"
|
135
|
+
write!(f, "{v})")
|
132
136
|
}
|
133
137
|
aer::Status::Cancelled(v) => {
|
134
|
-
write!(f, "{})"
|
138
|
+
write!(f, "{v})")
|
135
139
|
}
|
136
140
|
aer::Status::WillCompleteAsync(_) => {
|
137
141
|
write!(f, "Will complete async)")
|
@@ -144,7 +148,7 @@ pub mod coresdk {
|
|
144
148
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
145
149
|
write!(f, "Success(")?;
|
146
150
|
if let Some(ref v) = self.result {
|
147
|
-
write!(f, "{}"
|
151
|
+
write!(f, "{v}")?;
|
148
152
|
}
|
149
153
|
write!(f, ")")
|
150
154
|
}
|
@@ -154,7 +158,7 @@ pub mod coresdk {
|
|
154
158
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
155
159
|
write!(f, "Failure(")?;
|
156
160
|
if let Some(ref v) = self.failure {
|
157
|
-
write!(f, "{}"
|
161
|
+
write!(f, "{v}")?;
|
158
162
|
}
|
159
163
|
write!(f, ")")
|
160
164
|
}
|
@@ -164,7 +168,7 @@ pub mod coresdk {
|
|
164
168
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
165
169
|
write!(f, "Cancellation(")?;
|
166
170
|
if let Some(ref v) = self.failure {
|
167
|
-
write!(f, "{}"
|
171
|
+
write!(f, "{v}")?;
|
168
172
|
}
|
169
173
|
write!(f, ")")
|
170
174
|
}
|
@@ -185,7 +189,7 @@ pub mod coresdk {
|
|
185
189
|
pub fn unwrap_ok_payload(self) -> Payload {
|
186
190
|
match self.status.unwrap() {
|
187
191
|
activity_resolution::Status::Completed(c) => c.result.unwrap(),
|
188
|
-
|
192
|
+
e => panic!("Activity was not successful: {e:?}"),
|
189
193
|
}
|
190
194
|
}
|
191
195
|
|
@@ -317,7 +321,7 @@ pub mod coresdk {
|
|
317
321
|
}
|
318
322
|
|
319
323
|
pub mod external_data {
|
320
|
-
use
|
324
|
+
use prost_wkt_types::{Duration, Timestamp};
|
321
325
|
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
322
326
|
tonic::include_proto!("coresdk.external_data");
|
323
327
|
|
@@ -396,6 +400,7 @@ pub mod coresdk {
|
|
396
400
|
},
|
397
401
|
temporal::api::{
|
398
402
|
common::v1::Header,
|
403
|
+
enums::v1::WorkflowTaskFailedCause,
|
399
404
|
history::v1::{
|
400
405
|
WorkflowExecutionCancelRequestedEventAttributes,
|
401
406
|
WorkflowExecutionSignaledEventAttributes,
|
@@ -404,7 +409,7 @@ pub mod coresdk {
|
|
404
409
|
query::v1::WorkflowQuery,
|
405
410
|
},
|
406
411
|
};
|
407
|
-
use
|
412
|
+
use prost_wkt_types::Timestamp;
|
408
413
|
use std::{
|
409
414
|
collections::HashMap,
|
410
415
|
fmt::{Display, Formatter},
|
@@ -428,6 +433,7 @@ pub mod coresdk {
|
|
428
433
|
reason: reason as i32,
|
429
434
|
}),
|
430
435
|
)],
|
436
|
+
available_internal_flags: vec![],
|
431
437
|
}
|
432
438
|
}
|
433
439
|
|
@@ -491,7 +497,18 @@ pub mod coresdk {
|
|
491
497
|
|
492
498
|
impl Display for EvictionReason {
|
493
499
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
494
|
-
write!(f, "{:?}"
|
500
|
+
write!(f, "{self:?}")
|
501
|
+
}
|
502
|
+
}
|
503
|
+
|
504
|
+
impl From<EvictionReason> for WorkflowTaskFailedCause {
|
505
|
+
fn from(value: EvictionReason) -> Self {
|
506
|
+
match value {
|
507
|
+
EvictionReason::Nondeterminism => {
|
508
|
+
WorkflowTaskFailedCause::NonDeterministicError
|
509
|
+
}
|
510
|
+
_ => WorkflowTaskFailedCause::Unspecified,
|
511
|
+
}
|
495
512
|
}
|
496
513
|
}
|
497
514
|
|
@@ -517,7 +534,7 @@ pub mod coresdk {
|
|
517
534
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
518
535
|
match &self.variant {
|
519
536
|
None => write!(f, "empty"),
|
520
|
-
Some(v) => write!(f, "{}"
|
537
|
+
Some(v) => write!(f, "{v}"),
|
521
538
|
}
|
522
539
|
}
|
523
540
|
}
|
@@ -640,7 +657,7 @@ pub mod coresdk {
|
|
640
657
|
}
|
641
658
|
|
642
659
|
pub mod workflow_completion {
|
643
|
-
use crate::temporal::api::failure;
|
660
|
+
use crate::temporal::api::{enums::v1::WorkflowTaskFailedCause, failure};
|
644
661
|
tonic::include_proto!("coresdk.workflow_completion");
|
645
662
|
|
646
663
|
impl workflow_activation_completion::Status {
|
@@ -654,7 +671,10 @@ pub mod coresdk {
|
|
654
671
|
|
655
672
|
impl From<failure::v1::Failure> for Failure {
|
656
673
|
fn from(f: failure::v1::Failure) -> Self {
|
657
|
-
Failure {
|
674
|
+
Failure {
|
675
|
+
failure: Some(f),
|
676
|
+
force_cause: WorkflowTaskFailedCause::Unspecified as i32,
|
677
|
+
}
|
658
678
|
}
|
659
679
|
}
|
660
680
|
}
|
@@ -673,7 +693,7 @@ pub mod coresdk {
|
|
673
693
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
674
694
|
match &self.variant {
|
675
695
|
None => write!(f, "Empty"),
|
676
|
-
Some(v) => write!(f, "{}"
|
696
|
+
Some(v) => write!(f, "{v}"),
|
677
697
|
}
|
678
698
|
}
|
679
699
|
}
|
@@ -853,7 +873,10 @@ pub mod coresdk {
|
|
853
873
|
|
854
874
|
impl From<Vec<WorkflowCommand>> for workflow_completion::Success {
|
855
875
|
fn from(v: Vec<WorkflowCommand>) -> Self {
|
856
|
-
Self {
|
876
|
+
Self {
|
877
|
+
commands: v,
|
878
|
+
used_internal_flags: vec![],
|
879
|
+
}
|
857
880
|
}
|
858
881
|
}
|
859
882
|
|
@@ -907,6 +930,7 @@ pub mod coresdk {
|
|
907
930
|
status: Some(workflow_activation_completion::Status::Failed(
|
908
931
|
workflow_completion::Failure {
|
909
932
|
failure: Some(failure),
|
933
|
+
force_cause: WorkflowTaskFailedCause::Unspecified as i32,
|
910
934
|
},
|
911
935
|
)),
|
912
936
|
}
|
@@ -990,6 +1014,12 @@ pub mod coresdk {
|
|
990
1014
|
}
|
991
1015
|
false
|
992
1016
|
}
|
1017
|
+
|
1018
|
+
pub fn add_internal_flags(&mut self, patch: u32) {
|
1019
|
+
if let Some(workflow_activation_completion::Status::Successful(s)) = &mut self.status {
|
1020
|
+
s.used_internal_flags.push(patch);
|
1021
|
+
}
|
1022
|
+
}
|
993
1023
|
}
|
994
1024
|
|
995
1025
|
/// Makes converting outgoing lang commands into [WorkflowActivationCompletion]s easier
|
@@ -1027,7 +1057,7 @@ pub mod coresdk {
|
|
1027
1057
|
)?;
|
1028
1058
|
match &self.status {
|
1029
1059
|
None => write!(f, "empty")?,
|
1030
|
-
Some(s) => write!(f, "{}"
|
1060
|
+
Some(s) => write!(f, "{s}")?,
|
1031
1061
|
};
|
1032
1062
|
write!(f, ")")
|
1033
1063
|
}
|
@@ -1037,12 +1067,12 @@ pub mod coresdk {
|
|
1037
1067
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
1038
1068
|
match self {
|
1039
1069
|
workflow_activation_completion::Status::Successful(
|
1040
|
-
workflow_completion::Success { commands },
|
1070
|
+
workflow_completion::Success { commands, .. },
|
1041
1071
|
) => {
|
1042
1072
|
write!(f, "Success(")?;
|
1043
1073
|
let mut written = 0;
|
1044
1074
|
for c in commands {
|
1045
|
-
write!(f, "{} "
|
1075
|
+
write!(f, "{c} ")?;
|
1046
1076
|
written += 1;
|
1047
1077
|
if written >= 10 && written < commands.len() {
|
1048
1078
|
write!(f, "... {} more", commands.len() - written)?;
|
@@ -1094,18 +1124,6 @@ pub mod coresdk {
|
|
1094
1124
|
}
|
1095
1125
|
}
|
1096
1126
|
|
1097
|
-
impl From<String> for ActivityType {
|
1098
|
-
fn from(name: String) -> Self {
|
1099
|
-
Self { name }
|
1100
|
-
}
|
1101
|
-
}
|
1102
|
-
|
1103
|
-
impl From<ActivityType> for String {
|
1104
|
-
fn from(at: ActivityType) -> Self {
|
1105
|
-
at.name
|
1106
|
-
}
|
1107
|
-
}
|
1108
|
-
|
1109
1127
|
impl Failure {
|
1110
1128
|
pub fn is_timeout(&self) -> Option<crate::temporal::api::enums::v1::TimeoutType> {
|
1111
1129
|
match &self.failure_info {
|
@@ -1127,6 +1145,26 @@ pub mod coresdk {
|
|
1127
1145
|
}
|
1128
1146
|
}
|
1129
1147
|
|
1148
|
+
pub fn application_failure_from_error(ae: anyhow::Error, non_retryable: bool) -> Self {
|
1149
|
+
Self {
|
1150
|
+
failure_info: Some(FailureInfo::ApplicationFailureInfo(
|
1151
|
+
ApplicationFailureInfo {
|
1152
|
+
non_retryable,
|
1153
|
+
..Default::default()
|
1154
|
+
},
|
1155
|
+
)),
|
1156
|
+
..ae.chain()
|
1157
|
+
.rfold(None, |cause, e| {
|
1158
|
+
Some(Self {
|
1159
|
+
message: e.to_string(),
|
1160
|
+
cause: cause.map(Box::new),
|
1161
|
+
..Default::default()
|
1162
|
+
})
|
1163
|
+
})
|
1164
|
+
.unwrap_or_default()
|
1165
|
+
}
|
1166
|
+
}
|
1167
|
+
|
1130
1168
|
/// Extracts an ApplicationFailureInfo from a Failure instance if it exists
|
1131
1169
|
pub fn maybe_application_failure(&self) -> Option<&ApplicationFailureInfo> {
|
1132
1170
|
if let Failure {
|
@@ -1197,22 +1235,7 @@ pub mod coresdk {
|
|
1197
1235
|
|
1198
1236
|
impl From<anyhow::Error> for Failure {
|
1199
1237
|
fn from(ae: anyhow::Error) -> Self {
|
1200
|
-
|
1201
|
-
failure_info: Some(FailureInfo::ApplicationFailureInfo(
|
1202
|
-
ApplicationFailureInfo {
|
1203
|
-
..Default::default()
|
1204
|
-
},
|
1205
|
-
)),
|
1206
|
-
..ae.chain()
|
1207
|
-
.rfold(None, |cause, e| {
|
1208
|
-
Some(Self {
|
1209
|
-
message: e.to_string(),
|
1210
|
-
cause: cause.map(Box::new),
|
1211
|
-
..Default::default()
|
1212
|
-
})
|
1213
|
-
})
|
1214
|
-
.unwrap_or_default()
|
1215
|
-
}
|
1238
|
+
Failure::application_failure_from_error(ae, false)
|
1216
1239
|
}
|
1217
1240
|
}
|
1218
1241
|
|
@@ -1568,6 +1591,7 @@ pub mod temporal {
|
|
1568
1591
|
}
|
1569
1592
|
pub mod common {
|
1570
1593
|
pub mod v1 {
|
1594
|
+
use base64::{prelude::BASE64_STANDARD, Engine};
|
1571
1595
|
use std::{
|
1572
1596
|
collections::HashMap,
|
1573
1597
|
fmt::{Display, Formatter},
|
@@ -1604,11 +1628,11 @@ pub mod temporal {
|
|
1604
1628
|
write!(
|
1605
1629
|
f,
|
1606
1630
|
"[{}..{}]",
|
1607
|
-
|
1608
|
-
|
1631
|
+
BASE64_STANDARD.encode(windows.next().unwrap_or_default()),
|
1632
|
+
BASE64_STANDARD.encode(windows.next_back().unwrap_or_default())
|
1609
1633
|
)
|
1610
1634
|
} else {
|
1611
|
-
write!(f, "[{}]",
|
1635
|
+
write!(f, "[{}]", BASE64_STANDARD.encode(&self.data))
|
1612
1636
|
}
|
1613
1637
|
}
|
1614
1638
|
}
|
@@ -1652,6 +1676,26 @@ pub mod temporal {
|
|
1652
1676
|
}
|
1653
1677
|
}
|
1654
1678
|
}
|
1679
|
+
|
1680
|
+
impl From<String> for ActivityType {
|
1681
|
+
fn from(name: String) -> Self {
|
1682
|
+
Self { name }
|
1683
|
+
}
|
1684
|
+
}
|
1685
|
+
|
1686
|
+
impl From<&str> for ActivityType {
|
1687
|
+
fn from(name: &str) -> Self {
|
1688
|
+
Self {
|
1689
|
+
name: name.to_string(),
|
1690
|
+
}
|
1691
|
+
}
|
1692
|
+
}
|
1693
|
+
|
1694
|
+
impl From<ActivityType> for String {
|
1695
|
+
fn from(at: ActivityType) -> Self {
|
1696
|
+
at.name
|
1697
|
+
}
|
1698
|
+
}
|
1655
1699
|
}
|
1656
1700
|
}
|
1657
1701
|
pub mod enums {
|
@@ -1717,6 +1761,7 @@ pub mod temporal {
|
|
1717
1761
|
| EventType::TimerCanceled
|
1718
1762
|
| EventType::TimerStarted
|
1719
1763
|
| EventType::UpsertWorkflowSearchAttributes
|
1764
|
+
| EventType::WorkflowPropertiesModified
|
1720
1765
|
| EventType::WorkflowExecutionCanceled
|
1721
1766
|
| EventType::WorkflowExecutionCompleted
|
1722
1767
|
| EventType::WorkflowExecutionContinuedAsNew
|
@@ -1775,6 +1820,15 @@ pub mod temporal {
|
|
1775
1820
|
_ => false,
|
1776
1821
|
}
|
1777
1822
|
}
|
1823
|
+
|
1824
|
+
pub fn is_wft_closed_event(&self) -> bool {
|
1825
|
+
match self.event_type() {
|
1826
|
+
EventType::WorkflowTaskCompleted => true,
|
1827
|
+
EventType::WorkflowTaskFailed => true,
|
1828
|
+
EventType::WorkflowTaskTimedOut => true,
|
1829
|
+
_ => false,
|
1830
|
+
}
|
1831
|
+
}
|
1778
1832
|
}
|
1779
1833
|
|
1780
1834
|
impl Display for HistoryEvent {
|
@@ -1787,11 +1841,60 @@ pub mod temporal {
|
|
1787
1841
|
)
|
1788
1842
|
}
|
1789
1843
|
}
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1844
|
+
|
1845
|
+
impl Attributes {
|
1846
|
+
pub fn event_type(&self) -> EventType {
|
1847
|
+
// I just absolutely _love_ this
|
1848
|
+
match self {
|
1849
|
+
Attributes::WorkflowExecutionStartedEventAttributes(_) => {EventType::WorkflowExecutionStarted}
|
1850
|
+
Attributes::WorkflowExecutionCompletedEventAttributes(_) => {EventType::WorkflowExecutionCompleted}
|
1851
|
+
Attributes::WorkflowExecutionFailedEventAttributes(_) => {EventType::WorkflowExecutionFailed}
|
1852
|
+
Attributes::WorkflowExecutionTimedOutEventAttributes(_) => {EventType::WorkflowExecutionTimedOut}
|
1853
|
+
Attributes::WorkflowTaskScheduledEventAttributes(_) => {EventType::WorkflowTaskScheduled}
|
1854
|
+
Attributes::WorkflowTaskStartedEventAttributes(_) => {EventType::WorkflowTaskStarted}
|
1855
|
+
Attributes::WorkflowTaskCompletedEventAttributes(_) => {EventType::WorkflowTaskCompleted}
|
1856
|
+
Attributes::WorkflowTaskTimedOutEventAttributes(_) => {EventType::WorkflowTaskTimedOut}
|
1857
|
+
Attributes::WorkflowTaskFailedEventAttributes(_) => {EventType::WorkflowTaskFailed}
|
1858
|
+
Attributes::ActivityTaskScheduledEventAttributes(_) => {EventType::ActivityTaskScheduled}
|
1859
|
+
Attributes::ActivityTaskStartedEventAttributes(_) => {EventType::ActivityTaskStarted}
|
1860
|
+
Attributes::ActivityTaskCompletedEventAttributes(_) => {EventType::ActivityTaskCompleted}
|
1861
|
+
Attributes::ActivityTaskFailedEventAttributes(_) => {EventType::ActivityTaskFailed}
|
1862
|
+
Attributes::ActivityTaskTimedOutEventAttributes(_) => {EventType::ActivityTaskTimedOut}
|
1863
|
+
Attributes::TimerStartedEventAttributes(_) => {EventType::TimerStarted}
|
1864
|
+
Attributes::TimerFiredEventAttributes(_) => {EventType::TimerFired}
|
1865
|
+
Attributes::ActivityTaskCancelRequestedEventAttributes(_) => {EventType::ActivityTaskCancelRequested}
|
1866
|
+
Attributes::ActivityTaskCanceledEventAttributes(_) => {EventType::ActivityTaskCanceled}
|
1867
|
+
Attributes::TimerCanceledEventAttributes(_) => {EventType::TimerCanceled}
|
1868
|
+
Attributes::MarkerRecordedEventAttributes(_) => {EventType::MarkerRecorded}
|
1869
|
+
Attributes::WorkflowExecutionSignaledEventAttributes(_) => {EventType::WorkflowExecutionSignaled}
|
1870
|
+
Attributes::WorkflowExecutionTerminatedEventAttributes(_) => {EventType::WorkflowExecutionTerminated}
|
1871
|
+
Attributes::WorkflowExecutionCancelRequestedEventAttributes(_) => {EventType::WorkflowExecutionCancelRequested}
|
1872
|
+
Attributes::WorkflowExecutionCanceledEventAttributes(_) => {EventType::WorkflowExecutionCanceled}
|
1873
|
+
Attributes::RequestCancelExternalWorkflowExecutionInitiatedEventAttributes(_) => {EventType::RequestCancelExternalWorkflowExecutionInitiated}
|
1874
|
+
Attributes::RequestCancelExternalWorkflowExecutionFailedEventAttributes(_) => {EventType::RequestCancelExternalWorkflowExecutionFailed}
|
1875
|
+
Attributes::ExternalWorkflowExecutionCancelRequestedEventAttributes(_) => {EventType::ExternalWorkflowExecutionCancelRequested}
|
1876
|
+
Attributes::WorkflowExecutionContinuedAsNewEventAttributes(_) => {EventType::WorkflowExecutionContinuedAsNew}
|
1877
|
+
Attributes::StartChildWorkflowExecutionInitiatedEventAttributes(_) => {EventType::StartChildWorkflowExecutionInitiated}
|
1878
|
+
Attributes::StartChildWorkflowExecutionFailedEventAttributes(_) => {EventType::StartChildWorkflowExecutionFailed}
|
1879
|
+
Attributes::ChildWorkflowExecutionStartedEventAttributes(_) => {EventType::ChildWorkflowExecutionStarted}
|
1880
|
+
Attributes::ChildWorkflowExecutionCompletedEventAttributes(_) => {EventType::ChildWorkflowExecutionCompleted}
|
1881
|
+
Attributes::ChildWorkflowExecutionFailedEventAttributes(_) => {EventType::ChildWorkflowExecutionFailed}
|
1882
|
+
Attributes::ChildWorkflowExecutionCanceledEventAttributes(_) => {EventType::ChildWorkflowExecutionCanceled}
|
1883
|
+
Attributes::ChildWorkflowExecutionTimedOutEventAttributes(_) => {EventType::ChildWorkflowExecutionTimedOut}
|
1884
|
+
Attributes::ChildWorkflowExecutionTerminatedEventAttributes(_) => {EventType::ChildWorkflowExecutionTerminated}
|
1885
|
+
Attributes::SignalExternalWorkflowExecutionInitiatedEventAttributes(_) => {EventType::SignalExternalWorkflowExecutionInitiated}
|
1886
|
+
Attributes::SignalExternalWorkflowExecutionFailedEventAttributes(_) => {EventType::SignalExternalWorkflowExecutionFailed}
|
1887
|
+
Attributes::ExternalWorkflowExecutionSignaledEventAttributes(_) => {EventType::ExternalWorkflowExecutionSignaled}
|
1888
|
+
Attributes::UpsertWorkflowSearchAttributesEventAttributes(_) => {EventType::UpsertWorkflowSearchAttributes}
|
1889
|
+
Attributes::WorkflowExecutionUpdateRejectedEventAttributes(_) => {EventType::WorkflowExecutionUpdateRejected}
|
1890
|
+
Attributes::WorkflowExecutionUpdateAcceptedEventAttributes(_) => {EventType::WorkflowExecutionUpdateAccepted}
|
1891
|
+
Attributes::WorkflowExecutionUpdateCompletedEventAttributes(_) => {EventType::WorkflowExecutionUpdateCompleted}
|
1892
|
+
Attributes::WorkflowPropertiesModifiedExternallyEventAttributes(_) => {EventType::WorkflowPropertiesModifiedExternally}
|
1893
|
+
Attributes::ActivityPropertiesModifiedExternallyEventAttributes(_) => {EventType::ActivityPropertiesModifiedExternally}
|
1894
|
+
Attributes::WorkflowPropertiesModifiedEventAttributes(_) => {EventType::WorkflowPropertiesModified}
|
1895
|
+
}
|
1896
|
+
}
|
1897
|
+
}
|
1795
1898
|
}
|
1796
1899
|
}
|
1797
1900
|
pub mod namespace {
|
@@ -1804,6 +1907,11 @@ pub mod temporal {
|
|
1804
1907
|
tonic::include_proto!("temporal.api.operatorservice.v1");
|
1805
1908
|
}
|
1806
1909
|
}
|
1910
|
+
pub mod protocol {
|
1911
|
+
pub mod v1 {
|
1912
|
+
tonic::include_proto!("temporal.api.protocol.v1");
|
1913
|
+
}
|
1914
|
+
}
|
1807
1915
|
pub mod query {
|
1808
1916
|
pub mod v1 {
|
1809
1917
|
tonic::include_proto!("temporal.api.query.v1");
|
@@ -1819,6 +1927,11 @@ pub mod temporal {
|
|
1819
1927
|
tonic::include_proto!("temporal.api.schedule.v1");
|
1820
1928
|
}
|
1821
1929
|
}
|
1930
|
+
pub mod sdk {
|
1931
|
+
pub mod v1 {
|
1932
|
+
tonic::include_proto!("temporal.api.sdk.v1");
|
1933
|
+
}
|
1934
|
+
}
|
1822
1935
|
pub mod taskqueue {
|
1823
1936
|
pub mod v1 {
|
1824
1937
|
use crate::temporal::api::enums::v1::TaskQueueKind;
|
@@ -1839,6 +1952,11 @@ pub mod temporal {
|
|
1839
1952
|
tonic::include_proto!("temporal.api.testservice.v1");
|
1840
1953
|
}
|
1841
1954
|
}
|
1955
|
+
pub mod update {
|
1956
|
+
pub mod v1 {
|
1957
|
+
tonic::include_proto!("temporal.api.update.v1");
|
1958
|
+
}
|
1959
|
+
}
|
1842
1960
|
pub mod version {
|
1843
1961
|
pub mod v1 {
|
1844
1962
|
tonic::include_proto!("temporal.api.version.v1");
|
@@ -1,8 +1,18 @@
|
|
1
|
+
use base64::{prelude::BASE64_STANDARD, Engine};
|
1
2
|
use std::fmt::{Debug, Display, Formatter};
|
2
3
|
|
3
4
|
static LOCAL_ACT_TASK_TOKEN_PREFIX: &[u8] = b"local_act_";
|
4
5
|
|
5
|
-
#[derive(
|
6
|
+
#[derive(
|
7
|
+
Hash,
|
8
|
+
Eq,
|
9
|
+
PartialEq,
|
10
|
+
Clone,
|
11
|
+
derive_more::From,
|
12
|
+
derive_more::Into,
|
13
|
+
serde::Serialize,
|
14
|
+
serde::Deserialize,
|
15
|
+
)]
|
6
16
|
/// Type-safe wrapper for task token bytes
|
7
17
|
pub struct TaskToken(pub Vec<u8>);
|
8
18
|
|
@@ -34,5 +44,5 @@ impl Debug for TaskToken {
|
|
34
44
|
}
|
35
45
|
|
36
46
|
pub fn fmt_tt(tt: &[u8]) -> String {
|
37
|
-
|
47
|
+
BASE64_STANDARD.encode(tt)
|
38
48
|
}
|
@@ -11,7 +11,8 @@ path = "src/histfetch.rs"
|
|
11
11
|
[dependencies]
|
12
12
|
anyhow = "1.0"
|
13
13
|
async-trait = "0.1"
|
14
|
-
base64 = "0.
|
14
|
+
base64 = "0.21"
|
15
|
+
bytes = "1.3"
|
15
16
|
futures = "0.3"
|
16
17
|
log = "0.4"
|
17
18
|
once_cell = "1.16"
|
@@ -19,6 +20,7 @@ parking_lot = "0.12"
|
|
19
20
|
prost = "0.11"
|
20
21
|
prost-types = "0.11"
|
21
22
|
rand = "0.8"
|
23
|
+
rmp-serde = "1.1"
|
22
24
|
serde_json = "1.0"
|
23
25
|
temporal-client = { path = "../client" }
|
24
26
|
temporal-sdk = { path = "../sdk" }
|