@temporalio/core-bridge 0.17.2 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +45 -52
- 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 +264 -286
- 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 +34 -73
- 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 +305 -195
- 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 +19 -21
- 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 +344 -160
- 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 +297 -81
- package/sdk-core/{test_utils → core-api}/Cargo.toml +10 -7
- package/sdk-core/{src → core-api/src}/errors.rs +42 -90
- 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 +594 -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 -158
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
use
|
|
1
|
+
use super::{
|
|
2
2
|
workflow_machines::MachineResponse, Cancellable, EventInfo, MachineKind, NewMachineWithCommand,
|
|
3
3
|
OnEventWrapper, WFMachinesAdapter, WFMachinesError,
|
|
4
4
|
};
|
|
@@ -34,13 +34,11 @@ pub(super) enum CompleteWFCommand {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/// Complete a workflow
|
|
37
|
-
pub(super) fn complete_workflow(
|
|
38
|
-
attribs: CompleteWorkflowExecution,
|
|
39
|
-
) -> NewMachineWithCommand<CompleteWorkflowMachine> {
|
|
37
|
+
pub(super) fn complete_workflow(attribs: CompleteWorkflowExecution) -> NewMachineWithCommand {
|
|
40
38
|
let (machine, add_cmd) = CompleteWorkflowMachine::new_scheduled(attribs);
|
|
41
39
|
NewMachineWithCommand {
|
|
42
40
|
command: add_cmd,
|
|
43
|
-
machine,
|
|
41
|
+
machine: machine.into(),
|
|
44
42
|
}
|
|
45
43
|
}
|
|
46
44
|
|
package/sdk-core/{src → core/src/workflow}/machines/continue_as_new_workflow_state_machine.rs
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
use
|
|
1
|
+
use super::{
|
|
2
2
|
Cancellable, EventInfo, HistoryEvent, MachineKind, MachineResponse, NewMachineWithCommand,
|
|
3
3
|
OnEventWrapper, WFMachinesAdapter, WFMachinesError,
|
|
4
4
|
};
|
|
@@ -29,9 +29,7 @@ fsm! {
|
|
|
29
29
|
#[derive(Debug, derive_more::Display)]
|
|
30
30
|
pub(super) enum ContinueAsNewWorkflowCommand {}
|
|
31
31
|
|
|
32
|
-
pub(super) fn continue_as_new(
|
|
33
|
-
attribs: ContinueAsNewWorkflowExecution,
|
|
34
|
-
) -> NewMachineWithCommand<ContinueAsNewWorkflowMachine> {
|
|
32
|
+
pub(super) fn continue_as_new(attribs: ContinueAsNewWorkflowExecution) -> NewMachineWithCommand {
|
|
35
33
|
let mut machine = ContinueAsNewWorkflowMachine {
|
|
36
34
|
state: Created {}.into(),
|
|
37
35
|
shared_state: (),
|
|
@@ -42,7 +40,10 @@ pub(super) fn continue_as_new(
|
|
|
42
40
|
command_type: CommandType::ContinueAsNewWorkflowExecution as i32,
|
|
43
41
|
attributes: Some(attribs.into()),
|
|
44
42
|
};
|
|
45
|
-
NewMachineWithCommand {
|
|
43
|
+
NewMachineWithCommand {
|
|
44
|
+
command,
|
|
45
|
+
machine: machine.into(),
|
|
46
|
+
}
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
#[derive(Default, Clone)]
|
|
@@ -120,19 +121,18 @@ impl Cancellable for ContinueAsNewWorkflowMachine {}
|
|
|
120
121
|
#[cfg(test)]
|
|
121
122
|
mod tests {
|
|
122
123
|
use super::*;
|
|
123
|
-
use crate::{
|
|
124
|
-
prototype_rust_sdk::{WfContext, WfExitValue, WorkflowFunction, WorkflowResult},
|
|
125
|
-
test_help::canned_histories,
|
|
126
|
-
workflow::managed_wf::ManagedWFFunc,
|
|
127
|
-
};
|
|
124
|
+
use crate::{test_help::canned_histories, workflow::managed_wf::ManagedWFFunc};
|
|
128
125
|
use std::time::Duration;
|
|
126
|
+
use temporal_sdk::{WfContext, WfExitValue, WorkflowFunction, WorkflowResult};
|
|
129
127
|
|
|
130
|
-
async fn wf_with_timer(
|
|
128
|
+
async fn wf_with_timer(ctx: WfContext) -> WorkflowResult<()> {
|
|
131
129
|
ctx.timer(Duration::from_millis(500)).await;
|
|
132
|
-
Ok(WfExitValue::
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
130
|
+
Ok(WfExitValue::continue_as_new(
|
|
131
|
+
ContinueAsNewWorkflowExecution {
|
|
132
|
+
arguments: vec![[1].into()],
|
|
133
|
+
..Default::default()
|
|
134
|
+
},
|
|
135
|
+
))
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
#[tokio::test]
|
|
@@ -141,12 +141,12 @@ mod tests {
|
|
|
141
141
|
let t = canned_histories::timer_then_continue_as_new("1");
|
|
142
142
|
let mut wfm = ManagedWFFunc::new(t, func, vec![]);
|
|
143
143
|
wfm.get_next_activation().await.unwrap();
|
|
144
|
-
let commands = wfm.get_server_commands().
|
|
144
|
+
let commands = wfm.get_server_commands().commands;
|
|
145
145
|
assert_eq!(commands.len(), 1);
|
|
146
146
|
assert_eq!(commands[0].command_type, CommandType::StartTimer as i32);
|
|
147
147
|
|
|
148
148
|
wfm.get_next_activation().await.unwrap();
|
|
149
|
-
let commands = wfm.get_server_commands().
|
|
149
|
+
let commands = wfm.get_server_commands().commands;
|
|
150
150
|
assert_eq!(commands.len(), 1);
|
|
151
151
|
assert_eq!(
|
|
152
152
|
commands[0].command_type,
|
|
@@ -154,7 +154,7 @@ mod tests {
|
|
|
154
154
|
);
|
|
155
155
|
|
|
156
156
|
assert!(wfm.get_next_activation().await.unwrap().jobs.is_empty());
|
|
157
|
-
let commands = wfm.get_server_commands().
|
|
157
|
+
let commands = wfm.get_server_commands().commands;
|
|
158
158
|
assert_eq!(commands.len(), 0);
|
|
159
159
|
wfm.shutdown().await.unwrap();
|
|
160
160
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
use
|
|
1
|
+
use super::{
|
|
2
2
|
workflow_machines::MachineResponse, Cancellable, EventInfo, MachineKind, NewMachineWithCommand,
|
|
3
|
-
OnEventWrapper,
|
|
3
|
+
OnEventWrapper, WFMachinesAdapter, WFMachinesError,
|
|
4
4
|
};
|
|
5
5
|
use rustfsm::{fsm, TransitionResult};
|
|
6
6
|
use std::convert::TryFrom;
|
|
7
7
|
use temporal_sdk_core_protos::{
|
|
8
8
|
coresdk::workflow_commands::FailWorkflowExecution,
|
|
9
9
|
temporal::api::{
|
|
10
|
+
command::v1::Command as ProtoCommand,
|
|
10
11
|
enums::v1::{CommandType, EventType},
|
|
11
12
|
history::v1::HistoryEvent,
|
|
12
13
|
},
|
|
@@ -30,13 +31,11 @@ pub(super) enum FailWFCommand {
|
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
/// Fail a workflow
|
|
33
|
-
pub(super) fn fail_workflow(
|
|
34
|
-
attribs: FailWorkflowExecution,
|
|
35
|
-
) -> NewMachineWithCommand<FailWorkflowMachine> {
|
|
34
|
+
pub(super) fn fail_workflow(attribs: FailWorkflowExecution) -> NewMachineWithCommand {
|
|
36
35
|
let (machine, add_cmd) = FailWorkflowMachine::new_scheduled(attribs);
|
|
37
36
|
NewMachineWithCommand {
|
|
38
37
|
command: add_cmd,
|
|
39
|
-
machine,
|
|
38
|
+
machine: machine.into(),
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
|