@temporalio/core-bridge 1.15.0 → 1.16.1
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 +172 -70
- package/lib/native.d.ts +1 -1
- package/package.json +2 -2
- 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/.github/workflows/per-pr.yml +6 -6
- package/sdk-core/AGENTS.md +41 -30
- package/sdk-core/Cargo.toml +3 -0
- package/sdk-core/README.md +15 -9
- package/sdk-core/crates/client/Cargo.toml +4 -0
- package/sdk-core/crates/client/README.md +139 -0
- package/sdk-core/crates/client/src/async_activity_handle.rs +297 -0
- package/sdk-core/crates/client/src/callback_based.rs +7 -0
- package/sdk-core/crates/client/src/errors.rs +294 -0
- package/sdk-core/crates/client/src/{raw.rs → grpc.rs} +280 -159
- package/sdk-core/crates/client/src/lib.rs +920 -1326
- package/sdk-core/crates/client/src/metrics.rs +24 -33
- package/sdk-core/crates/client/src/options_structs.rs +457 -0
- package/sdk-core/crates/client/src/replaceable.rs +5 -4
- package/sdk-core/crates/client/src/request_extensions.rs +8 -9
- package/sdk-core/crates/client/src/retry.rs +99 -54
- package/sdk-core/crates/client/src/{worker/mod.rs → worker.rs} +1 -1
- package/sdk-core/crates/client/src/workflow_handle.rs +826 -0
- package/sdk-core/crates/common/Cargo.toml +61 -2
- package/sdk-core/crates/common/build.rs +742 -12
- package/sdk-core/crates/common/protos/api_upstream/.github/workflows/ci.yml +2 -0
- package/sdk-core/crates/common/protos/api_upstream/Makefile +2 -1
- package/sdk-core/crates/common/protos/api_upstream/buf.yaml +0 -3
- package/sdk-core/crates/common/protos/api_upstream/cmd/check-path-conflicts/main.go +137 -0
- package/sdk-core/crates/common/protos/api_upstream/openapi/openapiv2.json +1166 -770
- package/sdk-core/crates/common/protos/api_upstream/openapi/openapiv3.yaml +1243 -750
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/deployment/v1/message.proto +2 -2
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/enums/v1/workflow.proto +4 -3
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/failure/v1/message.proto +1 -0
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/history/v1/message.proto +4 -0
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/namespace/v1/message.proto +6 -0
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/nexus/v1/message.proto +16 -1
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +64 -6
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +88 -33
- package/sdk-core/crates/common/protos/local/temporal/sdk/core/nexus/nexus.proto +4 -2
- package/sdk-core/crates/common/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +4 -0
- package/sdk-core/crates/common/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +5 -5
- package/sdk-core/crates/common/src/activity_definition.rs +20 -0
- package/sdk-core/crates/common/src/data_converters.rs +770 -0
- package/sdk-core/crates/common/src/envconfig.rs +5 -0
- package/sdk-core/crates/common/src/lib.rs +15 -211
- package/sdk-core/crates/common/src/payload_visitor.rs +648 -0
- package/sdk-core/crates/common/src/priority.rs +110 -0
- package/sdk-core/crates/common/src/protos/canned_histories.rs +3 -0
- package/sdk-core/crates/common/src/protos/history_builder.rs +45 -0
- package/sdk-core/crates/common/src/protos/history_info.rs +2 -0
- package/sdk-core/crates/common/src/protos/mod.rs +122 -27
- package/sdk-core/crates/common/src/protos/task_token.rs +3 -3
- package/sdk-core/crates/common/src/protos/utilities.rs +11 -0
- package/sdk-core/crates/{sdk-core → common}/src/telemetry/log_export.rs +5 -7
- package/sdk-core/crates/common/src/telemetry/metrics/core.rs +125 -0
- package/sdk-core/crates/common/src/telemetry/metrics.rs +268 -223
- package/sdk-core/crates/{sdk-core → common}/src/telemetry/otel.rs +8 -13
- package/sdk-core/crates/{sdk-core → common}/src/telemetry/prometheus_meter.rs +49 -50
- package/sdk-core/crates/{sdk-core → common}/src/telemetry/prometheus_server.rs +2 -3
- package/sdk-core/crates/common/src/telemetry.rs +264 -4
- package/sdk-core/crates/common/src/worker.rs +68 -603
- package/sdk-core/crates/common/src/workflow_definition.rs +60 -0
- package/sdk-core/crates/macros/Cargo.toml +5 -1
- package/sdk-core/crates/macros/src/activities_definitions.rs +585 -0
- package/sdk-core/crates/macros/src/fsm_impl.rs +507 -0
- package/sdk-core/crates/macros/src/lib.rs +138 -512
- package/sdk-core/crates/macros/src/macro_utils.rs +106 -0
- package/sdk-core/crates/macros/src/workflow_definitions.rs +1224 -0
- package/sdk-core/crates/sdk/Cargo.toml +19 -6
- package/sdk-core/crates/sdk/README.md +415 -0
- package/sdk-core/crates/sdk/src/activities.rs +417 -0
- package/sdk-core/crates/sdk/src/interceptors.rs +1 -1
- package/sdk-core/crates/sdk/src/lib.rs +757 -442
- package/sdk-core/crates/sdk/src/workflow_context/options.rs +45 -35
- package/sdk-core/crates/sdk/src/workflow_context.rs +1033 -289
- package/sdk-core/crates/sdk/src/workflow_future.rs +277 -213
- package/sdk-core/crates/sdk/src/workflows.rs +711 -0
- package/sdk-core/crates/sdk-core/Cargo.toml +57 -64
- package/sdk-core/crates/sdk-core/benches/workflow_replay_bench.rs +41 -35
- package/sdk-core/crates/sdk-core/machine_coverage/ActivityMachine_Coverage.puml +1 -1
- package/sdk-core/crates/sdk-core/src/abstractions.rs +6 -10
- package/sdk-core/crates/sdk-core/src/core_tests/activity_tasks.rs +6 -5
- package/sdk-core/crates/sdk-core/src/core_tests/mod.rs +13 -15
- package/sdk-core/crates/sdk-core/src/core_tests/queries.rs +21 -25
- package/sdk-core/crates/sdk-core/src/core_tests/replay_flag.rs +7 -10
- package/sdk-core/crates/sdk-core/src/core_tests/updates.rs +14 -17
- package/sdk-core/crates/sdk-core/src/core_tests/workers.rs +493 -26
- package/sdk-core/crates/sdk-core/src/core_tests/workflow_tasks.rs +4 -8
- package/sdk-core/crates/sdk-core/src/ephemeral_server/mod.rs +7 -7
- package/sdk-core/crates/sdk-core/src/histfetch.rs +20 -10
- package/sdk-core/crates/sdk-core/src/lib.rs +41 -111
- package/sdk-core/crates/sdk-core/src/pollers/mod.rs +4 -9
- package/sdk-core/crates/sdk-core/src/pollers/poll_buffer.rs +118 -19
- package/sdk-core/crates/sdk-core/src/protosext/mod.rs +2 -2
- package/sdk-core/crates/sdk-core/src/replay/mod.rs +14 -5
- package/sdk-core/crates/sdk-core/src/telemetry/metrics.rs +179 -196
- package/sdk-core/crates/sdk-core/src/telemetry/mod.rs +3 -280
- package/sdk-core/crates/sdk-core/src/test_help/integ_helpers.rs +6 -9
- package/sdk-core/crates/sdk-core/src/test_help/unit_helpers.rs +3 -6
- package/sdk-core/crates/sdk-core/src/worker/activities/local_activities.rs +11 -14
- package/sdk-core/crates/sdk-core/src/worker/activities.rs +16 -19
- package/sdk-core/crates/sdk-core/src/worker/client/mocks.rs +9 -5
- package/sdk-core/crates/sdk-core/src/worker/client.rs +103 -81
- package/sdk-core/crates/sdk-core/src/worker/heartbeat.rs +7 -11
- package/sdk-core/crates/sdk-core/src/worker/mod.rs +1124 -229
- package/sdk-core/crates/sdk-core/src/worker/nexus.rs +145 -23
- package/sdk-core/crates/sdk-core/src/worker/slot_provider.rs +2 -2
- package/sdk-core/crates/sdk-core/src/worker/tuner/fixed_size.rs +2 -2
- package/sdk-core/crates/sdk-core/src/worker/tuner/resource_based.rs +13 -13
- package/sdk-core/crates/sdk-core/src/worker/tuner.rs +28 -8
- package/sdk-core/crates/sdk-core/src/worker/workflow/driven_workflow.rs +9 -3
- package/sdk-core/crates/sdk-core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +21 -22
- package/sdk-core/crates/sdk-core/src/worker/workflow/machines/workflow_machines.rs +19 -4
- package/sdk-core/crates/sdk-core/src/worker/workflow/managed_run.rs +14 -18
- package/sdk-core/crates/sdk-core/src/worker/workflow/mod.rs +4 -6
- package/sdk-core/crates/sdk-core/src/worker/workflow/run_cache.rs +4 -7
- package/sdk-core/crates/sdk-core/src/worker/workflow/wft_extraction.rs +2 -4
- package/sdk-core/crates/sdk-core/src/worker/workflow/wft_poller.rs +8 -9
- package/sdk-core/crates/sdk-core/src/worker/workflow/workflow_stream.rs +1 -3
- package/sdk-core/crates/sdk-core/tests/activities_procmacro.rs +6 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/basic_pass.rs +54 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/invalid_self_type_fail.rs +18 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/invalid_self_type_fail.stderr +5 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/missing_context_fail.rs +14 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/missing_context_fail.stderr +5 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/multi_arg_pass.rs +48 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/no_input_pass.rs +14 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/no_return_type_pass.rs +19 -0
- package/sdk-core/crates/sdk-core/tests/cloud_tests.rs +14 -5
- package/sdk-core/crates/sdk-core/tests/common/activity_functions.rs +55 -0
- package/sdk-core/crates/sdk-core/tests/common/mod.rs +241 -196
- package/sdk-core/crates/sdk-core/tests/common/workflows.rs +41 -28
- package/sdk-core/crates/sdk-core/tests/global_metric_tests.rs +3 -5
- package/sdk-core/crates/sdk-core/tests/heavy_tests/fuzzy_workflow.rs +73 -64
- package/sdk-core/crates/sdk-core/tests/heavy_tests.rs +298 -252
- package/sdk-core/crates/sdk-core/tests/integ_tests/async_activity_client_tests.rs +230 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/client_tests.rs +94 -57
- package/sdk-core/crates/sdk-core/tests/integ_tests/data_converter_tests.rs +381 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +16 -12
- package/sdk-core/crates/sdk-core/tests/integ_tests/heartbeat_tests.rs +48 -40
- package/sdk-core/crates/sdk-core/tests/integ_tests/metrics_tests.rs +327 -255
- package/sdk-core/crates/sdk-core/tests/integ_tests/pagination_tests.rs +50 -45
- package/sdk-core/crates/sdk-core/tests/integ_tests/polling_tests.rs +147 -126
- package/sdk-core/crates/sdk-core/tests/integ_tests/queries_tests.rs +103 -89
- package/sdk-core/crates/sdk-core/tests/integ_tests/update_tests.rs +609 -453
- package/sdk-core/crates/sdk-core/tests/integ_tests/visibility_tests.rs +80 -62
- package/sdk-core/crates/sdk-core/tests/integ_tests/worker_heartbeat_tests.rs +360 -231
- package/sdk-core/crates/sdk-core/tests/integ_tests/worker_tests.rs +248 -185
- package/sdk-core/crates/sdk-core/tests/integ_tests/worker_versioning_tests.rs +52 -43
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_client_tests.rs +180 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/activities.rs +428 -315
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +82 -56
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +56 -28
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +364 -243
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/client_interactions.rs +552 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +101 -42
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +243 -147
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/eager.rs +98 -28
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +1475 -1036
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +73 -41
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/nexus.rs +397 -238
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/patches.rs +414 -189
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/queries.rs +415 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/replay.rs +96 -36
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/resets.rs +154 -137
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/signals.rs +183 -105
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +85 -38
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/timers.rs +142 -40
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +73 -54
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests.rs +363 -226
- package/sdk-core/crates/sdk-core/tests/main.rs +17 -15
- package/sdk-core/crates/sdk-core/tests/manual_tests.rs +207 -152
- package/sdk-core/crates/sdk-core/tests/shared_tests/mod.rs +65 -34
- package/sdk-core/crates/sdk-core/tests/shared_tests/priority.rs +107 -84
- package/sdk-core/crates/sdk-core/tests/workflows_procmacro.rs +6 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/async_query_fail.rs +26 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/async_query_fail.stderr +5 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/basic_pass.rs +49 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/minimal_pass.rs +21 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/mut_query_fail.rs +26 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/mut_query_fail.stderr +5 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/sync_run_fail.rs +21 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/sync_run_fail.stderr +5 -0
- package/sdk-core/crates/sdk-core-c-bridge/Cargo.toml +7 -1
- package/sdk-core/crates/sdk-core-c-bridge/include/temporal-sdk-core-c-bridge.h +14 -14
- package/sdk-core/crates/sdk-core-c-bridge/src/client.rs +83 -74
- package/sdk-core/crates/sdk-core-c-bridge/src/metric.rs +9 -14
- package/sdk-core/crates/sdk-core-c-bridge/src/runtime.rs +1 -2
- package/sdk-core/crates/sdk-core-c-bridge/src/tests/context.rs +13 -13
- package/sdk-core/crates/sdk-core-c-bridge/src/tests/mod.rs +6 -6
- package/sdk-core/crates/sdk-core-c-bridge/src/tests/utils.rs +3 -4
- package/sdk-core/crates/sdk-core-c-bridge/src/worker.rs +62 -75
- package/sdk-core/rustfmt.toml +2 -1
- package/src/client.rs +205 -318
- package/src/metrics.rs +22 -30
- package/src/runtime.rs +4 -5
- package/src/worker.rs +16 -19
- package/ts/native.ts +1 -1
- package/sdk-core/crates/client/src/workflow_handle/mod.rs +0 -212
- package/sdk-core/crates/common/src/errors.rs +0 -85
- package/sdk-core/crates/common/tests/worker_task_types_test.rs +0 -129
- package/sdk-core/crates/sdk/src/activity_context.rs +0 -238
- package/sdk-core/crates/sdk/src/app_data.rs +0 -37
- package/sdk-core/crates/sdk-core/tests/integ_tests/activity_functions.rs +0 -5
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/appdata_propagation.rs +0 -61
|
@@ -14,17 +14,15 @@ use std::{
|
|
|
14
14
|
time::Duration,
|
|
15
15
|
};
|
|
16
16
|
use temporalio_client::{
|
|
17
|
-
ClientKeepAliveOptions as CoreClientKeepAliveOptions,
|
|
18
|
-
|
|
19
|
-
OperatorService, RetryClient, RetryOptions, TemporalServiceClient, TestService,
|
|
20
|
-
TlsOptions as CoreTlsOptions, WorkflowService, callback_based, proxy::HttpConnectProxyOptions,
|
|
17
|
+
ClientKeepAliveOptions as CoreClientKeepAliveOptions, RetryOptions, callback_based,
|
|
18
|
+
grpc::{CloudService, HealthService, OperatorService, TestService, WorkflowService},
|
|
21
19
|
};
|
|
22
20
|
use tokio::sync::oneshot;
|
|
23
21
|
use tonic::metadata::{MetadataKey, MetadataValue};
|
|
24
22
|
use url::Url;
|
|
25
23
|
|
|
26
24
|
#[repr(C)]
|
|
27
|
-
pub struct
|
|
25
|
+
pub struct ConnectionOptions {
|
|
28
26
|
pub target_url: ByteArrayRef,
|
|
29
27
|
pub client_name: ByteArrayRef,
|
|
30
28
|
pub client_version: ByteArrayRef,
|
|
@@ -80,21 +78,21 @@ pub struct ClientHttpConnectProxyOptions {
|
|
|
80
78
|
pub password: ByteArrayRef,
|
|
81
79
|
}
|
|
82
80
|
|
|
83
|
-
type
|
|
81
|
+
type CoreConnection = temporalio_client::Connection;
|
|
84
82
|
|
|
85
|
-
pub struct
|
|
83
|
+
pub struct Connection {
|
|
86
84
|
pub(crate) runtime: Runtime,
|
|
87
|
-
pub(crate) core:
|
|
85
|
+
pub(crate) core: CoreConnection,
|
|
88
86
|
}
|
|
89
87
|
|
|
90
88
|
// Expected to outlive all async calls that use it
|
|
91
|
-
unsafe impl Send for
|
|
92
|
-
unsafe impl Sync for
|
|
89
|
+
unsafe impl Send for Connection {}
|
|
90
|
+
unsafe impl Sync for Connection {}
|
|
93
91
|
|
|
94
92
|
/// If success or fail are not null, they must be manually freed when done.
|
|
95
93
|
pub type ClientConnectCallback = unsafe extern "C" fn(
|
|
96
94
|
user_data: *mut libc::c_void,
|
|
97
|
-
success: *mut
|
|
95
|
+
success: *mut Connection,
|
|
98
96
|
fail: *const ByteArray,
|
|
99
97
|
);
|
|
100
98
|
|
|
@@ -103,14 +101,14 @@ pub type ClientConnectCallback = unsafe extern "C" fn(
|
|
|
103
101
|
#[unsafe(no_mangle)]
|
|
104
102
|
pub extern "C" fn temporal_core_client_connect(
|
|
105
103
|
runtime: *mut Runtime,
|
|
106
|
-
options: *const
|
|
104
|
+
options: *const ConnectionOptions,
|
|
107
105
|
user_data: *mut libc::c_void,
|
|
108
106
|
callback: ClientConnectCallback,
|
|
109
107
|
) {
|
|
110
108
|
let runtime = unsafe { &mut *runtime };
|
|
111
109
|
// Convert opts
|
|
112
110
|
let options = unsafe { &*options };
|
|
113
|
-
let
|
|
111
|
+
let mut connection_options: temporalio_client::ConnectionOptions = match options.try_into() {
|
|
114
112
|
Ok(v) => v,
|
|
115
113
|
Err(err) => {
|
|
116
114
|
unsafe {
|
|
@@ -126,24 +124,22 @@ pub extern "C" fn temporal_core_client_connect(
|
|
|
126
124
|
}
|
|
127
125
|
};
|
|
128
126
|
// Create override if present
|
|
129
|
-
let
|
|
130
|
-
create_callback_based_grpc_service(
|
|
131
|
-
|
|
127
|
+
if let Some(cb) = options.grpc_override_callback {
|
|
128
|
+
connection_options.service_override = Some(create_callback_based_grpc_service(
|
|
129
|
+
runtime,
|
|
130
|
+
cb,
|
|
131
|
+
options.grpc_override_callback_user_data,
|
|
132
|
+
));
|
|
133
|
+
}
|
|
132
134
|
// Spawn async call
|
|
133
135
|
let user_data = UserDataHandle(user_data);
|
|
134
|
-
|
|
136
|
+
connection_options.metrics_meter = runtime.core.telemetry().get_metric_meter();
|
|
135
137
|
runtime.core.tokio_handle().spawn(async move {
|
|
136
|
-
match
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
service_override,
|
|
140
|
-
)
|
|
141
|
-
.await
|
|
142
|
-
{
|
|
143
|
-
Ok(core) => {
|
|
144
|
-
let owned_client = Box::into_raw(Box::new(Client {
|
|
138
|
+
match temporalio_client::Connection::connect(connection_options).await {
|
|
139
|
+
Ok(connection) => {
|
|
140
|
+
let owned_client = Box::into_raw(Box::new(Connection {
|
|
145
141
|
runtime: runtime.clone(),
|
|
146
|
-
core,
|
|
142
|
+
core: connection,
|
|
147
143
|
}));
|
|
148
144
|
unsafe {
|
|
149
145
|
callback(user_data.into(), owned_client, std::ptr::null());
|
|
@@ -232,40 +228,41 @@ fn create_callback_based_grpc_service(
|
|
|
232
228
|
}
|
|
233
229
|
|
|
234
230
|
#[unsafe(no_mangle)]
|
|
235
|
-
pub extern "C" fn temporal_core_client_free(client: *mut
|
|
231
|
+
pub extern "C" fn temporal_core_client_free(client: *mut Connection) {
|
|
236
232
|
unsafe {
|
|
237
233
|
let _ = Box::from_raw(client);
|
|
238
234
|
}
|
|
239
235
|
}
|
|
240
236
|
|
|
241
237
|
#[unsafe(no_mangle)]
|
|
242
|
-
pub extern "C" fn temporal_core_client_update_metadata(
|
|
238
|
+
pub extern "C" fn temporal_core_client_update_metadata(
|
|
239
|
+
client: *mut Connection,
|
|
240
|
+
metadata: MetadataRef,
|
|
241
|
+
) {
|
|
243
242
|
let client = unsafe { &*client };
|
|
244
243
|
let _result = client
|
|
245
244
|
.core
|
|
246
|
-
.get_client()
|
|
247
245
|
.set_headers(metadata.to_string_map_on_newlines());
|
|
248
246
|
}
|
|
249
247
|
|
|
250
248
|
#[unsafe(no_mangle)]
|
|
251
249
|
pub extern "C" fn temporal_core_client_update_binary_metadata(
|
|
252
|
-
client: *mut
|
|
250
|
+
client: *mut Connection,
|
|
253
251
|
metadata: MetadataRef,
|
|
254
252
|
) {
|
|
255
253
|
let client = unsafe { &*client };
|
|
256
254
|
let _result = client
|
|
257
255
|
.core
|
|
258
|
-
.get_client()
|
|
259
256
|
.set_binary_headers(metadata.to_vec_map_on_newlines());
|
|
260
257
|
}
|
|
261
258
|
|
|
262
259
|
#[unsafe(no_mangle)]
|
|
263
|
-
pub extern "C" fn temporal_core_client_update_api_key(
|
|
260
|
+
pub extern "C" fn temporal_core_client_update_api_key(
|
|
261
|
+
client: *mut Connection,
|
|
262
|
+
api_key: ByteArrayRef,
|
|
263
|
+
) {
|
|
264
264
|
let client = unsafe { &*client };
|
|
265
|
-
client
|
|
266
|
-
.core
|
|
267
|
-
.get_client()
|
|
268
|
-
.set_api_key(api_key.to_option_string());
|
|
265
|
+
client.core.set_api_key(api_key.to_option_string());
|
|
269
266
|
}
|
|
270
267
|
|
|
271
268
|
/// Callback that is invoked for every gRPC call if set on the client options.
|
|
@@ -496,7 +493,7 @@ macro_rules! service_call {
|
|
|
496
493
|
/// Client, options, and user data must live through callback.
|
|
497
494
|
#[unsafe(no_mangle)]
|
|
498
495
|
pub extern "C" fn temporal_core_client_rpc_call(
|
|
499
|
-
client: *mut
|
|
496
|
+
client: *mut Connection,
|
|
500
497
|
options: *const RpcCallOptions,
|
|
501
498
|
user_data: *mut libc::c_void,
|
|
502
499
|
callback: ClientRpcCallCallback,
|
|
@@ -558,13 +555,15 @@ macro_rules! rpc_call_on_trait {
|
|
|
558
555
|
if $call.retry {
|
|
559
556
|
rpc_resp($trait::$call_name(&mut $client, rpc_req($call)?).await)
|
|
560
557
|
} else {
|
|
561
|
-
|
|
558
|
+
// Disable retries for this call
|
|
559
|
+
*$client.retry_options_mut() = RetryOptions::no_retries();
|
|
560
|
+
rpc_resp($trait::$call_name(&mut $client, rpc_req($call)?).await)
|
|
562
561
|
}
|
|
563
562
|
};
|
|
564
563
|
}
|
|
565
564
|
|
|
566
565
|
async fn call_workflow_service(
|
|
567
|
-
client: &
|
|
566
|
+
client: &CoreConnection,
|
|
568
567
|
call: &RpcCallOptions,
|
|
569
568
|
) -> anyhow::Result<Vec<u8>> {
|
|
570
569
|
let rpc = call.rpc.to_str();
|
|
@@ -573,6 +572,7 @@ async fn call_workflow_service(
|
|
|
573
572
|
"CountActivityExecutions" => {
|
|
574
573
|
rpc_call_on_trait!(client, call, WorkflowService, count_activity_executions)
|
|
575
574
|
}
|
|
575
|
+
"CountSchedules" => rpc_call_on_trait!(client, call, WorkflowService, count_schedules),
|
|
576
576
|
"CountWorkflowExecutions" => {
|
|
577
577
|
rpc_call_on_trait!(client, call, WorkflowService, count_workflow_executions)
|
|
578
578
|
}
|
|
@@ -964,7 +964,7 @@ async fn call_workflow_service(
|
|
|
964
964
|
}
|
|
965
965
|
|
|
966
966
|
async fn call_operator_service(
|
|
967
|
-
client: &
|
|
967
|
+
client: &CoreConnection,
|
|
968
968
|
call: &RpcCallOptions,
|
|
969
969
|
) -> anyhow::Result<Vec<u8>> {
|
|
970
970
|
let rpc = call.rpc.to_str();
|
|
@@ -1004,7 +1004,10 @@ async fn call_operator_service(
|
|
|
1004
1004
|
}
|
|
1005
1005
|
}
|
|
1006
1006
|
|
|
1007
|
-
async fn call_cloud_service(
|
|
1007
|
+
async fn call_cloud_service(
|
|
1008
|
+
client: &CoreConnection,
|
|
1009
|
+
call: &RpcCallOptions,
|
|
1010
|
+
) -> anyhow::Result<Vec<u8>> {
|
|
1008
1011
|
let rpc = call.rpc.to_str();
|
|
1009
1012
|
let mut client = client.clone();
|
|
1010
1013
|
match rpc {
|
|
@@ -1133,7 +1136,10 @@ async fn call_cloud_service(client: &CoreClient, call: &RpcCallOptions) -> anyho
|
|
|
1133
1136
|
}
|
|
1134
1137
|
}
|
|
1135
1138
|
|
|
1136
|
-
async fn call_test_service(
|
|
1139
|
+
async fn call_test_service(
|
|
1140
|
+
client: &CoreConnection,
|
|
1141
|
+
call: &RpcCallOptions,
|
|
1142
|
+
) -> anyhow::Result<Vec<u8>> {
|
|
1137
1143
|
let rpc = call.rpc.to_str();
|
|
1138
1144
|
let mut client = client.clone();
|
|
1139
1145
|
match rpc {
|
|
@@ -1150,7 +1156,7 @@ async fn call_test_service(client: &CoreClient, call: &RpcCallOptions) -> anyhow
|
|
|
1150
1156
|
}
|
|
1151
1157
|
|
|
1152
1158
|
async fn call_health_service(
|
|
1153
|
-
client: &
|
|
1159
|
+
client: &CoreConnection,
|
|
1154
1160
|
call: &RpcCallOptions,
|
|
1155
1161
|
) -> anyhow::Result<Vec<u8>> {
|
|
1156
1162
|
let rpc = call.rpc.to_str();
|
|
@@ -1197,10 +1203,10 @@ where
|
|
|
1197
1203
|
Ok(res?.get_ref().encode_to_vec())
|
|
1198
1204
|
}
|
|
1199
1205
|
|
|
1200
|
-
impl TryFrom<&
|
|
1206
|
+
impl TryFrom<&ConnectionOptions> for temporalio_client::ConnectionOptions {
|
|
1201
1207
|
type Error = anyhow::Error;
|
|
1202
1208
|
|
|
1203
|
-
fn try_from(opts: &
|
|
1209
|
+
fn try_from(opts: &ConnectionOptions) -> anyhow::Result<Self> {
|
|
1204
1210
|
let tls_cfg = unsafe { opts.tls_options.as_ref() }
|
|
1205
1211
|
.map(|c| c.try_into())
|
|
1206
1212
|
.transpose()?;
|
|
@@ -1227,30 +1233,31 @@ impl TryFrom<&ClientOptions> for CoreClientOptions {
|
|
|
1227
1233
|
let http_connect_proxy =
|
|
1228
1234
|
unsafe { opts.http_connect_proxy_options.as_ref() }.map(Into::into);
|
|
1229
1235
|
|
|
1230
|
-
Ok(
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1236
|
+
Ok(
|
|
1237
|
+
temporalio_client::ConnectionOptions::new(Url::parse(opts.target_url.to_str())?)
|
|
1238
|
+
.client_name(opts.client_name.to_string())
|
|
1239
|
+
.client_version(opts.client_version.to_string())
|
|
1240
|
+
.identity(opts.identity.to_string())
|
|
1241
|
+
.retry_options(
|
|
1242
|
+
unsafe { opts.retry_options.as_ref() }
|
|
1243
|
+
.map_or(RetryOptions::default(), |c| c.into()),
|
|
1244
|
+
)
|
|
1245
|
+
.keep_alive(keep_alive)
|
|
1246
|
+
.maybe_headers(headers)
|
|
1247
|
+
.maybe_binary_headers(binary_headers)
|
|
1248
|
+
.maybe_api_key(api_key)
|
|
1249
|
+
.maybe_http_connect_proxy(http_connect_proxy)
|
|
1250
|
+
.maybe_tls_options(tls_cfg)
|
|
1251
|
+
.build(),
|
|
1252
|
+
)
|
|
1246
1253
|
}
|
|
1247
1254
|
}
|
|
1248
1255
|
|
|
1249
|
-
impl TryFrom<&ClientTlsOptions> for
|
|
1256
|
+
impl TryFrom<&ClientTlsOptions> for temporalio_client::TlsOptions {
|
|
1250
1257
|
type Error = anyhow::Error;
|
|
1251
1258
|
|
|
1252
1259
|
fn try_from(opts: &ClientTlsOptions) -> anyhow::Result<Self> {
|
|
1253
|
-
Ok(
|
|
1260
|
+
Ok(temporalio_client::TlsOptions {
|
|
1254
1261
|
server_root_ca_cert: opts.server_root_ca_cert.to_option_vec(),
|
|
1255
1262
|
domain: opts.domain.to_option_string(),
|
|
1256
1263
|
client_tls_options: match (
|
|
@@ -1258,10 +1265,12 @@ impl TryFrom<&ClientTlsOptions> for CoreTlsOptions {
|
|
|
1258
1265
|
opts.client_private_key.to_option_vec(),
|
|
1259
1266
|
) {
|
|
1260
1267
|
(None, None) => None,
|
|
1261
|
-
(Some(client_cert), Some(client_private_key)) =>
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1268
|
+
(Some(client_cert), Some(client_private_key)) => {
|
|
1269
|
+
Some(temporalio_client::ClientTlsOptions {
|
|
1270
|
+
client_cert,
|
|
1271
|
+
client_private_key,
|
|
1272
|
+
})
|
|
1273
|
+
}
|
|
1265
1274
|
_ => {
|
|
1266
1275
|
return Err(anyhow::anyhow!(
|
|
1267
1276
|
"Must have both client cert and private key or neither"
|
|
@@ -1272,9 +1281,9 @@ impl TryFrom<&ClientTlsOptions> for CoreTlsOptions {
|
|
|
1272
1281
|
}
|
|
1273
1282
|
}
|
|
1274
1283
|
|
|
1275
|
-
impl From<&ClientRetryOptions> for RetryOptions {
|
|
1284
|
+
impl From<&ClientRetryOptions> for temporalio_client::RetryOptions {
|
|
1276
1285
|
fn from(opts: &ClientRetryOptions) -> Self {
|
|
1277
|
-
RetryOptions {
|
|
1286
|
+
temporalio_client::RetryOptions {
|
|
1278
1287
|
initial_interval: Duration::from_millis(opts.initial_interval_millis),
|
|
1279
1288
|
randomization_factor: opts.randomization_factor,
|
|
1280
1289
|
multiplier: opts.multiplier,
|
|
@@ -1289,18 +1298,18 @@ impl From<&ClientRetryOptions> for RetryOptions {
|
|
|
1289
1298
|
}
|
|
1290
1299
|
}
|
|
1291
1300
|
|
|
1292
|
-
impl From<&ClientKeepAliveOptions> for
|
|
1301
|
+
impl From<&ClientKeepAliveOptions> for temporalio_client::ClientKeepAliveOptions {
|
|
1293
1302
|
fn from(opts: &ClientKeepAliveOptions) -> Self {
|
|
1294
|
-
|
|
1303
|
+
temporalio_client::ClientKeepAliveOptions {
|
|
1295
1304
|
interval: Duration::from_millis(opts.interval_millis),
|
|
1296
1305
|
timeout: Duration::from_millis(opts.timeout_millis),
|
|
1297
1306
|
}
|
|
1298
1307
|
}
|
|
1299
1308
|
}
|
|
1300
1309
|
|
|
1301
|
-
impl From<&ClientHttpConnectProxyOptions> for HttpConnectProxyOptions {
|
|
1310
|
+
impl From<&ClientHttpConnectProxyOptions> for temporalio_client::proxy::HttpConnectProxyOptions {
|
|
1302
1311
|
fn from(opts: &ClientHttpConnectProxyOptions) -> Self {
|
|
1303
|
-
HttpConnectProxyOptions {
|
|
1312
|
+
temporalio_client::proxy::HttpConnectProxyOptions {
|
|
1304
1313
|
target_addr: opts.target_host.to_string(),
|
|
1305
1314
|
basic_auth: if opts.username.size != 0 && opts.password.size != 0 {
|
|
1306
1315
|
Some((opts.username.to_string(), opts.password.to_string()))
|
|
@@ -57,10 +57,7 @@ pub extern "C" fn temporal_core_metric_attributes_new(
|
|
|
57
57
|
size: libc::size_t,
|
|
58
58
|
) -> *mut MetricAttributes {
|
|
59
59
|
let meter = unsafe { &*meter };
|
|
60
|
-
let orig = meter
|
|
61
|
-
.core
|
|
62
|
-
.inner
|
|
63
|
-
.new_attributes(meter.core.default_attribs.clone());
|
|
60
|
+
let orig = meter.core.get_default_attributes().clone();
|
|
64
61
|
Box::into_raw(Box::new(metric_attributes_append(
|
|
65
62
|
meter, &orig, attrs, size,
|
|
66
63
|
)))
|
|
@@ -94,7 +91,7 @@ fn metric_attributes_append(
|
|
|
94
91
|
size: libc::size_t,
|
|
95
92
|
) -> MetricAttributes {
|
|
96
93
|
let attrs = unsafe { std::slice::from_raw_parts(attrs, size) };
|
|
97
|
-
let core = meter.core.
|
|
94
|
+
let core = meter.core.extend_attributes(
|
|
98
95
|
orig.clone(),
|
|
99
96
|
metrics::NewAttributes {
|
|
100
97
|
attributes: attrs.iter().map(metric_attribute_to_key_value).collect(),
|
|
@@ -158,20 +155,18 @@ pub extern "C" fn temporal_core_metric_new(
|
|
|
158
155
|
let meter = unsafe { &*meter };
|
|
159
156
|
let options = unsafe { &*options };
|
|
160
157
|
Box::into_raw(Box::new(match options.kind {
|
|
161
|
-
MetricKind::CounterInteger =>
|
|
162
|
-
Metric::CounterInteger(meter.core.inner.counter(options.into()))
|
|
163
|
-
}
|
|
158
|
+
MetricKind::CounterInteger => Metric::CounterInteger(meter.core.counter(options.into())),
|
|
164
159
|
MetricKind::HistogramInteger => {
|
|
165
|
-
Metric::HistogramInteger(meter.core.
|
|
160
|
+
Metric::HistogramInteger(meter.core.histogram(options.into()))
|
|
166
161
|
}
|
|
167
162
|
MetricKind::HistogramFloat => {
|
|
168
|
-
Metric::HistogramFloat(meter.core.
|
|
163
|
+
Metric::HistogramFloat(meter.core.histogram_f64(options.into()))
|
|
169
164
|
}
|
|
170
165
|
MetricKind::HistogramDuration => {
|
|
171
|
-
Metric::HistogramDuration(meter.core.
|
|
166
|
+
Metric::HistogramDuration(meter.core.histogram_duration(options.into()))
|
|
172
167
|
}
|
|
173
|
-
MetricKind::GaugeInteger => Metric::GaugeInteger(meter.core.
|
|
174
|
-
MetricKind::GaugeFloat => Metric::GaugeFloat(meter.core.
|
|
168
|
+
MetricKind::GaugeInteger => Metric::GaugeInteger(meter.core.gauge(options.into())),
|
|
169
|
+
MetricKind::GaugeFloat => Metric::GaugeFloat(meter.core.gauge_f64(options.into())),
|
|
175
170
|
}))
|
|
176
171
|
}
|
|
177
172
|
|
|
@@ -483,7 +478,7 @@ struct CustomMetricAttributes {
|
|
|
483
478
|
unsafe impl Send for CustomMetricAttributes {}
|
|
484
479
|
unsafe impl Sync for CustomMetricAttributes {}
|
|
485
480
|
|
|
486
|
-
impl metrics::CustomMetricAttributes for CustomMetricAttributes {
|
|
481
|
+
impl metrics::core::CustomMetricAttributes for CustomMetricAttributes {
|
|
487
482
|
fn as_any(self: Arc<Self>) -> Arc<dyn Any + Send + Sync> {
|
|
488
483
|
self as Arc<dyn Any + Send + Sync>
|
|
489
484
|
}
|
|
@@ -18,11 +18,10 @@ use std::{
|
|
|
18
18
|
use temporalio_common::telemetry::{
|
|
19
19
|
CoreLog, CoreLogConsumer, HistogramBucketOverrides, Logger, MetricTemporality,
|
|
20
20
|
OtelCollectorOptions, PrometheusExporterOptions, TelemetryOptions as CoreTelemetryOptions,
|
|
21
|
-
metrics::CoreMeter,
|
|
21
|
+
build_otlp_metric_exporter, metrics::CoreMeter, start_prometheus_metric_exporter,
|
|
22
22
|
};
|
|
23
23
|
use temporalio_sdk_core::{
|
|
24
24
|
CoreRuntime, RuntimeOptions as CoreRuntimeOptions, TokioRuntimeBuilder as TokioRuntime,
|
|
25
|
-
telemetry::{build_otlp_metric_exporter, start_prometheus_metric_exporter},
|
|
26
25
|
};
|
|
27
26
|
use tracing::Level;
|
|
28
27
|
use url::Url;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
use crate::{
|
|
2
2
|
client::{
|
|
3
|
-
|
|
4
|
-
ClientTlsOptions, GrpcMetadataHolder, RpcCallOptions,
|
|
5
|
-
temporal_core_client_free, temporal_core_client_rpc_call,
|
|
3
|
+
ClientHttpConnectProxyOptions, ClientKeepAliveOptions, ClientRetryOptions,
|
|
4
|
+
ClientTlsOptions, Connection, GrpcMetadataHolder, RpcCallOptions,
|
|
5
|
+
temporal_core_client_connect, temporal_core_client_free, temporal_core_client_rpc_call,
|
|
6
6
|
},
|
|
7
7
|
runtime::{
|
|
8
8
|
Runtime, RuntimeOptions, RuntimeOrFail, temporal_core_byte_array_free,
|
|
@@ -29,7 +29,7 @@ use std::{
|
|
|
29
29
|
sync::{Arc, Condvar, Mutex, MutexGuard, PoisonError, Weak},
|
|
30
30
|
time::Duration,
|
|
31
31
|
};
|
|
32
|
-
use temporalio_client::
|
|
32
|
+
use temporalio_client::ConnectionOptions;
|
|
33
33
|
use temporalio_sdk_core::ephemeral_server::{
|
|
34
34
|
EphemeralExe, EphemeralExeVersion, TemporalDevServerConfig,
|
|
35
35
|
};
|
|
@@ -48,7 +48,7 @@ struct InnerContext {
|
|
|
48
48
|
runtime: *mut Runtime,
|
|
49
49
|
ephemeral_server: *mut EphemeralServer,
|
|
50
50
|
ephemeral_server_target: String,
|
|
51
|
-
client: *mut
|
|
51
|
+
client: *mut Connection,
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
unsafe impl Send for InnerContext {}
|
|
@@ -104,7 +104,7 @@ impl Context {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
#[allow(dead_code)]
|
|
107
|
-
pub fn client(&self) -> anyhow::Result<Option<NonNull<
|
|
107
|
+
pub fn client(&self) -> anyhow::Result<Option<NonNull<Connection>>> {
|
|
108
108
|
Ok(NonNull::new(self.wait_for_available()?.client))
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -279,13 +279,13 @@ impl Context {
|
|
|
279
279
|
self.wait_for_operation()
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
pub fn client_connect(self: &Arc<Self>, options: Box<
|
|
282
|
+
pub fn client_connect(self: &Arc<Self>, options: Box<ConnectionOptions>) -> anyhow::Result<()> {
|
|
283
283
|
Self::client_connect_with_override(self, options, None, std::ptr::null_mut())
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
pub fn client_connect_with_override(
|
|
287
287
|
self: &Arc<Self>,
|
|
288
|
-
options: Box<
|
|
288
|
+
options: Box<ConnectionOptions>,
|
|
289
289
|
grpc_override_callback: crate::client::ClientGrpcOverrideCallback,
|
|
290
290
|
grpc_override_callback_user_data: *mut libc::c_void,
|
|
291
291
|
) -> anyhow::Result<()> {
|
|
@@ -340,10 +340,10 @@ impl Context {
|
|
|
340
340
|
})
|
|
341
341
|
});
|
|
342
342
|
|
|
343
|
-
let client_options = Box::new(crate::client::
|
|
344
|
-
target_url: options.
|
|
345
|
-
client_name: options.
|
|
346
|
-
client_version: options.
|
|
343
|
+
let client_options = Box::new(crate::client::ConnectionOptions {
|
|
344
|
+
target_url: options.target.as_str().into(),
|
|
345
|
+
client_name: options.get_client_name().into(),
|
|
346
|
+
client_version: options.get_client_version().into(),
|
|
347
347
|
metadata: metadata.as_ref().into(),
|
|
348
348
|
binary_metadata: binary_metadata.as_ref().into(),
|
|
349
349
|
api_key: options.api_key.as_deref().into(),
|
|
@@ -582,7 +582,7 @@ extern "C" fn ephemeral_server_shutdown_callback(
|
|
|
582
582
|
|
|
583
583
|
extern "C" fn client_connect_callback(
|
|
584
584
|
user_data: *mut libc::c_void,
|
|
585
|
-
mut client: *mut
|
|
585
|
+
mut client: *mut Connection,
|
|
586
586
|
mut fail: *const ByteArray,
|
|
587
587
|
) {
|
|
588
588
|
let user_data = unsafe { Box::from_raw(user_data as *mut CallbackUserData<(), Context>) };
|
|
@@ -9,7 +9,7 @@ use crate::{
|
|
|
9
9
|
temporal_core_client_grpc_override_request_service,
|
|
10
10
|
},
|
|
11
11
|
tests::utils::{
|
|
12
|
-
OwnedRpcCallOptions, RpcCallError,
|
|
12
|
+
OwnedRpcCallOptions, RpcCallError, default_connection_options, default_server_config,
|
|
13
13
|
},
|
|
14
14
|
};
|
|
15
15
|
use base64::{Engine, engine::general_purpose::STANDARD_NO_PAD};
|
|
@@ -38,7 +38,7 @@ fn test_get_system_info() {
|
|
|
38
38
|
.start_dev_server(Box::new(default_server_config()))
|
|
39
39
|
.unwrap();
|
|
40
40
|
context
|
|
41
|
-
.client_connect(Box::new(
|
|
41
|
+
.client_connect(Box::new(default_connection_options(
|
|
42
42
|
&context.ephemeral_server_target().unwrap().unwrap(),
|
|
43
43
|
)))
|
|
44
44
|
.unwrap();
|
|
@@ -88,7 +88,7 @@ fn test_missing_rpc_call_has_expected_error_message() {
|
|
|
88
88
|
.start_dev_server(Box::new(default_server_config()))
|
|
89
89
|
.unwrap();
|
|
90
90
|
context
|
|
91
|
-
.client_connect(Box::new(
|
|
91
|
+
.client_connect(Box::new(default_connection_options(
|
|
92
92
|
&context.ephemeral_server_target().unwrap().unwrap(),
|
|
93
93
|
)))
|
|
94
94
|
.unwrap();
|
|
@@ -152,7 +152,7 @@ fn test_all_rpc_calls_exist() {
|
|
|
152
152
|
.start_dev_server(Box::new(default_server_config()))
|
|
153
153
|
.unwrap();
|
|
154
154
|
context
|
|
155
|
-
.client_connect(Box::new(
|
|
155
|
+
.client_connect(Box::new(default_connection_options(
|
|
156
156
|
&context.ephemeral_server_target().unwrap().unwrap(),
|
|
157
157
|
)))
|
|
158
158
|
.unwrap();
|
|
@@ -299,7 +299,7 @@ fn test_simple_callback_override() {
|
|
|
299
299
|
// Create client which will invoke GetSystemInfo
|
|
300
300
|
context
|
|
301
301
|
.client_connect_with_override(
|
|
302
|
-
Box::new(
|
|
302
|
+
Box::new(default_connection_options("127.0.0.1:4567")),
|
|
303
303
|
Some(callback_override),
|
|
304
304
|
&mut user_data as *mut String as *mut libc::c_void,
|
|
305
305
|
)
|
|
@@ -392,7 +392,7 @@ fn test_callback_override_with_headers() {
|
|
|
392
392
|
context.runtime_new().unwrap();
|
|
393
393
|
|
|
394
394
|
// Prepare client options with headers
|
|
395
|
-
let mut client_options =
|
|
395
|
+
let mut client_options = default_connection_options("127.0.0.1:4567");
|
|
396
396
|
client_options.headers = Some(HashMap::from([(
|
|
397
397
|
"x-test".to_owned(),
|
|
398
398
|
"client-ascii".to_owned(),
|
|
@@ -4,7 +4,7 @@ use crate::{
|
|
|
4
4
|
runtime::{Runtime, temporal_core_byte_array_free},
|
|
5
5
|
};
|
|
6
6
|
use std::ops::Deref;
|
|
7
|
-
use temporalio_client::
|
|
7
|
+
use temporalio_client::ConnectionOptions;
|
|
8
8
|
use temporalio_sdk_core::ephemeral_server::{TemporalDevServerConfig, default_cached_download};
|
|
9
9
|
use url::Url;
|
|
10
10
|
|
|
@@ -34,9 +34,8 @@ pub fn default_server_config() -> TemporalDevServerConfig {
|
|
|
34
34
|
.build()
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
pub fn
|
|
38
|
-
|
|
39
|
-
.target_url(Url::parse(&format!("http://{target}")).unwrap())
|
|
37
|
+
pub fn default_connection_options(target: &str) -> ConnectionOptions {
|
|
38
|
+
ConnectionOptions::new(Url::parse(&format!("http://{target}")).unwrap())
|
|
40
39
|
.client_name("core-c-bridge-tests".to_owned())
|
|
41
40
|
.client_version("0.1.0".to_owned())
|
|
42
41
|
.build()
|