Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 65 additions & 5 deletions temporalio/bridge/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion temporalio/bridge/sdk-core
Submodule sdk-core updated 60 files
+4 −3 .github/workflows/per-pr.yml
+1 −1 crates/client/Cargo.toml
+80 −147 crates/client/src/lib.rs
+15 −8 crates/client/src/raw.rs
+40 −0 crates/client/src/request_extensions.rs
+17 −15 crates/client/src/retry.rs
+2 −5 crates/client/src/worker/mod.rs
+3 −3 crates/client/src/workflow_handle/mod.rs
+2 −2 crates/common/src/envconfig.rs
+4 −1 crates/common/src/lib.rs
+1 −0 crates/common/src/protos/mod.rs
+2 −0 crates/common/src/telemetry.rs
+3 −0 crates/common/src/worker.rs
+4 −4 crates/sdk-core-c-bridge/include/temporal-sdk-core-c-bridge.h
+43 −31 crates/sdk-core-c-bridge/src/client.rs
+1 −1 crates/sdk-core-c-bridge/src/lib.rs
+2 −2 crates/sdk-core-c-bridge/src/runtime.rs
+8 −8 crates/sdk-core-c-bridge/src/tests/context.rs
+2 −3 crates/sdk-core-c-bridge/src/tests/utils.rs
+17 −18 crates/sdk-core/src/core_tests/workers.rs
+3 −3 crates/sdk-core/src/ephemeral_server/mod.rs
+3 −5 crates/sdk-core/src/histfetch.rs
+2 −1 crates/sdk-core/src/internal_flags.rs
+3 −3 crates/sdk-core/src/lib.rs
+2 −2 crates/sdk-core/src/pollers/mod.rs
+3 −1 crates/sdk-core/src/pollers/poll_buffer.rs
+2 −2 crates/sdk-core/src/telemetry/mod.rs
+1 −1 crates/sdk-core/src/telemetry/prometheus_server.rs
+1 −2 crates/sdk-core/src/test_help/integ_helpers.rs
+6 −4 crates/sdk-core/src/worker/client.rs
+1 −1 crates/sdk-core/src/worker/client/mocks.rs
+4 −4 crates/sdk-core/src/worker/heartbeat.rs
+4 −7 crates/sdk-core/src/worker/mod.rs
+1 −1 crates/sdk-core/src/worker/slot_provider.rs
+3 −3 crates/sdk-core/src/worker/tuner.rs
+4 −1 crates/sdk-core/tests/common/fake_grpc_server.rs
+23 −25 crates/sdk-core/tests/common/mod.rs
+5 −4 crates/sdk-core/tests/heavy_tests.rs
+5 −5 crates/sdk-core/tests/integ_tests/client_tests.rs
+2 −3 crates/sdk-core/tests/integ_tests/ephemeral_server_tests.rs
+2 −3 crates/sdk-core/tests/integ_tests/metrics_tests.rs
+8 −12 crates/sdk-core/tests/integ_tests/polling_tests.rs
+1 −1 crates/sdk-core/tests/integ_tests/update_tests.rs
+23 −18 crates/sdk-core/tests/integ_tests/visibility_tests.rs
+2 −2 crates/sdk-core/tests/integ_tests/worker_tests.rs
+2 −2 crates/sdk-core/tests/integ_tests/workflow_tests.rs
+9 −7 crates/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs
+7 −5 crates/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs
+1 −1 crates/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs
+7 −5 crates/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs
+9 −7 crates/sdk-core/tests/integ_tests/workflow_tests/determinism.rs
+10 −8 crates/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs
+1 −1 crates/sdk-core/tests/integ_tests/workflow_tests/nexus.rs
+3 −4 crates/sdk-core/tests/integ_tests/workflow_tests/signals.rs
+1 −1 crates/sdk-core/tests/integ_tests/workflow_tests/timers.rs
+12 −10 crates/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs
+11 −9 crates/sdk-core/tests/manual_tests.rs
+6 −4 crates/sdk-core/tests/shared_tests/mod.rs
+2 −2 crates/sdk-core/tests/shared_tests/priority.rs
+7 −8 crates/sdk/src/lib.rs
53 changes: 26 additions & 27 deletions temporalio/bridge/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ use temporalio_client::tonic::{
metadata::{AsciiMetadataKey, AsciiMetadataValue, BinaryMetadataKey, BinaryMetadataValue},
};
use temporalio_client::{
ClientKeepAliveConfig as CoreClientKeepAliveConfig, ClientOptions, ClientOptionsBuilder,
ConfiguredClient, HttpConnectProxyOptions, RetryClient, RetryConfig, TemporalServiceClient,
TlsConfig,
ClientKeepAliveOptions, ClientOptions, ConfiguredClient, HttpConnectProxyOptions, RetryClient,
RetryOptions, TemporalServiceClient, TlsOptions,
};
use url::Url;

