Skip to content

Commit

Permalink
Rust / Packages upgrade (#880)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sushisource authored Feb 21, 2025
1 parent 6e60111 commit a3cd3fa
Show file tree
Hide file tree
Showing 115 changed files with 1,058 additions and 982 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/per-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.84.0
toolchain: 1.85.0
- name: Install protoc
uses: arduino/setup-protoc@v3
with:
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.84.0
toolchain: 1.85.0
- name: Install protoc
uses: arduino/setup-protoc@v3
with:
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.84.0
toolchain: 1.85.0
- name: Install protoc
uses: arduino/setup-protoc@v3
with:
Expand All @@ -125,7 +125,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.84.0
toolchain: 1.85.0
- name: Install protoc
uses: arduino/setup-protoc@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license-file = "LICENSE.txt"

[workspace.dependencies]
derive_builder = "0.20"
derive_more = { version = "1.0", features = ["constructor", "display", "from", "into", "debug"] }
derive_more = { version = "2.0", features = ["constructor", "display", "from", "into", "debug"] }
thiserror = "2"
tonic = "0.12"
tonic-build = "0.12"
Expand Down
3 changes: 1 addition & 2 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "temporal-client"
version = "0.1.0"
edition = "2021"
edition = "2024"
authors = ["Spencer Judge <spencer@temporal.io>"]
license-file = { workspace = true }
description = "Clients for interacting with Temporal Clusters"
Expand All @@ -28,7 +28,6 @@ hyper = { version = "1.4.1" }
hyper-util = "0.1.6"
opentelemetry = { workspace = true, features = ["metrics"], optional = true }
parking_lot = "0.12"
prost-types = { workspace = true }
slotmap = "1.0"
thiserror = { workspace = true }
tokio = "1.1"
Expand Down
12 changes: 6 additions & 6 deletions client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mod workflow_handle;

pub use crate::{
proxy::HttpConnectProxyOptions,
retry::{CallType, RetryClient, RETRYABLE_ERROR_CODES},
retry::{CallType, RETRYABLE_ERROR_CODES, RetryClient},
};
pub use metrics::{LONG_REQUEST_LATENCY_HISTOGRAM_NAME, REQUEST_LATENCY_HISTOGRAM_NAME};
pub use raw::{CloudService, HealthService, OperatorService, TestService, WorkflowService};
Expand All @@ -36,12 +36,12 @@ pub use workflow_handle::{

use crate::{
metrics::{GrpcMetricSvc, MetricsContext},
raw::{sealed::RawClientLike, AttachMetricLabels},
raw::{AttachMetricLabels, sealed::RawClientLike},
sealed::WfHandleClient,
workflow_handle::UntypedWorkflowHandle,
};
use backoff::{exponential, ExponentialBackoff, SystemClock};
use http::{uri::InvalidUri, Uri};
use backoff::{ExponentialBackoff, SystemClock, exponential};
use http::{Uri, uri::InvalidUri};
use parking_lot::RwLock;
use std::{
collections::HashMap,
Expand All @@ -53,6 +53,7 @@ use std::{
};
use temporal_sdk_core_api::telemetry::metrics::TemporalMeter;
use temporal_sdk_core_protos::{
TaskToken,
coresdk::IntoPayloadsExt,
grpc::health::v1::health_client::HealthClient,
temporal::api::{
Expand All @@ -68,16 +69,15 @@ use temporal_sdk_core_protos::{
update,
workflowservice::v1::{workflow_service_client::WorkflowServiceClient, *},
},
TaskToken,
};
use tonic::{
Code, Status,
body::BoxBody,
client::GrpcService,
codegen::InterceptedService,
metadata::{MetadataKey, MetadataMap, MetadataValue},
service::Interceptor,
transport::{Certificate, Channel, Endpoint, Identity},
Code, Status,
};
use tower::ServiceBuilder;
use url::Url;
Expand Down
4 changes: 2 additions & 2 deletions client/src/metrics.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{AttachMetricLabels, CallType};
use futures_util::{future::BoxFuture, FutureExt};
use futures_util::{FutureExt, future::BoxFuture};
use std::{
sync::Arc,
task::{Context, Poll},
Expand All @@ -9,7 +9,7 @@ use temporal_sdk_core_api::telemetry::metrics::{
CoreMeter, Counter, HistogramDuration, MetricAttributes, MetricKeyValue, MetricParameters,
TemporalMeter,
};
use tonic::{body::BoxBody, transport::Channel, Code};
use tonic::{Code, body::BoxBody, transport::Channel};
use tower::Service;

/// The string name (which may be prefixed) for this metric
Expand Down
2 changes: 1 addition & 1 deletion client/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::{
};
use tokio::net::TcpStream;
use tonic::transport::{Channel, Endpoint};
use tower::{service_fn, Service};
use tower::{Service, service_fn};

/// Options for HTTP CONNECT proxy.
#[derive(Clone, Debug)]
Expand Down
28 changes: 16 additions & 12 deletions client/src/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
//! happen.
use crate::{
Client, ConfiguredClient, InterceptedMetricsSvc, LONG_POLL_TIMEOUT, RequestExt, RetryClient,
TEMPORAL_NAMESPACE_HEADER_KEY, TemporalServiceClient,
metrics::{namespace_kv, task_queue_kv},
raw::sealed::RawClientLike,
worker_registry::{Slot, SlotManager},
Client, ConfiguredClient, InterceptedMetricsSvc, RequestExt, RetryClient,
TemporalServiceClient, LONG_POLL_TIMEOUT, TEMPORAL_NAMESPACE_HEADER_KEY,
};
use futures_util::{future::BoxFuture, FutureExt, TryFutureExt};
use futures_util::{FutureExt, TryFutureExt, future::BoxFuture};
use std::sync::Arc;
use temporal_sdk_core_api::telemetry::metrics::MetricKeyValue;
use temporal_sdk_core_protos::{
Expand All @@ -23,10 +23,10 @@ use temporal_sdk_core_protos::{
},
};
use tonic::{
Request, Response, Status,
body::BoxBody,
client::GrpcService,
metadata::{AsciiMetadataValue, KeyAndValueRef},
Request, Response, Status,
};

pub(super) mod sealed {
Expand Down Expand Up @@ -1411,29 +1411,33 @@ mod tests {
#[test]
fn verify_all_workflow_service_methods_implemented() {
// This is less work than trying to hook into the codegen process
let proto_def =
include_str!("../../sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/service.proto");
let proto_def = include_str!(
"../../sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/service.proto"
);
verify_methods(proto_def, ALL_IMPLEMENTED_WORKFLOW_SERVICE_RPCS);
}

#[test]
fn verify_all_operator_service_methods_implemented() {
let proto_def =
include_str!("../../sdk-core-protos/protos/api_upstream/temporal/api/operatorservice/v1/service.proto");
let proto_def = include_str!(
"../../sdk-core-protos/protos/api_upstream/temporal/api/operatorservice/v1/service.proto"
);
verify_methods(proto_def, ALL_IMPLEMENTED_OPERATOR_SERVICE_RPCS);
}

#[test]
fn verify_all_cloud_service_methods_implemented() {
let proto_def =
include_str!("../../sdk-core-protos/protos/api_cloud_upstream/temporal/api/cloud/cloudservice/v1/service.proto");
let proto_def = include_str!(
"../../sdk-core-protos/protos/api_cloud_upstream/temporal/api/cloud/cloudservice/v1/service.proto"
);
verify_methods(proto_def, ALL_IMPLEMENTED_CLOUD_SERVICE_RPCS);
}

#[test]
fn verify_all_test_service_methods_implemented() {
let proto_def =
include_str!("../../sdk-core-protos/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto");
let proto_def = include_str!(
"../../sdk-core-protos/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto"
);
verify_methods(proto_def, ALL_IMPLEMENTED_TEST_SERVICE_RPCS);
}

Expand Down
4 changes: 2 additions & 2 deletions client/src/retry.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
raw::IsUserLongPoll, Client, IsWorkerTaskLongPoll, NamespacedClient, Result, RetryConfig,
Client, IsWorkerTaskLongPoll, NamespacedClient, Result, RetryConfig, raw::IsUserLongPoll,
};
use backoff::{backoff::Backoff, exponential::ExponentialBackoff, Clock, SystemClock};
use backoff::{Clock, SystemClock, backoff::Backoff, exponential::ExponentialBackoff};
use futures_retry::{ErrorHandler, FutureRetry, RetryPolicy};
use std::{error::Error, fmt::Debug, future::Future, sync::Arc, time::Duration};
use tonic::{Code, Request};
Expand Down
2 changes: 1 addition & 1 deletion client/src/worker_registry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use parking_lot::RwLock;
use slotmap::SlotMap;
use std::collections::{hash_map::Entry::Vacant, HashMap};
use std::collections::{HashMap, hash_map::Entry::Vacant};

use temporal_sdk_core_protos::temporal::api::workflowservice::v1::PollWorkflowTaskQueueResponse;

Expand Down
3 changes: 1 addition & 2 deletions core-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "temporal-sdk-core-api"
version = "0.1.0"
edition = "2021"
edition = "2024"
authors = ["Spencer Judge <spencer@temporal.io>"]
license-file = { workspace = true }
description = "Interface definitions for the Temporal Core SDK"
Expand All @@ -21,7 +21,6 @@ derive_builder = { workspace = true }
derive_more = { workspace = true }
opentelemetry = { workspace = true, optional = true }
prost = { workspace = true }
prost-types = { workspace = true }
serde_json = "1.0"
thiserror = { workspace = true }
tonic = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion core-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ use crate::{
worker::WorkerConfig,
};
use temporal_sdk_core_protos::coresdk::{
ActivityHeartbeat, ActivityTaskCompletion,
activity_task::ActivityTask,
nexus::{NexusTask, NexusTaskCompletion},
workflow_activation::WorkflowActivation,
workflow_completion::WorkflowActivationCompletion,
ActivityHeartbeat, ActivityTaskCompletion,
};

/// This trait is the primary way by which language specific SDKs interact with the core SDK.
Expand Down
2 changes: 1 addition & 1 deletion core-api/src/telemetry/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ impl CustomMetricAttributes for NoOpAttributes {
#[cfg(feature = "otel_impls")]
mod otel_impls {
use super::*;
use opentelemetry::{metrics, KeyValue};
use opentelemetry::{KeyValue, metrics};

impl From<MetricKeyValue> for KeyValue {
fn from(kv: MetricKeyValue) -> Self {
Expand Down
12 changes: 6 additions & 6 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "temporal-sdk-core"
version = "0.1.0"
authors = ["Spencer Judge <spencer@temporal.io>", "Vitaly Arbuzov <vitaly@temporal.io>"]
edition = "2021"
edition = "2024"
license-file = { workspace = true }
description = "Library for building new Temporal SDKs"
homepage = "https://temporal.io/"
Expand Down Expand Up @@ -35,12 +35,12 @@ enum-iterator = "2"
flate2 = { version = "1.0", optional = true }
futures-util = { version = "0.3", default-features = false }
futures-channel = { version = "0.3", default-features = false, features = ["std"] }
governor = "0.7"
governor = "0.8"
http-body-util = { version = "0.1", optional = true }
hyper = { version = "1.2", optional = true }
hyper-util = { version = "0.1", features = ["server", "http1", "http2", "tokio"], optional = true }
itertools = "0.13"
lru = "0.12"
itertools = "0.14"
lru = "0.13"
mockall = "0.13"
opentelemetry = { workspace = true, features = ["metrics"], optional = true }
opentelemetry_sdk = { version = "0.26", features = ["rt-tokio", "metrics"], optional = true }
Expand All @@ -52,14 +52,14 @@ pin-project = "1.0"
prometheus = "0.13"
prost = { workspace = true }
prost-types = { version = "0.6", package = "prost-wkt-types" }
rand = "0.8.3"
rand = "0.9"
reqwest = { version = "0.12", features = ["json", "stream", "rustls-tls-native-roots"], default-features = false, optional = true }
ringbuf = "0.4"
serde = "1.0"
serde_json = "1.0"
siphasher = "1.0"
slotmap = "1.0"
sysinfo = { version = "0.32", default-features = false, features = ["system"] }
sysinfo = { version = "0.33", default-features = false, features = ["system"] }
tar = { version = "0.4", optional = true }
thiserror = { workspace = true }
tokio = { version = "1.37", features = ["rt", "rt-multi-thread", "parking_lot", "time", "fs", "process"] }
Expand Down
2 changes: 1 addition & 1 deletion core/benches/workflow_replay.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use criterion::{criterion_group, criterion_main, Criterion};
use criterion::{Criterion, criterion_group, criterion_main};
use futures_util::StreamExt;
use std::time::Duration;
use temporal_sdk::{WfContext, WorkflowFunction};
Expand Down
2 changes: 1 addition & 1 deletion core/src/abstractions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use crate::MetricsContext;
use std::{
fmt::{Debug, Formatter},
sync::{
atomic::{AtomicBool, AtomicUsize, Ordering},
Arc,
atomic::{AtomicBool, AtomicUsize, Ordering},
},
};
use temporal_sdk_core_api::worker::{
Expand Down
Loading

0 comments on commit a3cd3fa

Please # to comment.