@temporalio/core-bridge 0.16.4 → 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.
- package/Cargo.lock +339 -226
- package/Cargo.toml +7 -3
- package/common.js +50 -0
- package/index.d.ts +7 -0
- package/index.js +12 -0
- package/package.json +7 -4
- package/releases/aarch64-apple-darwin/index.node +0 -0
- package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
- package/{index.node → releases/index.node} +0 -0
- package/releases/x86_64-apple-darwin/index.node +0 -0
- package/releases/x86_64-pc-windows-msvc/index.node +0 -0
- package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
- package/scripts/build.js +10 -50
- package/sdk-core/.buildkite/docker/Dockerfile +1 -1
- package/sdk-core/.buildkite/docker/docker-compose.yaml +2 -2
- package/sdk-core/.buildkite/pipeline.yml +2 -0
- package/sdk-core/Cargo.toml +1 -88
- package/sdk-core/README.md +30 -6
- package/sdk-core/bridge-ffi/Cargo.toml +24 -0
- package/sdk-core/bridge-ffi/LICENSE.txt +23 -0
- package/sdk-core/bridge-ffi/build.rs +25 -0
- package/sdk-core/bridge-ffi/include/sdk-core-bridge.h +216 -0
- package/sdk-core/bridge-ffi/src/lib.rs +829 -0
- package/sdk-core/bridge-ffi/src/wrappers.rs +193 -0
- package/sdk-core/client/Cargo.toml +32 -0
- package/sdk-core/{src/pollers/gateway.rs → client/src/lib.rs} +101 -195
- package/sdk-core/client/src/metrics.rs +89 -0
- package/sdk-core/client/src/mocks.rs +167 -0
- package/sdk-core/{src/pollers → client/src}/retry.rs +172 -14
- package/sdk-core/core/Cargo.toml +96 -0
- package/sdk-core/{src → core/src}/core_tests/activity_tasks.rs +193 -37
- package/sdk-core/{src → core/src}/core_tests/child_workflows.rs +14 -14
- package/sdk-core/{src → core/src}/core_tests/determinism.rs +8 -8
- package/sdk-core/core/src/core_tests/local_activities.rs +328 -0
- package/sdk-core/{src → core/src}/core_tests/mod.rs +6 -9
- package/sdk-core/{src → core/src}/core_tests/queries.rs +54 -54
- package/sdk-core/{src → core/src}/core_tests/replay_flag.rs +8 -12
- package/sdk-core/{src → core/src}/core_tests/workers.rs +120 -33
- package/sdk-core/{src → core/src}/core_tests/workflow_cancels.rs +16 -26
- package/sdk-core/{src → core/src}/core_tests/workflow_tasks.rs +280 -292
- package/sdk-core/core/src/lib.rs +374 -0
- package/sdk-core/{src → core/src}/log_export.rs +3 -27
- package/sdk-core/core/src/pending_activations.rs +162 -0
- package/sdk-core/{src → core/src}/pollers/mod.rs +4 -22
- package/sdk-core/{src → core/src}/pollers/poll_buffer.rs +1 -1
- package/sdk-core/core/src/protosext/mod.rs +396 -0
- package/sdk-core/core/src/replay/mod.rs +210 -0
- package/sdk-core/core/src/retry_logic.rs +144 -0
- package/sdk-core/{src → core/src}/telemetry/metrics.rs +3 -58
- package/sdk-core/{src → core/src}/telemetry/mod.rs +8 -8
- package/sdk-core/{src → core/src}/telemetry/prometheus_server.rs +0 -0
- package/sdk-core/{src → core/src}/test_help/mod.rs +35 -83
- package/sdk-core/{src → core/src}/worker/activities/activity_heartbeat_manager.rs +95 -42
- package/sdk-core/core/src/worker/activities/local_activities.rs +973 -0
- package/sdk-core/{src → core/src}/worker/activities.rs +52 -33
- package/sdk-core/{src → core/src}/worker/dispatcher.rs +8 -6
- package/sdk-core/{src → core/src}/worker/mod.rs +347 -221
- package/sdk-core/core/src/worker/wft_delivery.rs +81 -0
- package/sdk-core/{src → core/src}/workflow/bridge.rs +5 -2
- package/sdk-core/{src → core/src}/workflow/driven_workflow.rs +17 -7
- package/sdk-core/{src → core/src}/workflow/history_update.rs +33 -7
- package/sdk-core/{src → core/src/workflow}/machines/activity_state_machine.rs +26 -26
- package/sdk-core/{src → core/src/workflow}/machines/cancel_external_state_machine.rs +8 -11
- package/sdk-core/{src → core/src/workflow}/machines/cancel_workflow_state_machine.rs +19 -21
- package/sdk-core/{src → core/src/workflow}/machines/child_workflow_state_machine.rs +20 -31
- package/sdk-core/{src → core/src/workflow}/machines/complete_workflow_state_machine.rs +3 -5
- package/sdk-core/{src → core/src/workflow}/machines/continue_as_new_workflow_state_machine.rs +18 -18
- package/sdk-core/{src → core/src/workflow}/machines/fail_workflow_state_machine.rs +5 -6
- package/sdk-core/core/src/workflow/machines/local_activity_state_machine.rs +1451 -0
- package/sdk-core/{src → core/src/workflow}/machines/mod.rs +54 -107
- package/sdk-core/{src → core/src/workflow}/machines/mutable_side_effect_state_machine.rs +0 -0
- package/sdk-core/{src → core/src/workflow}/machines/patch_state_machine.rs +29 -30
- package/sdk-core/{src → core/src/workflow}/machines/side_effect_state_machine.rs +0 -0
- package/sdk-core/{src → core/src/workflow}/machines/signal_external_state_machine.rs +17 -19
- package/sdk-core/{src → core/src/workflow}/machines/timer_state_machine.rs +20 -21
- package/sdk-core/{src → core/src/workflow}/machines/transition_coverage.rs +5 -2
- package/sdk-core/{src → core/src/workflow}/machines/upsert_search_attributes_state_machine.rs +0 -0
- package/sdk-core/core/src/workflow/machines/workflow_machines/local_acts.rs +96 -0
- package/sdk-core/{src → core/src/workflow}/machines/workflow_machines.rs +357 -171
- package/sdk-core/{src → core/src/workflow}/machines/workflow_task_state_machine.rs +1 -1
- package/sdk-core/{src → core/src}/workflow/mod.rs +200 -39
- package/sdk-core/{src → core/src}/workflow/workflow_tasks/cache_manager.rs +0 -0
- package/sdk-core/{src → core/src}/workflow/workflow_tasks/concurrency_manager.rs +38 -5
- package/sdk-core/{src → core/src}/workflow/workflow_tasks/mod.rs +317 -103
- package/sdk-core/{test_utils → core-api}/Cargo.toml +10 -7
- package/sdk-core/{src → core-api/src}/errors.rs +42 -92
- package/sdk-core/core-api/src/lib.rs +158 -0
- package/sdk-core/{src/worker/config.rs → core-api/src/worker.rs} +18 -23
- package/sdk-core/etc/deps.svg +156 -0
- package/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +5 -5
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +3 -5
- package/sdk-core/fsm/rustfsm_trait/src/lib.rs +7 -1
- package/sdk-core/histories/fail_wf_task.bin +0 -0
- package/sdk-core/histories/timer_workflow_history.bin +0 -0
- package/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +44 -13
- package/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +19 -1
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/common.proto +1 -1
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +9 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/namespace.proto +1 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/reset.proto +1 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +13 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/workflow.proto +14 -7
- package/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +176 -18
- package/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +6 -0
- package/sdk-core/protos/api_upstream/temporal/api/query/v1/message.proto +11 -0
- package/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +3 -0
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +156 -7
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +135 -104
- package/sdk-core/protos/local/temporal/sdk/core/activity_result/activity_result.proto +78 -0
- package/sdk-core/protos/local/temporal/sdk/core/activity_task/activity_task.proto +78 -0
- package/sdk-core/protos/local/temporal/sdk/core/bridge/bridge.proto +205 -0
- package/sdk-core/protos/local/temporal/sdk/core/bridge/service.proto +61 -0
- package/sdk-core/protos/local/{child_workflow.proto → temporal/sdk/core/child_workflow/child_workflow.proto} +1 -1
- package/sdk-core/protos/local/{common.proto → temporal/sdk/core/common/common.proto} +5 -3
- package/sdk-core/protos/local/{core_interface.proto → temporal/sdk/core/core_interface.proto} +10 -10
- package/sdk-core/protos/local/temporal/sdk/core/external_data/external_data.proto +30 -0
- package/sdk-core/protos/local/{workflow_activation.proto → temporal/sdk/core/workflow_activation/workflow_activation.proto} +35 -11
- package/sdk-core/protos/local/{workflow_commands.proto → temporal/sdk/core/workflow_commands/workflow_commands.proto} +55 -4
- package/sdk-core/protos/local/{workflow_completion.proto → temporal/sdk/core/workflow_completion/workflow_completion.proto} +3 -3
- package/sdk-core/sdk/Cargo.toml +32 -0
- package/sdk-core/{src/prototype_rust_sdk → sdk/src}/conversions.rs +0 -0
- package/sdk-core/sdk/src/lib.rs +699 -0
- package/sdk-core/sdk/src/payload_converter.rs +11 -0
- package/sdk-core/sdk/src/workflow_context/options.rs +180 -0
- package/sdk-core/{src/prototype_rust_sdk → sdk/src}/workflow_context.rs +201 -124
- package/sdk-core/{src/prototype_rust_sdk → sdk/src}/workflow_future.rs +63 -30
- package/sdk-core/sdk-core-protos/Cargo.toml +10 -0
- package/sdk-core/sdk-core-protos/build.rs +28 -6
- package/sdk-core/sdk-core-protos/src/constants.rs +7 -0
- package/sdk-core/{src/test_help → sdk-core-protos/src}/history_builder.rs +134 -49
- package/sdk-core/sdk-core-protos/src/history_info.rs +216 -0
- package/sdk-core/sdk-core-protos/src/lib.rs +601 -168
- package/sdk-core/sdk-core-protos/src/task_token.rs +38 -0
- package/sdk-core/sdk-core-protos/src/utilities.rs +14 -0
- package/sdk-core/test-utils/Cargo.toml +32 -0
- package/sdk-core/{src/test_help → test-utils/src}/canned_histories.rs +59 -78
- package/sdk-core/test-utils/src/histfetch.rs +28 -0
- package/sdk-core/{test_utils → test-utils}/src/lib.rs +131 -68
- package/sdk-core/tests/integ_tests/client_tests.rs +1 -1
- package/sdk-core/tests/integ_tests/heartbeat_tests.rs +11 -7
- package/sdk-core/tests/integ_tests/polling_tests.rs +12 -11
- package/sdk-core/tests/integ_tests/queries_tests.rs +82 -78
- package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +91 -71
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +3 -4
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +2 -4
- package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +4 -6
- package/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +4 -6
- package/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +3 -4
- package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +496 -0
- package/sdk-core/tests/integ_tests/workflow_tests/patches.rs +5 -8
- package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +125 -0
- package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +7 -13
- package/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +33 -5
- package/sdk-core/tests/integ_tests/workflow_tests/timers.rs +12 -16
- package/sdk-core/tests/integ_tests/workflow_tests.rs +85 -82
- package/sdk-core/tests/load_tests.rs +6 -6
- package/sdk-core/tests/main.rs +2 -2
- package/src/conversions.rs +24 -21
- package/src/errors.rs +8 -0
- package/src/lib.rs +323 -211
- package/sdk-core/protos/local/activity_result.proto +0 -46
- package/sdk-core/protos/local/activity_task.proto +0 -66
- package/sdk-core/src/core_tests/retry.rs +0 -147
- package/sdk-core/src/lib.rs +0 -403
- package/sdk-core/src/machines/local_activity_state_machine.rs +0 -117
- package/sdk-core/src/pending_activations.rs +0 -249
- package/sdk-core/src/protosext/mod.rs +0 -160
- package/sdk-core/src/prototype_rust_sdk.rs +0 -412
- package/sdk-core/src/task_token.rs +0 -20
- package/sdk-core/src/test_help/history_info.rs +0 -157
|
@@ -67,14 +67,15 @@ fn spawn_save_coverage_at_end() -> SyncSender<(String, CoveredTransition)> {
|
|
|
67
67
|
#[cfg(test)]
|
|
68
68
|
mod machine_coverage_report {
|
|
69
69
|
use super::*;
|
|
70
|
-
use crate::machines::{
|
|
70
|
+
use crate::workflow::machines::{
|
|
71
71
|
activity_state_machine::ActivityMachine,
|
|
72
72
|
cancel_external_state_machine::CancelExternalMachine,
|
|
73
73
|
cancel_workflow_state_machine::CancelWorkflowMachine,
|
|
74
74
|
child_workflow_state_machine::ChildWorkflowMachine,
|
|
75
75
|
complete_workflow_state_machine::CompleteWorkflowMachine,
|
|
76
76
|
continue_as_new_workflow_state_machine::ContinueAsNewWorkflowMachine,
|
|
77
|
-
fail_workflow_state_machine::FailWorkflowMachine,
|
|
77
|
+
fail_workflow_state_machine::FailWorkflowMachine,
|
|
78
|
+
local_activity_state_machine::LocalActivityMachine, patch_state_machine::PatchMachine,
|
|
78
79
|
signal_external_state_machine::SignalExternalMachine, timer_state_machine::TimerMachine,
|
|
79
80
|
workflow_task_state_machine::WorkflowTaskMachine,
|
|
80
81
|
};
|
|
@@ -111,6 +112,7 @@ mod machine_coverage_report {
|
|
|
111
112
|
let mut version = PatchMachine::visualizer().to_owned();
|
|
112
113
|
let mut signal_ext = SignalExternalMachine::visualizer().to_owned();
|
|
113
114
|
let mut cancel_ext = CancelExternalMachine::visualizer().to_owned();
|
|
115
|
+
let mut la_mach = LocalActivityMachine::visualizer().to_owned();
|
|
114
116
|
|
|
115
117
|
// This isn't at all efficient but doesn't need to be.
|
|
116
118
|
// Replace transitions in the vizzes with green color if they are covered.
|
|
@@ -130,6 +132,7 @@ mod machine_coverage_report {
|
|
|
130
132
|
m @ "PatchMachine" => cover_transitions(m, &mut version, coverage),
|
|
131
133
|
m @ "SignalExternalMachine" => cover_transitions(m, &mut signal_ext, coverage),
|
|
132
134
|
m @ "CancelExternalMachine" => cover_transitions(m, &mut cancel_ext, coverage),
|
|
135
|
+
m @ "LocalActivityMachine" => cover_transitions(m, &mut la_mach, coverage),
|
|
133
136
|
m => panic!("Unknown machine {}", m),
|
|
134
137
|
}
|
|
135
138
|
}
|
package/sdk-core/{src → core/src/workflow}/machines/upsert_search_attributes_state_machine.rs
RENAMED
|
File without changes
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
use super::super::{local_activity_state_machine::ResolveDat, WFMachinesError};
|
|
2
|
+
use crate::{
|
|
3
|
+
protosext::{HistoryEventExt, ValidScheduleLA},
|
|
4
|
+
worker::{ExecutingLAId, LocalActRequest, NewLocalAct},
|
|
5
|
+
};
|
|
6
|
+
use std::{
|
|
7
|
+
collections::{HashMap, HashSet},
|
|
8
|
+
time::SystemTime,
|
|
9
|
+
};
|
|
10
|
+
use temporal_sdk_core_protos::{
|
|
11
|
+
coresdk::common::WorkflowExecution, temporal::api::history::v1::HistoryEvent,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
#[derive(Default)]
|
|
15
|
+
pub(super) struct LocalActivityData {
|
|
16
|
+
/// Queued local activity requests which need to be executed
|
|
17
|
+
new_requests: Vec<ValidScheduleLA>,
|
|
18
|
+
/// Queued cancels that need to be dispatched
|
|
19
|
+
cancel_requests: Vec<ExecutingLAId>,
|
|
20
|
+
/// Seq #s of local activities which we have sent to be executed but have not yet resolved
|
|
21
|
+
executing: HashSet<u32>,
|
|
22
|
+
/// Maps local activity sequence numbers to their resolutions as found when looking ahead at
|
|
23
|
+
/// next WFT
|
|
24
|
+
preresolutions: HashMap<u32, ResolveDat>,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
impl LocalActivityData {
|
|
28
|
+
pub(super) fn enqueue(&mut self, act: ValidScheduleLA) {
|
|
29
|
+
self.new_requests.push(act);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
pub(super) fn enqueue_cancel(&mut self, cancel: ExecutingLAId) {
|
|
33
|
+
self.cancel_requests.push(cancel);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
pub(super) fn done_executing(&mut self, seq: u32) {
|
|
37
|
+
// This seems nonsense, but can happen during abandonment
|
|
38
|
+
self.new_requests.retain(|req| req.seq != seq);
|
|
39
|
+
self.executing.remove(&seq);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/// Drain all requests to execute or cancel LAs. Additional info is passed in to be able to
|
|
43
|
+
/// augment the data this struct has to form complete request data.
|
|
44
|
+
pub(super) fn take_all_reqs(
|
|
45
|
+
&mut self,
|
|
46
|
+
wf_type: &str,
|
|
47
|
+
wf_id: &str,
|
|
48
|
+
run_id: &str,
|
|
49
|
+
) -> Vec<LocalActRequest> {
|
|
50
|
+
self.cancel_requests
|
|
51
|
+
.drain(..)
|
|
52
|
+
.map(LocalActRequest::Cancel)
|
|
53
|
+
.chain(self.new_requests.drain(..).map(|sa| {
|
|
54
|
+
self.executing.insert(sa.seq);
|
|
55
|
+
LocalActRequest::New(NewLocalAct {
|
|
56
|
+
schedule_time: sa.original_schedule_time.unwrap_or_else(SystemTime::now),
|
|
57
|
+
schedule_cmd: sa,
|
|
58
|
+
workflow_type: wf_type.to_string(),
|
|
59
|
+
workflow_exec_info: WorkflowExecution {
|
|
60
|
+
workflow_id: wf_id.to_string(),
|
|
61
|
+
run_id: run_id.to_string(),
|
|
62
|
+
},
|
|
63
|
+
})
|
|
64
|
+
}))
|
|
65
|
+
.collect()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/// Returns all outstanding local activities, whether executing or requested and in the queue
|
|
69
|
+
pub(super) fn outstanding_la_count(&self) -> usize {
|
|
70
|
+
self.executing.len() + self.new_requests.len()
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
pub(super) fn process_peekahead_marker(&mut self, e: &HistoryEvent) -> super::Result<()> {
|
|
74
|
+
if let Some(la_dat) = e.clone().into_local_activity_marker_details() {
|
|
75
|
+
self.preresolutions
|
|
76
|
+
.insert(la_dat.marker_dat.seq, la_dat.into());
|
|
77
|
+
} else {
|
|
78
|
+
return Err(WFMachinesError::Fatal(format!(
|
|
79
|
+
"Local activity marker was unparsable: {:?}",
|
|
80
|
+
e
|
|
81
|
+
)));
|
|
82
|
+
}
|
|
83
|
+
Ok(())
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
pub(super) fn take_preresolution(&mut self, seq: u32) -> Option<ResolveDat> {
|
|
87
|
+
self.preresolutions.remove(&seq)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
pub(super) fn remove_from_queue(&mut self, seq: u32) -> Option<ValidScheduleLA> {
|
|
91
|
+
self.new_requests
|
|
92
|
+
.iter()
|
|
93
|
+
.position(|req| req.seq == seq)
|
|
94
|
+
.map(|i| self.new_requests.remove(i))
|
|
95
|
+
}
|
|
96
|
+
}
|