Expand Down Expand Up @@ -229,47 +228,47 @@ impl TryFrom<ClientConfig> for ClientOptions {
type Error = PyErr;

fn try_from(opts: ClientConfig) -> PyResult<Self> {
let mut gateway_opts = ClientOptionsBuilder::default();
let gateway_opts = ClientOptions::builder();
let (ascii_headers, binary_headers) = partition_headers(opts.metadata);
gateway_opts
let tls_options = if let Some(tls_config) = opts.tls_config {
Some(tls_config.try_into()?)
} else {
None
};
let gateway_opts = gateway_opts
.target_url(
Url::parse(&opts.target_url)
.map_err(|err| PyValueError::new_err(format!("invalid target URL: {err}")))?,
)
.client_name(opts.client_name)
.client_version(opts.client_version)
.identity(opts.identity)
.retry_config(
.retry_options(
opts.retry_config
.map_or(RetryConfig::default(), |c| c.into()),
.map_or(RetryOptions::default(), |c| c.into()),
)
.keep_alive(opts.keep_alive_config.map(Into::into))
.http_connect_proxy(opts.http_connect_proxy_config.map(Into::into))
.headers(Some(ascii_headers))
.binary_headers(Some(binary_headers))
.api_key(opts.api_key);
// Builder does not allow us to set option here, so we have to make
// a conditional to even call it
if let Some(tls_config) = opts.tls_config {
gateway_opts.tls_cfg(tls_config.try_into()?);
}
gateway_opts
.build()
.map_err(|err| PyValueError::new_err(format!("Invalid client config: {err}")))
.maybe_http_connect_proxy(opts.http_connect_proxy_config.map(Into::into))
.headers(ascii_headers)
.binary_headers(binary_headers)
.maybe_api_key(opts.api_key)
.maybe_tls_options(tls_options);

Ok(gateway_opts.build())
}
}

impl TryFrom<ClientTlsConfig> for temporalio_client::TlsConfig {
impl TryFrom<ClientTlsConfig> for temporalio_client::TlsOptions {
type Error = PyErr;

fn try_from(conf: ClientTlsConfig) -> PyResult<Self> {
Ok(TlsConfig {
Ok(TlsOptions {
server_root_ca_cert: conf.server_root_ca_cert,
domain: conf.domain,
client_tls_config: match (conf.client_cert, conf.client_private_key) {
client_tls_options: match (conf.client_cert, conf.client_private_key) {
(None, None) => None,
(Some(client_cert), Some(client_private_key)) => {
Some(temporalio_client::ClientTlsConfig {
Some(temporalio_client::ClientTlsOptions {
client_cert,
client_private_key,
})
Expand All @@ -284,9 +283,9 @@ impl TryFrom<ClientTlsConfig> for temporalio_client::TlsConfig {
}
}

impl From<ClientRetryConfig> for RetryConfig {
impl From<ClientRetryConfig> for RetryOptions {
fn from(conf: ClientRetryConfig) -> Self {
RetryConfig {
RetryOptions {
initial_interval: Duration::from_millis(conf.initial_interval_millis),
randomization_factor: conf.randomization_factor,
multiplier: conf.multiplier,
Expand All @@ -297,9 +296,9 @@ impl From<ClientRetryConfig> for RetryConfig {
}
}

impl From<ClientKeepAliveConfig> for CoreClientKeepAliveConfig {
impl From<ClientKeepAliveConfig> for ClientKeepAliveOptions {
fn from(conf: ClientKeepAliveConfig) -> Self {
CoreClientKeepAliveConfig {
ClientKeepAliveOptions {
interval: Duration::from_millis(conf.interval_millis),
timeout: Duration::from_millis(conf.timeout_millis),
}
Expand Down
Loading