@temporalio/core-bridge 1.13.0 → 1.13.2
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 +239 -382
- package/Cargo.toml +11 -11
- package/lib/native.d.ts +10 -3
- package/package.json +3 -3
- package/releases/aarch64-apple-darwin/index.node +0 -0
- package/releases/aarch64-unknown-linux-gnu/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/sdk-core/.cargo/config.toml +71 -11
- package/sdk-core/.clippy.toml +1 -0
- package/sdk-core/.github/workflows/heavy.yml +2 -0
- package/sdk-core/.github/workflows/per-pr.yml +50 -18
- package/sdk-core/ARCHITECTURE.md +44 -48
- package/sdk-core/Cargo.toml +26 -7
- package/sdk-core/README.md +4 -0
- package/sdk-core/arch_docs/diagrams/TimerMachine_Coverage.puml +14 -0
- package/sdk-core/arch_docs/diagrams/initial_event_history.png +0 -0
- package/sdk-core/arch_docs/sdks_intro.md +299 -0
- package/sdk-core/client/Cargo.toml +8 -7
- package/sdk-core/client/src/callback_based.rs +1 -2
- package/sdk-core/client/src/lib.rs +485 -299
- package/sdk-core/client/src/metrics.rs +32 -8
- package/sdk-core/client/src/proxy.rs +124 -5
- package/sdk-core/client/src/raw.rs +598 -307
- package/sdk-core/client/src/replaceable.rs +253 -0
- package/sdk-core/client/src/retry.rs +9 -6
- package/sdk-core/client/src/worker_registry/mod.rs +19 -3
- package/sdk-core/client/src/workflow_handle/mod.rs +20 -17
- package/sdk-core/core/Cargo.toml +100 -31
- package/sdk-core/core/src/core_tests/activity_tasks.rs +55 -225
- package/sdk-core/core/src/core_tests/mod.rs +2 -8
- package/sdk-core/core/src/core_tests/queries.rs +3 -5
- package/sdk-core/core/src/core_tests/replay_flag.rs +3 -62
- package/sdk-core/core/src/core_tests/updates.rs +4 -5
- package/sdk-core/core/src/core_tests/workers.rs +4 -3
- package/sdk-core/core/src/core_tests/workflow_cancels.rs +10 -7
- package/sdk-core/core/src/core_tests/workflow_tasks.rs +28 -291
- package/sdk-core/core/src/ephemeral_server/mod.rs +15 -3
- package/sdk-core/core/src/internal_flags.rs +11 -1
- package/sdk-core/core/src/lib.rs +50 -36
- package/sdk-core/core/src/pollers/mod.rs +5 -5
- package/sdk-core/core/src/pollers/poll_buffer.rs +2 -2
- package/sdk-core/core/src/protosext/mod.rs +13 -5
- package/sdk-core/core/src/protosext/protocol_messages.rs +4 -11
- package/sdk-core/core/src/retry_logic.rs +256 -108
- package/sdk-core/core/src/telemetry/metrics.rs +1 -0
- package/sdk-core/core/src/telemetry/mod.rs +8 -2
- package/sdk-core/core/src/telemetry/prometheus_meter.rs +2 -2
- package/sdk-core/core/src/test_help/integ_helpers.rs +971 -0
- package/sdk-core/core/src/test_help/mod.rs +10 -1100
- package/sdk-core/core/src/test_help/unit_helpers.rs +218 -0
- package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +42 -6
- package/sdk-core/core/src/worker/activities/local_activities.rs +19 -19
- package/sdk-core/core/src/worker/activities.rs +10 -3
- package/sdk-core/core/src/worker/client/mocks.rs +3 -3
- package/sdk-core/core/src/worker/client.rs +130 -93
- package/sdk-core/core/src/worker/heartbeat.rs +12 -13
- package/sdk-core/core/src/worker/mod.rs +31 -21
- package/sdk-core/core/src/worker/nexus.rs +14 -3
- package/sdk-core/core/src/worker/slot_provider.rs +9 -0
- package/sdk-core/core/src/worker/tuner.rs +159 -0
- package/sdk-core/core/src/worker/workflow/history_update.rs +3 -265
- package/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +1 -54
- package/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +0 -82
- package/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +0 -67
- package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +1 -192
- package/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +0 -43
- package/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +6 -554
- package/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +0 -71
- package/sdk-core/core/src/worker/workflow/machines/nexus_operation_state_machine.rs +102 -3
- package/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +10 -539
- package/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +0 -139
- package/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +1 -119
- package/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +6 -63
- package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +9 -4
- package/sdk-core/core/src/worker/workflow/mod.rs +5 -1
- package/sdk-core/core/src/worker/workflow/workflow_stream.rs +8 -3
- package/sdk-core/core-api/Cargo.toml +4 -4
- package/sdk-core/core-api/src/envconfig.rs +153 -54
- package/sdk-core/core-api/src/lib.rs +68 -0
- package/sdk-core/core-api/src/telemetry/metrics.rs +2 -1
- package/sdk-core/core-api/src/telemetry.rs +13 -0
- package/sdk-core/core-c-bridge/Cargo.toml +13 -8
- package/sdk-core/core-c-bridge/include/temporal-sdk-core-c-bridge.h +184 -22
- package/sdk-core/core-c-bridge/src/client.rs +462 -184
- package/sdk-core/core-c-bridge/src/envconfig.rs +314 -0
- package/sdk-core/core-c-bridge/src/lib.rs +1 -0
- package/sdk-core/core-c-bridge/src/random.rs +4 -4
- package/sdk-core/core-c-bridge/src/runtime.rs +22 -23
- package/sdk-core/core-c-bridge/src/testing.rs +1 -4
- package/sdk-core/core-c-bridge/src/tests/context.rs +31 -31
- package/sdk-core/core-c-bridge/src/tests/mod.rs +32 -28
- package/sdk-core/core-c-bridge/src/tests/utils.rs +7 -7
- package/sdk-core/core-c-bridge/src/worker.rs +319 -66
- package/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +6 -1
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/dupe_transitions_fail.stderr +5 -5
- package/sdk-core/sdk/Cargo.toml +8 -2
- package/sdk-core/sdk/src/activity_context.rs +1 -1
- package/sdk-core/sdk/src/app_data.rs +1 -1
- package/sdk-core/sdk/src/interceptors.rs +1 -4
- package/sdk-core/sdk/src/lib.rs +1 -5
- package/sdk-core/sdk/src/workflow_context/options.rs +10 -1
- package/sdk-core/sdk/src/workflow_future.rs +1 -1
- package/sdk-core/sdk-core-protos/Cargo.toml +6 -6
- package/sdk-core/sdk-core-protos/build.rs +10 -23
- package/sdk-core/sdk-core-protos/protos/api_upstream/.github/workflows/create-release.yml +9 -1
- package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv2.json +254 -5
- package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv3.yaml +234 -5
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/common/v1/message.proto +1 -1
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/deployment/v1/message.proto +6 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/namespace/v1/message.proto +6 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +60 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +30 -6
- package/sdk-core/sdk-core-protos/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +2 -0
- package/sdk-core/{test-utils → sdk-core-protos}/src/canned_histories.rs +5 -5
- package/sdk-core/sdk-core-protos/src/history_builder.rs +2 -2
- package/sdk-core/sdk-core-protos/src/lib.rs +25 -9
- package/sdk-core/sdk-core-protos/src/test_utils.rs +89 -0
- package/sdk-core/sdk-core-protos/src/utilities.rs +14 -5
- package/sdk-core/tests/c_bridge_smoke_test.c +10 -0
- package/sdk-core/tests/cloud_tests.rs +10 -8
- package/sdk-core/tests/common/http_proxy.rs +134 -0
- package/sdk-core/{test-utils/src/lib.rs → tests/common/mod.rs} +214 -281
- package/sdk-core/{test-utils/src → tests/common}/workflows.rs +4 -3
- package/sdk-core/tests/fuzzy_workflow.rs +1 -1
- package/sdk-core/tests/global_metric_tests.rs +8 -7
- package/sdk-core/tests/heavy_tests.rs +7 -3
- package/sdk-core/tests/integ_tests/client_tests.rs +111 -24
- package/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +14 -9
- package/sdk-core/tests/integ_tests/heartbeat_tests.rs +4 -4
- package/sdk-core/tests/integ_tests/metrics_tests.rs +114 -14
- package/sdk-core/tests/integ_tests/pagination_tests.rs +273 -0
- package/sdk-core/tests/integ_tests/polling_tests.rs +311 -93
- package/sdk-core/tests/integ_tests/queries_tests.rs +4 -4
- package/sdk-core/tests/integ_tests/update_tests.rs +13 -7
- package/sdk-core/tests/integ_tests/visibility_tests.rs +26 -9
- package/sdk-core/tests/integ_tests/worker_tests.rs +668 -13
- package/sdk-core/tests/integ_tests/worker_versioning_tests.rs +40 -24
- package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +244 -11
- package/sdk-core/tests/integ_tests/workflow_tests/appdata_propagation.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +78 -2
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +61 -2
- package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +465 -7
- package/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +41 -2
- package/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +315 -3
- package/sdk-core/tests/integ_tests/workflow_tests/eager.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +1990 -14
- package/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +65 -2
- package/sdk-core/tests/integ_tests/workflow_tests/nexus.rs +123 -23
- package/sdk-core/tests/integ_tests/workflow_tests/patches.rs +525 -3
- package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +65 -16
- package/sdk-core/tests/integ_tests/workflow_tests/resets.rs +32 -23
- package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +126 -5
- package/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +1 -2
- package/sdk-core/tests/integ_tests/workflow_tests/timers.rs +124 -8
- package/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +62 -2
- package/sdk-core/tests/integ_tests/workflow_tests.rs +67 -8
- package/sdk-core/tests/main.rs +26 -17
- package/sdk-core/tests/manual_tests.rs +5 -1
- package/sdk-core/tests/runner.rs +22 -40
- package/sdk-core/tests/shared_tests/mod.rs +1 -1
- package/sdk-core/tests/shared_tests/priority.rs +1 -1
- package/sdk-core/{core/benches/workflow_replay.rs → tests/workflow_replay_bench.rs} +10 -5
- package/src/client.rs +97 -20
- package/src/helpers/callbacks.rs +4 -4
- package/src/helpers/errors.rs +7 -1
- package/src/helpers/handles.rs +1 -0
- package/src/helpers/try_from_js.rs +4 -3
- package/src/lib.rs +3 -2
- package/src/metrics.rs +3 -0
- package/src/runtime.rs +5 -2
- package/src/worker.rs +9 -12
- package/ts/native.ts +13 -3
- package/sdk-core/arch_docs/diagrams/workflow_internals.svg +0 -1
- package/sdk-core/core/src/core_tests/child_workflows.rs +0 -281
- package/sdk-core/core/src/core_tests/determinism.rs +0 -318
- package/sdk-core/core/src/core_tests/local_activities.rs +0 -1442
- package/sdk-core/test-utils/Cargo.toml +0 -38
- package/sdk-core/test-utils/src/histfetch.rs +0 -28
- package/sdk-core/test-utils/src/interceptors.rs +0 -46
package/Cargo.toml
CHANGED
|
@@ -25,28 +25,28 @@ async-trait = "0.1.83"
|
|
|
25
25
|
bridge-macros = { path = "bridge-macros" }
|
|
26
26
|
futures = { version = "0.3", features = ["executor"] }
|
|
27
27
|
neon = { version = "1.0.0", default-features = false, features = [
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
"napi-6",
|
|
29
|
+
"futures",
|
|
30
30
|
] }
|
|
31
|
-
opentelemetry = "0.
|
|
31
|
+
opentelemetry = "0.31"
|
|
32
32
|
os_pipe = "1.2.1"
|
|
33
33
|
parking_lot = "0.12"
|
|
34
|
-
prost = "0.
|
|
35
|
-
prost-types = "0.
|
|
34
|
+
prost = "0.14"
|
|
35
|
+
prost-types = "0.14"
|
|
36
36
|
serde = { version = "1.0", features = ["derive"] }
|
|
37
37
|
serde_json = "1.0"
|
|
38
38
|
temporal-sdk-core = { version = "*", path = "./sdk-core/core", features = [
|
|
39
|
-
|
|
39
|
+
"ephemeral-server",
|
|
40
40
|
] }
|
|
41
41
|
temporal-client = { version = "*", path = "./sdk-core/client" }
|
|
42
42
|
thiserror = "2"
|
|
43
43
|
tokio = "1.13"
|
|
44
44
|
tokio-stream = "0.1"
|
|
45
|
-
tonic = "0.
|
|
45
|
+
tonic = "0.14"
|
|
46
46
|
tracing = "0.1"
|
|
47
47
|
tracing-subscriber = { version = "0.3", default-features = false, features = [
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
"parking_lot",
|
|
49
|
+
"env-filter",
|
|
50
|
+
"registry",
|
|
51
|
+
"ansi",
|
|
52
52
|
] }
|
package/lib/native.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ export interface OtelMetricsExporterOptions {
|
|
|
78
78
|
protocol: 'http' | 'grpc';
|
|
79
79
|
}
|
|
80
80
|
export declare function newClient(runtime: Runtime, clientOptions: ClientOptions): Promise<Client>;
|
|
81
|
-
export declare function clientUpdateHeaders(client: Client, headers: Record<string,
|
|
81
|
+
export declare function clientUpdateHeaders(client: Client, headers: Record<string, MetadataValue>): void;
|
|
82
82
|
export declare function clientUpdateApiKey(client: Client, apiKey: string): void;
|
|
83
83
|
export declare function clientSendWorkflowServiceRequest(client: Client, call: RpcCall): Promise<Buffer>;
|
|
84
84
|
export declare function clientSendOperatorServiceRequest(client: Client, call: RpcCall): Promise<Buffer>;
|
|
@@ -94,7 +94,7 @@ export interface ClientOptions {
|
|
|
94
94
|
clientVersion: string;
|
|
95
95
|
tls: Option<TLSConfig>;
|
|
96
96
|
httpConnectProxy: Option<HttpConnectProxy>;
|
|
97
|
-
headers: Option<Record<string,
|
|
97
|
+
headers: Option<Record<string, MetadataValue>>;
|
|
98
98
|
apiKey: Option<string>;
|
|
99
99
|
disableErrorCodeMetricTags: boolean;
|
|
100
100
|
}
|
|
@@ -122,7 +122,7 @@ export interface RpcCall {
|
|
|
122
122
|
rpc: string;
|
|
123
123
|
req: Buffer;
|
|
124
124
|
retry: boolean;
|
|
125
|
-
metadata: Record<string,
|
|
125
|
+
metadata: Record<string, MetadataValue>;
|
|
126
126
|
timeout: Option<number>;
|
|
127
127
|
}
|
|
128
128
|
export declare function newWorker(client: Client, workerOptions: WorkerOptions): Worker;
|
|
@@ -139,6 +139,13 @@ export declare function workerFinalizeShutdown(worker: Worker): Promise<void>;
|
|
|
139
139
|
export interface Worker {
|
|
140
140
|
type: 'worker';
|
|
141
141
|
}
|
|
142
|
+
export type MetadataValue = {
|
|
143
|
+
type: 'ascii';
|
|
144
|
+
value: string;
|
|
145
|
+
} | {
|
|
146
|
+
type: 'binary';
|
|
147
|
+
value: Buffer;
|
|
148
|
+
};
|
|
142
149
|
export interface WorkerOptions {
|
|
143
150
|
identity: string;
|
|
144
151
|
buildId: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temporalio/core-bridge",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.2",
|
|
4
4
|
"description": "Temporal.io SDK Core<>Node bridge",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@grpc/grpc-js": "^1.12.4",
|
|
26
|
-
"@temporalio/common": "1.13.
|
|
26
|
+
"@temporalio/common": "1.13.2",
|
|
27
27
|
"arg": "^5.0.2",
|
|
28
28
|
"cargo-cp-artifact": "^0.1.8",
|
|
29
29
|
"which": "^4.0.0"
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "cccc54c72f85377ac520b5d6cdd9a9a847027c27"
|
|
60
60
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -3,14 +3,74 @@
|
|
|
3
3
|
CLI_VERSION_OVERRIDE = "v1.4.1-cloud-v1-29-0-139-2.0"
|
|
4
4
|
|
|
5
5
|
[alias]
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
"--",
|
|
10
|
-
|
|
11
|
-
"--
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
"
|
|
6
|
+
# Not sure why --all-features doesn't work
|
|
7
|
+
integ-test = [
|
|
8
|
+
"test",
|
|
9
|
+
"--features",
|
|
10
|
+
"temporal-sdk-core-protos/serde_serialize",
|
|
11
|
+
"--features",
|
|
12
|
+
"test-utilities",
|
|
13
|
+
"--features",
|
|
14
|
+
"ephemeral-server",
|
|
15
|
+
"--package",
|
|
16
|
+
"temporal-sdk-core",
|
|
17
|
+
"--test",
|
|
18
|
+
"integ_runner",
|
|
19
|
+
"--",
|
|
20
|
+
]
|
|
21
|
+
lint = [
|
|
22
|
+
"clippy",
|
|
23
|
+
"--workspace",
|
|
24
|
+
"--examples",
|
|
25
|
+
"--all-features",
|
|
26
|
+
"--test",
|
|
27
|
+
"integ_tests",
|
|
28
|
+
"--test",
|
|
29
|
+
"heavy_tests",
|
|
30
|
+
"--test",
|
|
31
|
+
"manual_tests",
|
|
32
|
+
"--test",
|
|
33
|
+
"cloud_tests",
|
|
34
|
+
"--test",
|
|
35
|
+
"integ_runner",
|
|
36
|
+
"--test",
|
|
37
|
+
"global_metric_tests",
|
|
38
|
+
"--",
|
|
39
|
+
"--D",
|
|
40
|
+
"warnings",
|
|
41
|
+
]
|
|
42
|
+
lint-fix = [
|
|
43
|
+
"clippy",
|
|
44
|
+
"--workspace",
|
|
45
|
+
"--examples",
|
|
46
|
+
"--all-features",
|
|
47
|
+
"--test",
|
|
48
|
+
"integ_tests",
|
|
49
|
+
"--test",
|
|
50
|
+
"heavy_tests",
|
|
51
|
+
"--test",
|
|
52
|
+
"manual_tests",
|
|
53
|
+
"--fix",
|
|
54
|
+
"--allow-dirty",
|
|
55
|
+
]
|
|
56
|
+
test-lint = [
|
|
57
|
+
"clippy",
|
|
58
|
+
"--all",
|
|
59
|
+
"--all-features",
|
|
60
|
+
"--examples",
|
|
61
|
+
"--workspace",
|
|
62
|
+
"--tests",
|
|
63
|
+
"--",
|
|
64
|
+
"--D",
|
|
65
|
+
"warnings",
|
|
66
|
+
]
|
|
67
|
+
test-lint-fix = [
|
|
68
|
+
"clippy",
|
|
69
|
+
"--all",
|
|
70
|
+
"--all-features",
|
|
71
|
+
"--examples",
|
|
72
|
+
"--workspace",
|
|
73
|
+
"--tests",
|
|
74
|
+
"--fix",
|
|
75
|
+
"--allow-dirty",
|
|
76
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
allow-dbg-in-tests = true
|
|
@@ -21,12 +21,12 @@ jobs:
|
|
|
21
21
|
submodules: recursive
|
|
22
22
|
- uses: dtolnay/rust-toolchain@stable
|
|
23
23
|
with:
|
|
24
|
-
toolchain: 1.
|
|
24
|
+
toolchain: 1.90.0
|
|
25
25
|
- name: Install protoc
|
|
26
26
|
uses: arduino/setup-protoc@v3
|
|
27
27
|
with:
|
|
28
28
|
# TODO: Upgrade proto once https://github.com/arduino/setup-protoc/issues/99 is fixed
|
|
29
|
-
version:
|
|
29
|
+
version: "23.x"
|
|
30
30
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
31
31
|
- run: rustup component add rustfmt clippy
|
|
32
32
|
- uses: Swatinem/rust-cache@v2
|
|
@@ -43,27 +43,27 @@ jobs:
|
|
|
43
43
|
strategy:
|
|
44
44
|
fail-fast: false
|
|
45
45
|
matrix:
|
|
46
|
-
os: [
|
|
46
|
+
os: [ubuntu-latest, ubuntu-arm, macos-intel, macos-arm, windows-latest]
|
|
47
47
|
include:
|
|
48
48
|
- os: windows-latest
|
|
49
49
|
- os: ubuntu-latest
|
|
50
50
|
- os: ubuntu-arm
|
|
51
51
|
runsOn: ubuntu-24.04-arm64-2-core
|
|
52
|
-
- os: macos-intel
|
|
53
|
-
runsOn: macos-13
|
|
54
52
|
- os: macos-arm
|
|
55
53
|
runsOn: macos-14
|
|
54
|
+
- os: macos-intel
|
|
55
|
+
runsOn: macos-15-intel
|
|
56
56
|
runs-on: ${{ matrix.runsOn || matrix.os }}
|
|
57
57
|
steps:
|
|
58
58
|
- uses: actions/checkout@v4
|
|
59
59
|
- uses: dtolnay/rust-toolchain@stable
|
|
60
60
|
with:
|
|
61
|
-
toolchain: 1.
|
|
61
|
+
toolchain: 1.90.0
|
|
62
62
|
- name: Install protoc
|
|
63
63
|
uses: arduino/setup-protoc@v3
|
|
64
64
|
with:
|
|
65
65
|
# TODO: Upgrade proto once https://github.com/arduino/setup-protoc/issues/99 is fixed
|
|
66
|
-
version:
|
|
66
|
+
version: "23.x"
|
|
67
67
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
68
68
|
# Workaround for https://github.com/actions/runner-images/issues/12432
|
|
69
69
|
# from https://github.com/rust-lang/rust/issues/141626#issuecomment-2919419236
|
|
@@ -91,29 +91,37 @@ jobs:
|
|
|
91
91
|
strategy:
|
|
92
92
|
fail-fast: false
|
|
93
93
|
matrix:
|
|
94
|
-
os: [
|
|
94
|
+
os: [ubuntu-latest, ubuntu-arm, macos-intel, macos-arm, windows-latest]
|
|
95
95
|
include:
|
|
96
96
|
- os: windows-latest
|
|
97
97
|
- os: ubuntu-latest
|
|
98
98
|
- os: ubuntu-arm
|
|
99
99
|
runsOn: ubuntu-24.04-arm64-2-core
|
|
100
|
-
- os: macos-intel
|
|
101
|
-
runsOn: macos-13
|
|
102
100
|
- os: macos-arm
|
|
103
101
|
runsOn: macos-14
|
|
102
|
+
- os: macos-intel
|
|
103
|
+
runsOn: macos-15-intel
|
|
104
104
|
runs-on: ${{ matrix.runsOn || matrix.os }}
|
|
105
105
|
steps:
|
|
106
106
|
- uses: actions/checkout@v4
|
|
107
107
|
- uses: dtolnay/rust-toolchain@stable
|
|
108
108
|
with:
|
|
109
|
-
toolchain: 1.
|
|
109
|
+
toolchain: 1.90.0
|
|
110
110
|
- name: Install protoc
|
|
111
111
|
uses: arduino/setup-protoc@v3
|
|
112
112
|
with:
|
|
113
113
|
# TODO: Upgrade proto once https://github.com/arduino/setup-protoc/issues/99 is fixed
|
|
114
|
-
version:
|
|
114
|
+
version: "23.x"
|
|
115
115
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
116
|
-
|
|
116
|
+
# Workaround for https://github.com/actions/runner-images/issues/12432
|
|
117
|
+
# from https://github.com/rust-lang/rust/issues/141626#issuecomment-2919419236
|
|
118
|
+
# Visual Studio bug tracker https://developercommunity.visualstudio.com/t/Regression-from-1943:-linkexe-crashes/10912960
|
|
119
|
+
- name: Setup RUSTFLAGS (Windows)
|
|
120
|
+
if: runner.os == 'Windows'
|
|
121
|
+
uses: actions/github-script@v7
|
|
122
|
+
with:
|
|
123
|
+
script: |
|
|
124
|
+
core.exportVariable('RUSTFLAGS', '-Csymbol-mangling-version=v0');
|
|
117
125
|
- uses: Swatinem/rust-cache@v2
|
|
118
126
|
- run: cargo integ-test
|
|
119
127
|
|
|
@@ -131,16 +139,16 @@ jobs:
|
|
|
131
139
|
- uses: actions/checkout@v4
|
|
132
140
|
- uses: dtolnay/rust-toolchain@stable
|
|
133
141
|
with:
|
|
134
|
-
toolchain: 1.
|
|
142
|
+
toolchain: 1.90.0
|
|
135
143
|
- name: Install protoc
|
|
136
144
|
uses: arduino/setup-protoc@v3
|
|
137
145
|
with:
|
|
138
146
|
# TODO: Upgrade proto once https://github.com/arduino/setup-protoc/issues/99 is fixed
|
|
139
|
-
version:
|
|
147
|
+
version: "23.x"
|
|
140
148
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
141
149
|
|
|
142
150
|
- uses: Swatinem/rust-cache@v2
|
|
143
|
-
- run: cargo test --test cloud_tests
|
|
151
|
+
- run: cargo test --features=test-utilities --test cloud_tests
|
|
144
152
|
|
|
145
153
|
docker-integ-tests:
|
|
146
154
|
name: Docker integ tests
|
|
@@ -156,12 +164,12 @@ jobs:
|
|
|
156
164
|
- uses: actions/checkout@v4
|
|
157
165
|
- uses: dtolnay/rust-toolchain@stable
|
|
158
166
|
with:
|
|
159
|
-
toolchain: 1.
|
|
167
|
+
toolchain: 1.90.0
|
|
160
168
|
- name: Install protoc
|
|
161
169
|
uses: arduino/setup-protoc@v3
|
|
162
170
|
with:
|
|
163
171
|
# TODO: Upgrade proto once https://github.com/arduino/setup-protoc/issues/99 is fixed
|
|
164
|
-
version:
|
|
172
|
+
version: "23.x"
|
|
165
173
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
166
174
|
- name: Start container for otel-collector and prometheus
|
|
167
175
|
uses: hoverkraft-tech/compose-action@v2.0.1
|
|
@@ -169,3 +177,27 @@ jobs:
|
|
|
169
177
|
compose-file: ./docker/docker-compose-ci.yaml
|
|
170
178
|
- uses: Swatinem/rust-cache@v2
|
|
171
179
|
- run: cargo integ-test docker_
|
|
180
|
+
|
|
181
|
+
c-bridge-static-link-test:
|
|
182
|
+
name: "C bridge static link test"
|
|
183
|
+
runs-on: ubuntu-latest
|
|
184
|
+
steps:
|
|
185
|
+
- uses: actions/checkout@v4
|
|
186
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
187
|
+
with:
|
|
188
|
+
toolchain: 1.90.0
|
|
189
|
+
- name: Install protoc
|
|
190
|
+
uses: arduino/setup-protoc@v3
|
|
191
|
+
with:
|
|
192
|
+
# TODO: Upgrade proto once https://github.com/arduino/setup-protoc/issues/99 is fixed
|
|
193
|
+
version: "23.x"
|
|
194
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
195
|
+
|
|
196
|
+
- name: Build crate as static library
|
|
197
|
+
run: cargo rustc --package temporal-sdk-core-c-bridge --features xz2-static -- --crate-type=staticlib
|
|
198
|
+
|
|
199
|
+
- name: Build C test program
|
|
200
|
+
run: gcc -I./core-c-bridge/include tests/c_bridge_smoke_test.c target/debug/deps/libtemporal_sdk_core_c_bridge.a -lpthread -ldl -lm -o test
|
|
201
|
+
|
|
202
|
+
- name: Run C test program
|
|
203
|
+
run: ./test
|
package/sdk-core/ARCHITECTURE.md
CHANGED
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
Core SDK Architecture
|
|
2
2
|
===
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
If you're newer to SDKs in general, first check out the [SDKs Intro](./arch_docs/sdks_intro.md)!
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
## High-level description
|
|
7
|
+
|
|
8
|
+
The below diagram depicts how Core-based SDKs are split into two parts. The `sdk-core` common code,
|
|
7
9
|
which is written in Rust, and a `sdk-lang` package specific to the language the user is writing
|
|
8
10
|
their workflow/activity in. For example a user writing workflows in Rust would be pulling in (at
|
|
9
11
|
least) two crates - `temporal-sdk-core` and `temporal-sdk-rust`.
|
|
10
12
|
|
|
11
13
|

|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
gRPC. It's responsible for polling for tasks, processing those tasks
|
|
15
|
-
|
|
15
|
+
Core communicates with the Temporal service in the same way that existing SDKs today do, via
|
|
16
|
+
gRPC. It's responsible for polling for tasks (Workflow, Activity, and Nexus), processing those tasks
|
|
17
|
+
and updating internal state as necessary, and then delivering them to the lang-layer which is
|
|
18
|
+
polling for them (and handling the responses).
|
|
16
19
|
|
|
17
|
-
The `sdk-lang` side communicates with `sdk-core` via
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
use [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
that language in an ergonomic manner. IPC will exist as a thin layer on top of the C bindings. Care
|
|
24
|
-
should be taken here to avoid unnecessary copying and [de]serialization. Then `sdk-lang` is
|
|
25
|
-
responsible for dispatching tasks to the appropriate user code (to whatever extent parts of this can
|
|
26
|
-
be reasonably put in the core code, we desire that to make lang-specific SDKs as small as possible).
|
|
20
|
+
The `sdk-lang` side communicates with `sdk-core` via C bindings. Many languages already have nice
|
|
21
|
+
support for calling into Rust code - generally speaking these implementations are using C bindings
|
|
22
|
+
under the hood. For example, we use [neon](https://neon-bindings.com/) to support the TS/JS SDK, and
|
|
23
|
+
we use [PyO3](https://github.com/PyO3/pyo3) for Python. Languages using libraries like that layer
|
|
24
|
+
another crate on top of `core` which brings in these language-specific helpers to expose `core` to
|
|
25
|
+
that language in an ergonomic manner.
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
Other SDKs (ex: .NET) directly use C bindings available in this repo
|
|
28
|
+
at [core-c-bridge](./core-c-bridge).
|
|
30
29
|
|
|
31
30
|
### Glossary of terms
|
|
32
31
|
|
|
@@ -38,9 +37,9 @@ the code. This list should help to disambiguate:
|
|
|
38
37
|
represent the history of the workflow. They are defined in the protobuf definitions for the
|
|
39
38
|
Temporal service itself.
|
|
40
39
|
* `Command`: These are the commands defined in the temporal service protobufs that are returned by
|
|
41
|
-
|
|
42
|
-
* `WorkflowTask`: These are how the server represents the need to run user workflow code
|
|
43
|
-
|
|
40
|
+
workers upon completing a `WorkflowTask`. For example, starting a timer or an activity.
|
|
41
|
+
* `WorkflowTask`: These are how the server represents the need to run user workflow code, and the
|
|
42
|
+
results of that execution. See the `HistoryEvent` proto definition for more.
|
|
44
43
|
* `WorkflowActivation`: These are produced by the Core SDK when the lang sdk needs to "activate" the
|
|
45
44
|
user's workflow code, either running it from the beginning or resuming a cached workflow.
|
|
46
45
|
* `WorkflowActivationJob` (shorthand: `Job`s): These are included in `WorkflowActivation`s and
|
|
@@ -57,9 +56,9 @@ Additional clarifications that are internal to Core:
|
|
|
57
56
|
* `StateMachine`s also handle events and produce commands, which often map directly to the above
|
|
58
57
|
`HistoryEvent`s and `Command`s, but are distinct types. The state machine library is Temporal
|
|
59
58
|
agnostic - but all interactions with the machines pass through a `TemporalStateMachine` trait,
|
|
60
|
-
which accepts `HistoryEvent`s, and produces `
|
|
61
|
-
* `
|
|
62
|
-
Including pushing new
|
|
59
|
+
which accepts `HistoryEvent`s, and produces `MachineResponse`s.
|
|
60
|
+
* `MachineResponse`: These allow the state machines to trigger things to happen to the workflow.
|
|
61
|
+
Including pushing new Activation Jobs, or otherwise advancing workflow state.
|
|
63
62
|
|
|
64
63
|
### Core SDK Responsibilities
|
|
65
64
|
|
|
@@ -67,18 +66,19 @@ Additional clarifications that are internal to Core:
|
|
|
67
66
|
more ergonomic traits.
|
|
68
67
|
- Provide interface for language-specific SDK to drive event loop and handle returned commands. The
|
|
69
68
|
lang sdk will continuously call/poll the core SDK to receive new tasks, which either represent
|
|
70
|
-
workflows being started or awoken (`WorkflowActivation`)
|
|
71
|
-
`
|
|
72
|
-
as appropriate, and will then push completed tasks back
|
|
69
|
+
workflows being started or awoken (`WorkflowActivation`), activities to execute (`ActivityTask`),
|
|
70
|
+
or Nexus Operations to invoke (`NexusTask`). It will then call its workflow/activity/nexus
|
|
71
|
+
functions with the provided information as appropriate, and will then push completed tasks back
|
|
72
|
+
into the core SDK.
|
|
73
73
|
- Advance state machines and report back to the temporal server as appropriate when handling events
|
|
74
74
|
and commands
|
|
75
75
|
|
|
76
76
|
### Language Specific SDK Responsibilities
|
|
77
77
|
|
|
78
78
|
- Periodically poll Core SDK for tasks
|
|
79
|
-
- Call workflow and
|
|
80
|
-
Core SDK
|
|
81
|
-
- Return results of workflows/activities to Core SDK
|
|
79
|
+
- Call workflow, activity, and nexus functions as appropriate, using information in events it
|
|
80
|
+
received from Core SDK
|
|
81
|
+
- Return results of workflows/activities/nexus ops to Core SDK
|
|
82
82
|
- Manage concurrency using language appropriate primitives. For example, it is up to the language
|
|
83
83
|
side to decide how frequently to poll, and whether or not to execute worklows and activities in
|
|
84
84
|
separate threads or coroutines, etc.
|
|
@@ -86,21 +86,21 @@ Additional clarifications that are internal to Core:
|
|
|
86
86
|
### Example Sequence Diagrams
|
|
87
87
|
|
|
88
88
|
Here we consider what the sequence of API calls would look like for a simple workflow executing a
|
|
89
|
-
happy path. The hello-world workflow & activity in
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
89
|
+
happy path. The hello-world workflow & activity in Python is below.
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
@workflow.defn
|
|
93
|
+
class SayHello:
|
|
94
|
+
@workflow.run
|
|
95
|
+
async def run(self, name: str) -> str:
|
|
96
|
+
return await workflow.execute_activity(
|
|
97
|
+
say_hello, name, schedule_to_close_timeout=timedelta(seconds=5)
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
@activity.defn
|
|
102
|
+
async def say_hello(name: str) -> str:
|
|
103
|
+
return f"Hello, {name}!"
|
|
104
104
|
```
|
|
105
105
|
|
|
106
106
|
[](https://mermaid-js.github.io/mermaid-live-editor/edit#pako:eNptk81O6zAQhV9l5AWr8gIRqoQCC0QXQJDuJpvBnrZWbY-vf9rbi3h3bJqE0JKVlfP5zMyx_S4kKxKNiPQ3k5N0p3ET0PYOyucxJC21R5egA4zwStZzQAMdhb2WdIm1FWs5EHR3j5fyqsordJuTfAJWcL1cQtvAg9NJo9H_CQ4cdhTmetfAJnjZQJeK4Z-irw0f7v-RzEmzG80Ms__aXVVIGHfgA0uKUbvNCWl_-j2xMaPda-GfM-Vhsg6uh9aqEOEKtjomDseizb0KcOu9OU5yYogJE4FFudWO4ometUh7KnnU5VkItR1YcwCUSe-xzhanWpVZNTC2ezshc5MCvGQ3hbCoAahcIgDJ1qJTcaKHmpd-LVtvqK5u3sJSskuoXUnwzOJ7fLXHcn1-nZqcGk_nLPoXip6dmqc_FCZ1sXdKqNvmpPhQfouFsBQsalWu8HvFepG2ZKkXTVkqDLte9O6jcNmr0tm90uV8RLNGE2khMCfujk6KJoVMIzS8gYH6-ASOZQf0)
|
|
@@ -118,7 +118,3 @@ definition [here](https://github.com/temporalio/sdk-core/tree/master/sdk-core-pr
|
|
|
118
118
|
|
|
119
119
|
- [Sticky task queues](arch_docs/sticky_queues.md)
|
|
120
120
|
- [Workflow task chunking](arch_docs/workflow_task_chunking.md)
|
|
121
|
-
|
|
122
|
-
## Workflow Processing Internals
|
|
123
|
-
|
|
124
|
-

|
package/sdk-core/Cargo.toml
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
[workspace]
|
|
2
|
-
members = [
|
|
2
|
+
members = [
|
|
3
|
+
"core",
|
|
4
|
+
"client",
|
|
5
|
+
"core-api",
|
|
6
|
+
"fsm",
|
|
7
|
+
"sdk-core-protos",
|
|
8
|
+
"sdk",
|
|
9
|
+
"core-c-bridge",
|
|
10
|
+
]
|
|
3
11
|
resolver = "2"
|
|
4
12
|
|
|
5
13
|
[workspace.package]
|
|
@@ -8,17 +16,28 @@ license-file = "LICENSE.txt"
|
|
|
8
16
|
|
|
9
17
|
[workspace.dependencies]
|
|
10
18
|
derive_builder = "0.20"
|
|
11
|
-
derive_more = { version = "2.0", features = [
|
|
19
|
+
derive_more = { version = "2.0", features = [
|
|
20
|
+
"constructor",
|
|
21
|
+
"display",
|
|
22
|
+
"from",
|
|
23
|
+
"into",
|
|
24
|
+
"debug",
|
|
25
|
+
"try_into",
|
|
26
|
+
] }
|
|
12
27
|
thiserror = "2"
|
|
13
|
-
tonic = "0.
|
|
14
|
-
tonic-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
prost
|
|
28
|
+
tonic = "0.14"
|
|
29
|
+
tonic-prost = "0.14"
|
|
30
|
+
tonic-prost-build = "0.14"
|
|
31
|
+
opentelemetry = { version = "0.31", features = ["metrics"] }
|
|
32
|
+
prost = "0.14"
|
|
33
|
+
prost-types = { version = "0.7", package = "prost-wkt-types" }
|
|
18
34
|
|
|
19
35
|
[workspace.lints.rust]
|
|
20
36
|
unreachable_pub = "warn"
|
|
21
37
|
|
|
38
|
+
[workspace.lints.clippy]
|
|
39
|
+
dbg_macro = "warn"
|
|
40
|
+
|
|
22
41
|
[profile.release-lto]
|
|
23
42
|
inherits = "release"
|
|
24
43
|
lto = true
|
package/sdk-core/README.md
CHANGED
|
@@ -52,6 +52,10 @@ use an already-running server by passing `-s external`.
|
|
|
52
52
|
|
|
53
53
|
Run load tests with `cargo test --test heavy_tests`.
|
|
54
54
|
|
|
55
|
+
NOTE: Integration tests should pass locally, if running on MacOS and you see integration tests consistently failing
|
|
56
|
+
with an error that mentions `Too many open files`, this is likely due to `ulimit -n` being too low. You can raise
|
|
57
|
+
it temporarily (current shell) with `ulimit -n 65535`, or add it to your `~/.zshrc` file to apply to all shells.
|
|
58
|
+
|
|
55
59
|
## Formatting
|
|
56
60
|
|
|
57
61
|
To format all code run:
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
@startuml
|
|
2
|
+
[*] --> Created
|
|
3
|
+
Created -[#blue]-> StartCommandCreated: Schedule
|
|
4
|
+
StartCommandCreated -[#blue]-> StartCommandCreated: CommandStartTimer
|
|
5
|
+
StartCommandCreated -[#blue]-> StartCommandRecorded: TimerStarted
|
|
6
|
+
StartCommandCreated -[#blue]-> Canceled: Cancel
|
|
7
|
+
StartCommandRecorded -[#blue]-> Fired: TimerFired
|
|
8
|
+
StartCommandRecorded -[#blue]-> CancelTimerCommandCreated: Cancel
|
|
9
|
+
CancelTimerCommandCreated --> CancelTimerCommandCreated: Cancel
|
|
10
|
+
CancelTimerCommandCreated -[#blue]-> CancelTimerCommandSent: CommandCancelTimer
|
|
11
|
+
CancelTimerCommandSent --> Canceled: TimerCanceled
|
|
12
|
+
Canceled -[#blue]-> Canceled: Cancel
|
|
13
|
+
Fired -[#blue]-> Fired: Cancel
|
|
14
|
+
@enduml
|
|
Binary file
|