@temporalio/core-bridge 1.5.2 → 1.7.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 +304 -112
- package/lib/index.d.ts +8 -6
- package/lib/index.js.map +1 -1
- package/package.json +9 -4
- 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/.buildkite/docker/Dockerfile +2 -2
- package/sdk-core/.buildkite/docker/docker-compose.yaml +1 -1
- package/sdk-core/.buildkite/pipeline.yml +2 -4
- package/sdk-core/.cargo/config.toml +5 -2
- package/sdk-core/.github/workflows/heavy.yml +29 -0
- package/sdk-core/Cargo.toml +1 -1
- package/sdk-core/README.md +20 -10
- package/sdk-core/client/src/lib.rs +215 -39
- package/sdk-core/client/src/metrics.rs +17 -8
- package/sdk-core/client/src/raw.rs +4 -4
- package/sdk-core/client/src/retry.rs +32 -20
- package/sdk-core/core/Cargo.toml +25 -12
- package/sdk-core/core/src/abstractions/take_cell.rs +28 -0
- package/sdk-core/core/src/abstractions.rs +204 -14
- package/sdk-core/core/src/core_tests/activity_tasks.rs +143 -50
- package/sdk-core/core/src/core_tests/child_workflows.rs +6 -5
- package/sdk-core/core/src/core_tests/determinism.rs +165 -2
- package/sdk-core/core/src/core_tests/local_activities.rs +431 -43
- package/sdk-core/core/src/core_tests/queries.rs +34 -16
- package/sdk-core/core/src/core_tests/workers.rs +8 -5
- package/sdk-core/core/src/core_tests/workflow_tasks.rs +588 -55
- package/sdk-core/core/src/ephemeral_server/mod.rs +113 -12
- package/sdk-core/core/src/internal_flags.rs +155 -0
- package/sdk-core/core/src/lib.rs +16 -9
- package/sdk-core/core/src/protosext/mod.rs +1 -1
- package/sdk-core/core/src/replay/mod.rs +16 -27
- package/sdk-core/core/src/telemetry/log_export.rs +1 -1
- package/sdk-core/core/src/telemetry/metrics.rs +69 -35
- package/sdk-core/core/src/telemetry/mod.rs +60 -21
- package/sdk-core/core/src/telemetry/prometheus_server.rs +19 -13
- package/sdk-core/core/src/test_help/mod.rs +73 -14
- package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +119 -160
- package/sdk-core/core/src/worker/activities/activity_task_poller_stream.rs +89 -0
- package/sdk-core/core/src/worker/activities/local_activities.rs +379 -129
- package/sdk-core/core/src/worker/activities.rs +350 -175
- package/sdk-core/core/src/worker/client/mocks.rs +22 -2
- package/sdk-core/core/src/worker/client.rs +18 -2
- package/sdk-core/core/src/worker/mod.rs +183 -64
- package/sdk-core/core/src/worker/workflow/bridge.rs +1 -3
- package/sdk-core/core/src/worker/workflow/driven_workflow.rs +3 -5
- package/sdk-core/core/src/worker/workflow/history_update.rs +916 -277
- package/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +216 -183
- package/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +9 -12
- package/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +7 -9
- package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +160 -87
- package/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +13 -14
- package/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +7 -9
- package/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +14 -17
- package/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +242 -110
- package/sdk-core/core/src/worker/workflow/machines/mod.rs +27 -19
- package/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +9 -11
- package/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +321 -206
- package/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +13 -18
- package/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +20 -29
- package/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +2 -2
- package/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +257 -51
- package/sdk-core/core/src/worker/workflow/machines/workflow_machines/local_acts.rs +6 -17
- package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +310 -150
- package/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +17 -20
- package/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +31 -15
- package/sdk-core/core/src/worker/workflow/managed_run.rs +1052 -380
- package/sdk-core/core/src/worker/workflow/mod.rs +598 -390
- package/sdk-core/core/src/worker/workflow/run_cache.rs +40 -57
- package/sdk-core/core/src/worker/workflow/wft_extraction.rs +137 -0
- package/sdk-core/core/src/worker/workflow/wft_poller.rs +1 -4
- package/sdk-core/core/src/worker/workflow/workflow_stream/saved_wf_inputs.rs +117 -0
- package/sdk-core/core/src/worker/workflow/workflow_stream/tonic_status_serde.rs +24 -0
- package/sdk-core/core/src/worker/workflow/workflow_stream.rs +469 -718
- package/sdk-core/core-api/Cargo.toml +2 -1
- package/sdk-core/core-api/src/errors.rs +1 -34
- package/sdk-core/core-api/src/lib.rs +19 -9
- package/sdk-core/core-api/src/telemetry.rs +4 -6
- package/sdk-core/core-api/src/worker.rs +19 -1
- package/sdk-core/etc/deps.svg +115 -140
- package/sdk-core/etc/regen-depgraph.sh +5 -0
- package/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +86 -61
- package/sdk-core/fsm/rustfsm_trait/src/lib.rs +29 -71
- package/sdk-core/histories/ends_empty_wft_complete.bin +0 -0
- package/sdk-core/histories/evict_while_la_running_no_interference-16_history.bin +0 -0
- package/sdk-core/histories/old_change_marker_format.bin +0 -0
- package/sdk-core/protos/api_upstream/.github/CODEOWNERS +2 -1
- package/sdk-core/protos/api_upstream/Makefile +6 -6
- package/sdk-core/protos/api_upstream/build/go.mod +7 -0
- package/sdk-core/protos/api_upstream/build/go.sum +5 -0
- package/sdk-core/protos/api_upstream/build/tools.go +29 -0
- package/sdk-core/protos/api_upstream/go.mod +6 -0
- package/sdk-core/protos/api_upstream/temporal/api/batch/v1/message.proto +9 -2
- package/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +7 -26
- package/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +13 -2
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/batch_operation.proto +3 -2
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/command_type.proto +3 -7
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/common.proto +3 -2
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/event_type.proto +8 -8
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +25 -2
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/namespace.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/query.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/reset.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/schedule.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/update.proto +24 -19
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/workflow.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/errordetails/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/failure/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/filter/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +49 -26
- package/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +4 -2
- package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +5 -2
- package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/protocol/v1/message.proto +57 -0
- package/sdk-core/protos/api_upstream/temporal/api/query/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/replication/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/schedule/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/sdk/v1/task_complete_metadata.proto +63 -0
- package/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/update/v1/message.proto +71 -6
- package/sdk-core/protos/api_upstream/temporal/api/version/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/workflow/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +64 -28
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +4 -4
- package/sdk-core/protos/local/temporal/sdk/core/activity_result/activity_result.proto +7 -8
- package/sdk-core/protos/local/temporal/sdk/core/activity_task/activity_task.proto +10 -7
- package/sdk-core/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +19 -30
- package/sdk-core/protos/local/temporal/sdk/core/common/common.proto +1 -0
- package/sdk-core/protos/local/temporal/sdk/core/core_interface.proto +1 -0
- package/sdk-core/protos/local/temporal/sdk/core/external_data/external_data.proto +8 -0
- package/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +67 -60
- package/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +85 -84
- package/sdk-core/protos/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +9 -3
- package/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +2 -2
- package/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto +2 -2
- package/sdk-core/sdk/Cargo.toml +5 -4
- package/sdk-core/sdk/src/lib.rs +108 -26
- package/sdk-core/sdk/src/workflow_context/options.rs +7 -1
- package/sdk-core/sdk/src/workflow_context.rs +24 -17
- package/sdk-core/sdk/src/workflow_future.rs +16 -15
- package/sdk-core/sdk-core-protos/Cargo.toml +5 -2
- package/sdk-core/sdk-core-protos/build.rs +36 -2
- package/sdk-core/sdk-core-protos/src/history_builder.rs +138 -106
- package/sdk-core/sdk-core-protos/src/history_info.rs +10 -1
- package/sdk-core/sdk-core-protos/src/lib.rs +272 -87
- package/sdk-core/sdk-core-protos/src/task_token.rs +12 -2
- package/sdk-core/test-utils/Cargo.toml +3 -1
- package/sdk-core/test-utils/src/canned_histories.rs +106 -296
- package/sdk-core/test-utils/src/histfetch.rs +1 -1
- package/sdk-core/test-utils/src/lib.rs +82 -23
- package/sdk-core/test-utils/src/wf_input_saver.rs +50 -0
- package/sdk-core/test-utils/src/workflows.rs +29 -0
- package/sdk-core/tests/fuzzy_workflow.rs +130 -0
- package/sdk-core/tests/{load_tests.rs → heavy_tests.rs} +125 -51
- package/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +25 -3
- package/sdk-core/tests/integ_tests/heartbeat_tests.rs +10 -5
- package/sdk-core/tests/integ_tests/metrics_tests.rs +218 -16
- package/sdk-core/tests/integ_tests/polling_tests.rs +4 -47
- package/sdk-core/tests/integ_tests/queries_tests.rs +5 -128
- package/sdk-core/tests/integ_tests/visibility_tests.rs +83 -25
- package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +161 -72
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +1 -0
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +6 -13
- package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +80 -3
- package/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +6 -2
- package/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +3 -10
- package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +94 -200
- package/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +2 -4
- package/sdk-core/tests/integ_tests/workflow_tests/patches.rs +34 -28
- package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +76 -7
- package/sdk-core/tests/integ_tests/workflow_tests/resets.rs +1 -0
- package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +18 -14
- package/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +6 -20
- package/sdk-core/tests/integ_tests/workflow_tests/timers.rs +10 -21
- package/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +7 -8
- package/sdk-core/tests/integ_tests/workflow_tests.rs +13 -14
- package/sdk-core/tests/main.rs +3 -13
- package/sdk-core/tests/runner.rs +75 -36
- package/sdk-core/tests/wf_input_replay.rs +32 -0
- package/src/conversions.rs +14 -8
- package/src/runtime.rs +9 -8
- package/ts/index.ts +8 -6
- package/sdk-core/bridge-ffi/Cargo.toml +0 -24
- package/sdk-core/bridge-ffi/LICENSE.txt +0 -23
- package/sdk-core/bridge-ffi/build.rs +0 -25
- package/sdk-core/bridge-ffi/include/sdk-core-bridge.h +0 -224
- package/sdk-core/bridge-ffi/src/lib.rs +0 -746
- package/sdk-core/bridge-ffi/src/wrappers.rs +0 -221
- package/sdk-core/protos/local/temporal/sdk/core/bridge/bridge.proto +0 -210
- package/sdk-core/sdk/src/conversions.rs +0 -8
package/src/conversions.rs
CHANGED
|
@@ -14,14 +14,15 @@ use temporal_sdk_core::{
|
|
|
14
14
|
},
|
|
15
15
|
api::worker::{WorkerConfig, WorkerConfigBuilder},
|
|
16
16
|
ephemeral_server::{
|
|
17
|
-
|
|
17
|
+
TemporalDevServerConfig, TemporalDevServerConfigBuilder, TestServerConfig,
|
|
18
|
+
TestServerConfigBuilder,
|
|
18
19
|
},
|
|
19
20
|
ClientOptions, ClientOptionsBuilder, ClientTlsConfig, RetryConfig, TlsConfig, Url,
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
pub enum EphemeralServerConfig {
|
|
23
24
|
TestServer(TestServerConfig),
|
|
24
|
-
|
|
25
|
+
DevServer(TemporalDevServerConfig),
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
pub trait ArrayHandleConversionsExt {
|
|
@@ -323,6 +324,10 @@ impl ObjectHandleConversionsExt for Handle<'_, JsObject> {
|
|
|
323
324
|
js_optional_getter!(cx, self, "maxTaskQueueActivitiesPerSecond", JsNumber)
|
|
324
325
|
.map(|num| num.value(cx) as f64);
|
|
325
326
|
|
|
327
|
+
let graceful_shutdown_period =
|
|
328
|
+
js_optional_getter!(cx, self, "shutdownGraceTimeMs", JsNumber)
|
|
329
|
+
.map(|num| Duration::from_millis(num.value(cx) as u64));
|
|
330
|
+
|
|
326
331
|
match WorkerConfigBuilder::default()
|
|
327
332
|
.worker_build_id(js_value_getter!(cx, self, "buildId", JsString))
|
|
328
333
|
.client_identity_override(Some(js_value_getter!(cx, self, "identity", JsString)))
|
|
@@ -332,6 +337,7 @@ impl ObjectHandleConversionsExt for Handle<'_, JsObject> {
|
|
|
332
337
|
.max_outstanding_local_activities(max_outstanding_local_activities)
|
|
333
338
|
.max_cached_workflows(max_cached_workflows)
|
|
334
339
|
.sticky_queue_schedule_to_start_timeout(sticky_queue_schedule_to_start_timeout)
|
|
340
|
+
.graceful_shutdown_period(graceful_shutdown_period)
|
|
335
341
|
.namespace(namespace)
|
|
336
342
|
.task_queue(task_queue)
|
|
337
343
|
.max_heartbeat_throttle_interval(max_heartbeat_throttle_interval)
|
|
@@ -374,7 +380,7 @@ impl ObjectHandleConversionsExt for Handle<'_, JsObject> {
|
|
|
374
380
|
|
|
375
381
|
let exec_version = match version.as_str() {
|
|
376
382
|
"default" => {
|
|
377
|
-
temporal_sdk_core::ephemeral_server::EphemeralExeVersion::
|
|
383
|
+
temporal_sdk_core::ephemeral_server::EphemeralExeVersion::SDKDefault {
|
|
378
384
|
sdk_name: "sdk-typescript".to_owned(),
|
|
379
385
|
sdk_version,
|
|
380
386
|
}
|
|
@@ -398,8 +404,8 @@ impl ObjectHandleConversionsExt for Handle<'_, JsObject> {
|
|
|
398
404
|
|
|
399
405
|
let server_type = js_value_getter!(cx, self, "type", JsString);
|
|
400
406
|
match server_type.as_str() {
|
|
401
|
-
"
|
|
402
|
-
let mut config =
|
|
407
|
+
"dev-server" => {
|
|
408
|
+
let mut config = TemporalDevServerConfigBuilder::default();
|
|
403
409
|
config.exe(executable).port(port);
|
|
404
410
|
|
|
405
411
|
if let Some(extra_args) = js_optional_getter!(cx, self, "extraArgs", JsArray) {
|
|
@@ -422,9 +428,9 @@ impl ObjectHandleConversionsExt for Handle<'_, JsObject> {
|
|
|
422
428
|
}
|
|
423
429
|
|
|
424
430
|
match config.build() {
|
|
425
|
-
Ok(config) => Ok(EphemeralServerConfig::
|
|
431
|
+
Ok(config) => Ok(EphemeralServerConfig::DevServer(config)),
|
|
426
432
|
Err(err) => {
|
|
427
|
-
cx.throw_type_error(format!("Invalid
|
|
433
|
+
cx.throw_type_error(format!("Invalid dev server config: {:?}", err))
|
|
428
434
|
}
|
|
429
435
|
}
|
|
430
436
|
}
|
|
@@ -445,7 +451,7 @@ impl ObjectHandleConversionsExt for Handle<'_, JsObject> {
|
|
|
445
451
|
}
|
|
446
452
|
}
|
|
447
453
|
s => cx.throw_type_error(format!(
|
|
448
|
-
"Invalid ephemeral server type: {}, expected '
|
|
454
|
+
"Invalid ephemeral server type: {}, expected 'dev-server' or 'time-skipping'",
|
|
449
455
|
s
|
|
450
456
|
)),
|
|
451
457
|
}
|
package/src/runtime.rs
CHANGED
|
@@ -144,13 +144,16 @@ pub fn start_bridge_loop(
|
|
|
144
144
|
headers,
|
|
145
145
|
callback,
|
|
146
146
|
} => {
|
|
147
|
-
// `metrics_meter`
|
|
148
|
-
//
|
|
149
|
-
//
|
|
150
|
-
// us.
|
|
147
|
+
// `metrics_meter` can be None here since we don't use the returned client
|
|
148
|
+
// directly at the moment, when we repurpose the client to be used by a Worker,
|
|
149
|
+
// `init_worker` will attach the correct metrics meter for us.
|
|
151
150
|
core_runtime.tokio_handle().spawn(async move {
|
|
151
|
+
let metrics_meter = None;
|
|
152
152
|
match options
|
|
153
|
-
.connect_no_namespace(
|
|
153
|
+
.connect_no_namespace(
|
|
154
|
+
metrics_meter,
|
|
155
|
+
headers.map(|h| Arc::new(RwLock::new(h))),
|
|
156
|
+
)
|
|
154
157
|
.await
|
|
155
158
|
{
|
|
156
159
|
Err(err) => {
|
|
@@ -270,9 +273,7 @@ pub fn start_bridge_loop(
|
|
|
270
273
|
EphemeralServerConfig::TestServer(config) => {
|
|
271
274
|
config.start_server().await
|
|
272
275
|
}
|
|
273
|
-
EphemeralServerConfig::
|
|
274
|
-
config.start_server().await
|
|
275
|
-
}
|
|
276
|
+
EphemeralServerConfig::DevServer(config) => config.start_server().await,
|
|
276
277
|
};
|
|
277
278
|
match result {
|
|
278
279
|
Err(err) => {
|
package/ts/index.ts
CHANGED
|
@@ -381,10 +381,10 @@ export interface TimeSkippingServerConfig {
|
|
|
381
381
|
}
|
|
382
382
|
|
|
383
383
|
/**
|
|
384
|
-
* Configuration for
|
|
384
|
+
* Configuration for the Temporal CLI dev server.
|
|
385
385
|
*/
|
|
386
|
-
export interface
|
|
387
|
-
type: '
|
|
386
|
+
export interface DevServerConfig {
|
|
387
|
+
type: 'dev-server';
|
|
388
388
|
executable?: EphemeralServerExecutable;
|
|
389
389
|
/**
|
|
390
390
|
* Namespace to use - created at startup.
|
|
@@ -399,11 +399,13 @@ export interface TemporaliteConfig {
|
|
|
399
399
|
*/
|
|
400
400
|
ip?: string;
|
|
401
401
|
/**
|
|
402
|
-
* Sqlite DB filename if persisting or non-persistent if none.
|
|
402
|
+
* Sqlite DB filename if persisting or non-persistent if none (default).
|
|
403
403
|
*/
|
|
404
404
|
db_filename?: string;
|
|
405
405
|
/**
|
|
406
406
|
* Whether to enable the UI.
|
|
407
|
+
*
|
|
408
|
+
* @default false
|
|
407
409
|
*/
|
|
408
410
|
ui?: boolean;
|
|
409
411
|
/**
|
|
@@ -424,9 +426,9 @@ export interface TemporaliteConfig {
|
|
|
424
426
|
/**
|
|
425
427
|
* Configuration for spawning an ephemeral Temporal server.
|
|
426
428
|
*
|
|
427
|
-
* Both the time-skipping test server and
|
|
429
|
+
* Both the time-skipping test server and Temporal CLI dev server are supported.
|
|
428
430
|
*/
|
|
429
|
-
export type EphemeralServerConfig = TimeSkippingServerConfig |
|
|
431
|
+
export type EphemeralServerConfig = TimeSkippingServerConfig | DevServerConfig;
|
|
430
432
|
|
|
431
433
|
export interface Worker {
|
|
432
434
|
type: 'Worker';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
[package]
|
|
2
|
-
name = "temporal-sdk-core-bridge-ffi"
|
|
3
|
-
version = "0.1.0"
|
|
4
|
-
edition = "2021"
|
|
5
|
-
license-file = "LICENSE.txt"
|
|
6
|
-
description = "FFI Bridge for Core"
|
|
7
|
-
homepage = "https://temporal.io/"
|
|
8
|
-
repository = "https://github.com/temporalio/sdk-core"
|
|
9
|
-
|
|
10
|
-
[lib]
|
|
11
|
-
crate-type = ["staticlib"]
|
|
12
|
-
|
|
13
|
-
[dependencies]
|
|
14
|
-
lazy_static = "1.4"
|
|
15
|
-
libc = "0.2"
|
|
16
|
-
prost = "0.11"
|
|
17
|
-
temporal-sdk-core = { version = "0.1", path = "../core" }
|
|
18
|
-
temporal-sdk-core-api = { version = "0.1", path = "../core-api" }
|
|
19
|
-
temporal-sdk-core-protos = { version = "0.1", path = "../sdk-core-protos" }
|
|
20
|
-
tokio = "1"
|
|
21
|
-
tracing = "0.1"
|
|
22
|
-
|
|
23
|
-
[build-dependencies]
|
|
24
|
-
cbindgen = "0.24"
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
Temporal Core SDK
|
|
2
|
-
|
|
3
|
-
The MIT License
|
|
4
|
-
|
|
5
|
-
Copyright (c) 2022 Temporal Technologies, Inc. All Rights Reserved
|
|
6
|
-
|
|
7
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
in the Software without restriction, including without limitation the rights
|
|
10
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
furnished to do so, subject to the following conditions:
|
|
13
|
-
|
|
14
|
-
The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
copies or substantial portions of the Software.
|
|
16
|
-
|
|
17
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
SOFTWARE.
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
extern crate cbindgen;
|
|
2
|
-
|
|
3
|
-
use std::env;
|
|
4
|
-
|
|
5
|
-
fn main() {
|
|
6
|
-
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
|
7
|
-
|
|
8
|
-
let changed = cbindgen::Builder::new()
|
|
9
|
-
.with_crate(crate_dir)
|
|
10
|
-
.with_pragma_once(true)
|
|
11
|
-
.with_language(cbindgen::Language::C)
|
|
12
|
-
.generate()
|
|
13
|
-
.expect("Unable to generate bindings")
|
|
14
|
-
.write_to_file("include/sdk-core-bridge.h");
|
|
15
|
-
|
|
16
|
-
// If this changed and an env var disallows change, error
|
|
17
|
-
if let Ok(env_val) = env::var("TEMPORAL_SDK_CORE_BRIDGE_FFI_DISABLE_HEADER_CHANGE") {
|
|
18
|
-
if changed && env_val == "true" {
|
|
19
|
-
println!(
|
|
20
|
-
"cargo:warning=bridge-ffi's header file changed unexpectedly from what's on disk"
|
|
21
|
-
);
|
|
22
|
-
std::process::exit(1);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <stdarg.h>
|
|
4
|
-
#include <stdbool.h>
|
|
5
|
-
#include <stdint.h>
|
|
6
|
-
#include <stdlib.h>
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* A client instance owned by Core. This must be passed to [tmprl_client_free]
|
|
10
|
-
* when no longer in use which will free the resources.
|
|
11
|
-
*/
|
|
12
|
-
typedef struct tmprl_client_t tmprl_client_t;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* A runtime owned by Core. This must be passed to [tmprl_runtime_free] when no longer in use. This
|
|
16
|
-
* should not be freed until every call to every [tmprl_worker_t] instance created with this
|
|
17
|
-
* runtime has been shutdown. In practice, since the actual runtime is behind an [Arc], it's
|
|
18
|
-
* currently OK, but that's an implementation detail.
|
|
19
|
-
*/
|
|
20
|
-
typedef struct tmprl_runtime_t tmprl_runtime_t;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* A worker instance owned by Core. This must be passed to [tmprl_worker_shutdown]
|
|
24
|
-
* when no longer in use which will free the resources.
|
|
25
|
-
*/
|
|
26
|
-
typedef struct tmprl_worker_t tmprl_worker_t;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* A set of bytes owned by Core. No fields within nor any bytes references must
|
|
30
|
-
* ever be mutated outside of Core. This must always be passed to
|
|
31
|
-
* tmprl_bytes_free when no longer in use.
|
|
32
|
-
*/
|
|
33
|
-
typedef struct tmprl_bytes_t {
|
|
34
|
-
const uint8_t *bytes;
|
|
35
|
-
size_t len;
|
|
36
|
-
/**
|
|
37
|
-
* For internal use only.
|
|
38
|
-
*/
|
|
39
|
-
size_t cap;
|
|
40
|
-
/**
|
|
41
|
-
* For internal use only.
|
|
42
|
-
*/
|
|
43
|
-
bool disable_free;
|
|
44
|
-
} tmprl_bytes_t;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Callback called by [tmprl_worker_init] on completion. The first parameter of the
|
|
48
|
-
* callback is user data passed into the original function. The second
|
|
49
|
-
* parameter is a worker instance if the call is successful or null if not. If
|
|
50
|
-
* present, the worker instance must be freed via [tmprl_worker_shutdown] when no
|
|
51
|
-
* longer in use. The third parameter of the callback is a byte array for a
|
|
52
|
-
* [InitResponse] protobuf message which must be freed via [tmprl_bytes_free].
|
|
53
|
-
*/
|
|
54
|
-
typedef void (*tmprl_worker_init_callback)(void *user_data, struct tmprl_worker_t *worker, const struct tmprl_bytes_t *resp);
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Callback called on function completion. The first parameter of the callback
|
|
58
|
-
* is user data passed into the original function. The second parameter of the
|
|
59
|
-
* callback is a never-null byte array for a response protobuf message which
|
|
60
|
-
* must be freed via [tmprl_bytes_free].
|
|
61
|
-
*/
|
|
62
|
-
typedef void (*tmprl_callback)(void *user_data, const struct tmprl_bytes_t *core);
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Callback called by [tmprl_client_init] on completion. The first parameter of the
|
|
66
|
-
* callback is user data passed into the original function. The second
|
|
67
|
-
* parameter is a client instance if the call is successful or null if not. If
|
|
68
|
-
* present, the client instance must be freed via [tmprl_client_free] when no
|
|
69
|
-
* longer in use. The third parameter of the callback is a byte array for a
|
|
70
|
-
* [InitResponse] protobuf message which must be freed via [tmprl_bytes_free].
|
|
71
|
-
*/
|
|
72
|
-
typedef void (*tmprl_client_init_callback)(void *user_data, struct tmprl_client_t *client, const struct tmprl_bytes_t *resp);
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Free a set of bytes. The first parameter can be null in cases where a [tmprl_worker_t] instance
|
|
76
|
-
* isn't available. If the second parameter is null, this is a no-op.
|
|
77
|
-
*/
|
|
78
|
-
void tmprl_bytes_free(struct tmprl_worker_t *worker, const struct tmprl_bytes_t *bytes);
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Create a new runtime. The result is never null and must be freed via
|
|
82
|
-
* tmprl_runtime_free when no longer in use.
|
|
83
|
-
*/
|
|
84
|
-
struct tmprl_runtime_t *tmprl_runtime_new(void);
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Free a previously created runtime.
|
|
88
|
-
*/
|
|
89
|
-
void tmprl_runtime_free(struct tmprl_runtime_t *runtime);
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Create a new worker instance.
|
|
93
|
-
*
|
|
94
|
-
* `runtime` and `client` are both required and must outlive this instance.
|
|
95
|
-
* `req_proto` and `req_proto_len` represent a byte array for a [CreateWorkerRequest] protobuf
|
|
96
|
-
* message.
|
|
97
|
-
* The callback is invoked on completion.
|
|
98
|
-
*/
|
|
99
|
-
void tmprl_worker_init(struct tmprl_runtime_t *runtime,
|
|
100
|
-
struct tmprl_client_t *client,
|
|
101
|
-
const uint8_t *req_proto,
|
|
102
|
-
size_t req_proto_len,
|
|
103
|
-
void *user_data,
|
|
104
|
-
tmprl_worker_init_callback callback);
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Shutdown and free a previously created worker.
|
|
108
|
-
*
|
|
109
|
-
* The req_proto and req_proto_len represent a byte array for a [bridge::ShutdownWorkerRequest]
|
|
110
|
-
* protobuf message, which currently contains nothing and are unused, but the parameters are kept
|
|
111
|
-
* for now.
|
|
112
|
-
*
|
|
113
|
-
* The callback is invoked on completion with a ShutdownWorkerResponse protobuf message.
|
|
114
|
-
*
|
|
115
|
-
* After the callback has been called, the worker struct will be freed and the pointer will no
|
|
116
|
-
* longer be valid.
|
|
117
|
-
*/
|
|
118
|
-
void tmprl_worker_shutdown(struct tmprl_worker_t *worker,
|
|
119
|
-
const uint8_t *req_proto,
|
|
120
|
-
size_t req_proto_len,
|
|
121
|
-
void *user_data,
|
|
122
|
-
tmprl_callback callback);
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Initialize a client connection to the Temporal service.
|
|
126
|
-
*
|
|
127
|
-
* The runtime is required and must outlive this instance. The `req_proto` and `req_proto_len`
|
|
128
|
-
* represent a byte array for a [CreateClientRequest] protobuf message. The callback is invoked on
|
|
129
|
-
* completion.
|
|
130
|
-
*/
|
|
131
|
-
void tmprl_client_init(struct tmprl_runtime_t *runtime,
|
|
132
|
-
const uint8_t *req_proto,
|
|
133
|
-
size_t req_proto_len,
|
|
134
|
-
void *user_data,
|
|
135
|
-
tmprl_client_init_callback callback);
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Free a previously created client
|
|
139
|
-
*/
|
|
140
|
-
void tmprl_client_free(struct tmprl_client_t *client);
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Poll for a workflow activation.
|
|
144
|
-
*
|
|
145
|
-
* The `req_proto` and `req_proto_len` represent a byte array for a
|
|
146
|
-
* [bridge::PollWorkflowActivationRequest] protobuf message, which currently contains nothing and
|
|
147
|
-
* is unused, but the parameters are kept for now.
|
|
148
|
-
*
|
|
149
|
-
* The callback is invoked on completion with a [bridge::PollWorkflowActivationResponse] protobuf
|
|
150
|
-
* message.
|
|
151
|
-
*/
|
|
152
|
-
void tmprl_poll_workflow_activation(struct tmprl_worker_t *worker,
|
|
153
|
-
const uint8_t *req_proto,
|
|
154
|
-
size_t req_proto_len,
|
|
155
|
-
void *user_data,
|
|
156
|
-
tmprl_callback callback);
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Poll for an activity task.
|
|
160
|
-
*
|
|
161
|
-
* The `req_proto` and `req_proto_len` represent a byte array for a
|
|
162
|
-
* [bridge::PollActivityTaskRequest] protobuf message, which currently contains nothing and is
|
|
163
|
-
* unused, but the parameters are kept for now.
|
|
164
|
-
*
|
|
165
|
-
* The callback is invoked on completion with a [bridge::PollActivityTaskResponse] protobuf
|
|
166
|
-
* message.
|
|
167
|
-
*/
|
|
168
|
-
void tmprl_poll_activity_task(struct tmprl_worker_t *worker,
|
|
169
|
-
const uint8_t *req_proto,
|
|
170
|
-
size_t req_proto_len,
|
|
171
|
-
void *user_data,
|
|
172
|
-
tmprl_callback callback);
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Complete a workflow activation.
|
|
176
|
-
*
|
|
177
|
-
* The `req_proto` and `req_proto_len` represent a byte array for a
|
|
178
|
-
* [bridge::CompleteWorkflowActivationRequest] protobuf message. The callback is invoked on
|
|
179
|
-
* completion with a [bridge::CompleteWorkflowActivationResponse] protobuf message.
|
|
180
|
-
*/
|
|
181
|
-
void tmprl_complete_workflow_activation(struct tmprl_worker_t *worker,
|
|
182
|
-
const uint8_t *req_proto,
|
|
183
|
-
size_t req_proto_len,
|
|
184
|
-
void *user_data,
|
|
185
|
-
tmprl_callback callback);
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Complete an activity task.
|
|
189
|
-
*
|
|
190
|
-
* The `req_proto` and `req_proto_len` represent a byte array for a
|
|
191
|
-
* [bridge::CompleteActivityTaskRequest] protobuf message. The callback is invoked on completion
|
|
192
|
-
* with a [bridge::CompleteActivityTaskResponse] protobuf message.
|
|
193
|
-
*/
|
|
194
|
-
void tmprl_complete_activity_task(struct tmprl_worker_t *worker,
|
|
195
|
-
const uint8_t *req_proto,
|
|
196
|
-
size_t req_proto_len,
|
|
197
|
-
void *user_data,
|
|
198
|
-
tmprl_callback callback);
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Record an activity heartbeat.
|
|
202
|
-
*
|
|
203
|
-
* `req_proto` and `req_proto_len` represent a byte array for a
|
|
204
|
-
* [bridge::RecordActivityHeartbeatRequest] protobuf message. The callback is invoked on completion
|
|
205
|
-
* with a RecordActivityHeartbeatResponse protobuf message.
|
|
206
|
-
*/
|
|
207
|
-
void tmprl_record_activity_heartbeat(struct tmprl_worker_t *worker,
|
|
208
|
-
const uint8_t *req_proto,
|
|
209
|
-
size_t req_proto_len,
|
|
210
|
-
void *user_data,
|
|
211
|
-
tmprl_callback callback);
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Request a workflow eviction.
|
|
215
|
-
*
|
|
216
|
-
* The `req_proto` and `req_proto_len` represent a byte array for a
|
|
217
|
-
* [bridge::RequestWorkflowEvictionRequest] protobuf message. The callback is invoked on completion
|
|
218
|
-
* with a [bridge::RequestWorkflowEvictionResponse] protobuf message.
|
|
219
|
-
*/
|
|
220
|
-
void tmprl_request_workflow_eviction(struct tmprl_worker_t *worker,
|
|
221
|
-
const uint8_t *req_proto,
|
|
222
|
-
size_t req_proto_len,
|
|
223
|
-
void *user_data,
|
|
224
|
-
tmprl_callback callback);
|