Skip to content

Commit 62b2b8a

Browse files
committed
Autoformat
1 parent d2ce031 commit 62b2b8a

File tree

95 files changed

+916
-829
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+916
-829
lines changed

client/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ mod workflow_handle;
1616

1717
pub use crate::{
1818
proxy::HttpConnectProxyOptions,
19-
retry::{CallType, RetryClient, RETRYABLE_ERROR_CODES},
19+
retry::{CallType, RETRYABLE_ERROR_CODES, RetryClient},
2020
};
2121
pub use metrics::{LONG_REQUEST_LATENCY_HISTOGRAM_NAME, REQUEST_LATENCY_HISTOGRAM_NAME};
2222
pub use raw::{CloudService, HealthService, OperatorService, TestService, WorkflowService};
@@ -36,12 +36,12 @@ pub use workflow_handle::{
3636

3737
use crate::{
3838
metrics::{GrpcMetricSvc, MetricsContext},
39-
raw::{sealed::RawClientLike, AttachMetricLabels},
39+
raw::{AttachMetricLabels, sealed::RawClientLike},
4040
sealed::WfHandleClient,
4141
workflow_handle::UntypedWorkflowHandle,
4242
};
43-
use backoff::{exponential, ExponentialBackoff, SystemClock};
44-
use http::{uri::InvalidUri, Uri};
43+
use backoff::{ExponentialBackoff, SystemClock, exponential};
44+
use http::{Uri, uri::InvalidUri};
4545
use parking_lot::RwLock;
4646
use std::{
4747
collections::HashMap,
@@ -53,6 +53,7 @@ use std::{
5353
};
5454
use temporal_sdk_core_api::telemetry::metrics::TemporalMeter;
5555
use temporal_sdk_core_protos::{
56+
TaskToken,
5657
coresdk::IntoPayloadsExt,
5758
grpc::health::v1::health_client::HealthClient,
5859
temporal::api::{
@@ -68,16 +69,15 @@ use temporal_sdk_core_protos::{
6869
update,
6970
workflowservice::v1::{workflow_service_client::WorkflowServiceClient, *},
7071
},
71-
TaskToken,
7272
};
7373
use tonic::{
74+
Code, Status,
7475
body::BoxBody,
7576
client::GrpcService,
7677
codegen::InterceptedService,
7778
metadata::{MetadataKey, MetadataMap, MetadataValue},
7879
service::Interceptor,
7980
transport::{Certificate, Channel, Endpoint, Identity},
80-
Code, Status,
8181
};
8282
use tower::ServiceBuilder;
8383
use url::Url;

client/src/metrics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::{AttachMetricLabels, CallType};
2-
use futures_util::{future::BoxFuture, FutureExt};
2+
use futures_util::{FutureExt, future::BoxFuture};
33
use std::{
44
sync::Arc,
55
task::{Context, Poll},
@@ -9,7 +9,7 @@ use temporal_sdk_core_api::telemetry::metrics::{
99
CoreMeter, Counter, HistogramDuration, MetricAttributes, MetricKeyValue, MetricParameters,
1010
TemporalMeter,
1111
};
12-
use tonic::{body::BoxBody, transport::Channel, Code};
12+
use tonic::{Code, body::BoxBody, transport::Channel};
1313
use tower::Service;
1414

1515
/// The string name (which may be prefixed) for this metric

client/src/proxy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::{
1212
};
1313
use tokio::net::TcpStream;
1414
use tonic::transport::{Channel, Endpoint};
15-
use tower::{service_fn, Service};
15+
use tower::{Service, service_fn};
1616

1717
/// Options for HTTP CONNECT proxy.
1818
#[derive(Clone, Debug)]

client/src/raw.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
//! happen.
44
55
use crate::{
6+
Client, ConfiguredClient, InterceptedMetricsSvc, LONG_POLL_TIMEOUT, RequestExt, RetryClient,
7+
TEMPORAL_NAMESPACE_HEADER_KEY, TemporalServiceClient,
68
metrics::{namespace_kv, task_queue_kv},
79
raw::sealed::RawClientLike,
810
worker_registry::{Slot, SlotManager},
9-
Client, ConfiguredClient, InterceptedMetricsSvc, RequestExt, RetryClient,
10-
TemporalServiceClient, LONG_POLL_TIMEOUT, TEMPORAL_NAMESPACE_HEADER_KEY,
1111
};
12-
use futures_util::{future::BoxFuture, FutureExt, TryFutureExt};
12+
use futures_util::{FutureExt, TryFutureExt, future::BoxFuture};
1313
use std::sync::Arc;
1414
use temporal_sdk_core_api::telemetry::metrics::MetricKeyValue;
1515
use temporal_sdk_core_protos::{
@@ -23,10 +23,10 @@ use temporal_sdk_core_protos::{
2323
},
2424
};
2525
use tonic::{
26+
Request, Response, Status,
2627
body::BoxBody,
2728
client::GrpcService,
2829
metadata::{AsciiMetadataValue, KeyAndValueRef},
29-
Request, Response, Status,
3030
};
3131

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

14191420
#[test]
14201421
fn verify_all_operator_service_methods_implemented() {
1421-
let proto_def =
1422-
include_str!("../../sdk-core-protos/protos/api_upstream/temporal/api/operatorservice/v1/service.proto");
1422+
let proto_def = include_str!(
1423+
"../../sdk-core-protos/protos/api_upstream/temporal/api/operatorservice/v1/service.proto"
1424+
);
14231425
verify_methods(proto_def, ALL_IMPLEMENTED_OPERATOR_SERVICE_RPCS);
14241426
}
14251427

14261428
#[test]
14271429
fn verify_all_cloud_service_methods_implemented() {
1428-
let proto_def =
1429-
include_str!("../../sdk-core-protos/protos/api_cloud_upstream/temporal/api/cloud/cloudservice/v1/service.proto");
1430+
let proto_def = include_str!(
1431+
"../../sdk-core-protos/protos/api_cloud_upstream/temporal/api/cloud/cloudservice/v1/service.proto"
1432+
);
14301433
verify_methods(proto_def, ALL_IMPLEMENTED_CLOUD_SERVICE_RPCS);
14311434
}
14321435

14331436
#[test]
14341437
fn verify_all_test_service_methods_implemented() {
1435-
let proto_def =
1436-
include_str!("../../sdk-core-protos/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto");
1438+
let proto_def = include_str!(
1439+
"../../sdk-core-protos/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto"
1440+
);
14371441
verify_methods(proto_def, ALL_IMPLEMENTED_TEST_SERVICE_RPCS);
14381442
}
14391443

client/src/retry.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::{
2-
raw::IsUserLongPoll, Client, IsWorkerTaskLongPoll, NamespacedClient, Result, RetryConfig,
2+
Client, IsWorkerTaskLongPoll, NamespacedClient, Result, RetryConfig, raw::IsUserLongPoll,
33
};
4-
use backoff::{backoff::Backoff, exponential::ExponentialBackoff, Clock, SystemClock};
4+
use backoff::{Clock, SystemClock, backoff::Backoff, exponential::ExponentialBackoff};
55
use futures_retry::{ErrorHandler, FutureRetry, RetryPolicy};
66
use std::{error::Error, fmt::Debug, future::Future, sync::Arc, time::Duration};
77
use tonic::{Code, Request};

client/src/worker_registry/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
use parking_lot::RwLock;
66
use slotmap::SlotMap;
7-
use std::collections::{hash_map::Entry::Vacant, HashMap};
7+
use std::collections::{HashMap, hash_map::Entry::Vacant};
88

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

core-api/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ use crate::{
1010
worker::WorkerConfig,
1111
};
1212
use temporal_sdk_core_protos::coresdk::{
13+
ActivityHeartbeat, ActivityTaskCompletion,
1314
activity_task::ActivityTask,
1415
nexus::{NexusTask, NexusTaskCompletion},
1516
workflow_activation::WorkflowActivation,
1617
workflow_completion::WorkflowActivationCompletion,
17-
ActivityHeartbeat, ActivityTaskCompletion,
1818
};
1919

2020
/// This trait is the primary way by which language specific SDKs interact with the core SDK.

core-api/src/telemetry/metrics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ impl CustomMetricAttributes for NoOpAttributes {
345345
#[cfg(feature = "otel_impls")]
346346
mod otel_impls {
347347
use super::*;
348-
use opentelemetry::{metrics, KeyValue};
348+
use opentelemetry::{KeyValue, metrics};
349349

350350
impl From<MetricKeyValue> for KeyValue {
351351
fn from(kv: MetricKeyValue) -> Self {

core/benches/workflow_replay.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use criterion::{criterion_group, criterion_main, Criterion};
1+
use criterion::{Criterion, criterion_group, criterion_main};
22
use futures_util::StreamExt;
33
use std::time::Duration;
44
use temporal_sdk::{WfContext, WorkflowFunction};

core/src/abstractions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use crate::MetricsContext;
66
use std::{
77
fmt::{Debug, Formatter},
88
sync::{
9-
atomic::{AtomicBool, AtomicUsize, Ordering},
109
Arc,
10+
atomic::{AtomicBool, AtomicUsize, Ordering},
1111
},
1212
};
1313
use temporal_sdk_core_api::worker::{

core/src/core_tests/activity_tasks.rs

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
11
use crate::{
2-
advance_fut, job_assert, prost_dur,
2+
ActivityHeartbeat, Worker, advance_fut, job_assert, prost_dur,
33
test_help::{
4-
build_fake_worker, build_mock_pollers, canned_histories, gen_assert_and_reply,
5-
mock_manual_poller, mock_poller, mock_poller_from_resps, mock_sdk_cfg, mock_worker,
6-
poll_and_reply, single_hist_mock_sg, test_worker_cfg, MockPollCfg, MockWorkerInputs,
7-
MocksHolder, QueueResponse, ResponseType, WorkerExt, WorkflowCachingPolicy, TEST_Q,
4+
MockPollCfg, MockWorkerInputs, MocksHolder, QueueResponse, ResponseType, TEST_Q, WorkerExt,
5+
WorkflowCachingPolicy, build_fake_worker, build_mock_pollers, canned_histories,
6+
gen_assert_and_reply, mock_manual_poller, mock_poller, mock_poller_from_resps,
7+
mock_sdk_cfg, mock_worker, poll_and_reply, single_hist_mock_sg, test_worker_cfg,
88
},
99
worker::client::mocks::{mock_manual_workflow_client, mock_workflow_client},
10-
ActivityHeartbeat, Worker,
1110
};
1211
use futures_util::FutureExt;
1312
use itertools::Itertools;
1413
use std::{
1514
cell::RefCell,
16-
collections::{hash_map::Entry, HashMap, HashSet, VecDeque},
15+
collections::{HashMap, HashSet, VecDeque, hash_map::Entry},
1716
future,
1817
rc::Rc,
1918
sync::{
20-
atomic::{AtomicBool, AtomicUsize, Ordering},
2119
Arc,
20+
atomic::{AtomicBool, AtomicUsize, Ordering},
2221
},
2322
time::Duration,
2423
};
2524
use temporal_client::WorkflowOptions;
2625
use temporal_sdk::{ActivityOptions, WfContext};
2726
use temporal_sdk_core_api::{
28-
errors::{CompleteActivityError, PollError},
2927
Worker as WorkerTrait,
28+
errors::{CompleteActivityError, PollError},
3029
};
3130
use temporal_sdk_core_protos::{
31+
DEFAULT_ACTIVITY_TYPE, DEFAULT_WORKFLOW_TYPE, TestHistoryBuilder,
3232
coresdk::{
33+
ActivityTaskCompletion,
3334
activity_result::{
34-
activity_execution_result, activity_resolution, ActivityExecutionResult,
35-
ActivityResolution, Success,
35+
ActivityExecutionResult, ActivityResolution, Success, activity_execution_result,
36+
activity_resolution,
3637
},
37-
activity_task::{activity_task, ActivityCancelReason, ActivityTask, Cancel},
38-
workflow_activation::{workflow_activation_job, ResolveActivity, WorkflowActivationJob},
38+
activity_task::{ActivityCancelReason, ActivityTask, Cancel, activity_task},
39+
workflow_activation::{ResolveActivity, WorkflowActivationJob, workflow_activation_job},
3940
workflow_commands::{
4041
ActivityCancellationType, CompleteWorkflowExecution, RequestCancelActivity,
4142
ScheduleActivity,
4243
},
4344
workflow_completion::WorkflowActivationCompletion,
44-
ActivityTaskCompletion,
4545
},
4646
temporal::api::{
47-
command::v1::{command::Attributes, ScheduleActivityTaskCommandAttributes},
47+
command::v1::{ScheduleActivityTaskCommandAttributes, command::Attributes},
4848
enums::v1::{CommandType, EventType},
4949
history::v1::{
50-
history_event::Attributes as EventAttributes, ActivityTaskScheduledEventAttributes,
50+
ActivityTaskScheduledEventAttributes, history_event::Attributes as EventAttributes,
5151
},
5252
sdk::v1::UserMetadata,
5353
workflowservice::v1::{
@@ -56,9 +56,8 @@ use temporal_sdk_core_protos::{
5656
RespondActivityTaskFailedResponse, RespondWorkflowTaskCompletedResponse,
5757
},
5858
},
59-
TestHistoryBuilder, DEFAULT_ACTIVITY_TYPE, DEFAULT_WORKFLOW_TYPE,
6059
};
61-
use temporal_sdk_core_test_utils::{fanout_tasks, start_timer_cmd, TestWorker};
60+
use temporal_sdk_core_test_utils::{TestWorker, fanout_tasks, start_timer_cmd};
6261
use tokio::{join, sync::Barrier, time::sleep};
6362
use tokio_util::sync::CancellationToken;
6463

@@ -468,13 +467,15 @@ async fn activity_timeout_no_double_resolve() {
468467
&[
469468
gen_assert_and_reply(
470469
&job_assert!(workflow_activation_job::Variant::InitializeWorkflow(_)),
471-
vec![ScheduleActivity {
472-
seq: activity_id,
473-
activity_id: activity_id.to_string(),
474-
cancellation_type: ActivityCancellationType::TryCancel as i32,
475-
..Default::default()
476-
}
477-
.into()],
470+
vec![
471+
ScheduleActivity {
472+
seq: activity_id,
473+
activity_id: activity_id.to_string(),
474+
cancellation_type: ActivityCancellationType::TryCancel as i32,
475+
..Default::default()
476+
}
477+
.into(),
478+
],
478479
),
479480
gen_assert_and_reply(
480481
&job_assert!(workflow_activation_job::Variant::SignalWorkflow(_)),
@@ -689,14 +690,16 @@ async fn no_eager_activities_requested_when_worker_options_disable_it(
689690

690691
// Test start
691692
let wf_task = core.poll_workflow_activation().await.unwrap();
692-
let cmds = vec![ScheduleActivity {
693-
seq: 1,
694-
activity_id: "act_id".to_string(),
695-
task_queue: TEST_Q.to_string(),
696-
cancellation_type: ActivityCancellationType::TryCancel as i32,
697-
..Default::default()
698-
}
699-
.into()];
693+
let cmds = vec![
694+
ScheduleActivity {
695+
seq: 1,
696+
activity_id: "act_id".to_string(),
697+
task_queue: TEST_Q.to_string(),
698+
cancellation_type: ActivityCancellationType::TryCancel as i32,
699+
..Default::default()
700+
}
701+
.into(),
702+
];
700703

701704
core.complete_workflow_activation(WorkflowActivationCompletion::from_cmds(
702705
wf_task.run_id,

core/src/core_tests/child_workflows.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::{
22
replay::DEFAULT_WORKFLOW_TYPE,
33
test_help::{
4-
build_fake_sdk, canned_histories, mock_sdk, mock_sdk_cfg, mock_worker, single_hist_mock_sg,
5-
MockPollCfg, ResponseType,
4+
MockPollCfg, ResponseType, build_fake_sdk, canned_histories, mock_sdk, mock_sdk_cfg,
5+
mock_worker, single_hist_mock_sg,
66
},
77
worker::client::mocks::mock_workflow_client,
88
};
@@ -11,8 +11,8 @@ use temporal_sdk::{ChildWorkflowOptions, Signal, WfContext, WorkflowResult};
1111
use temporal_sdk_core_api::Worker;
1212
use temporal_sdk_core_protos::{
1313
coresdk::{
14-
child_workflow::{child_workflow_result, ChildWorkflowCancellationType},
15-
workflow_activation::{workflow_activation_job, WorkflowActivationJob},
14+
child_workflow::{ChildWorkflowCancellationType, child_workflow_result},
15+
workflow_activation::{WorkflowActivationJob, workflow_activation_job},
1616
workflow_commands::{
1717
CancelChildWorkflowExecution, CompleteWorkflowExecution, StartChildWorkflowExecution,
1818
},

core/src/core_tests/determinism.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::{
22
internal_flags::CoreInternalFlags,
33
replay::DEFAULT_WORKFLOW_TYPE,
4-
test_help::{canned_histories, mock_sdk, mock_sdk_cfg, MockPollCfg, ResponseType},
4+
test_help::{MockPollCfg, ResponseType, canned_histories, mock_sdk, mock_sdk_cfg},
55
worker::client::mocks::mock_workflow_client,
66
};
77
use std::{
@@ -13,11 +13,11 @@ use temporal_sdk::{
1313
ActivityOptions, ChildWorkflowOptions, LocalActivityOptions, WfContext, WorkflowResult,
1414
};
1515
use temporal_sdk_core_protos::{
16+
DEFAULT_ACTIVITY_TYPE, TestHistoryBuilder,
1617
temporal::api::{
1718
enums::v1::{EventType, WorkflowTaskFailedCause},
1819
failure::v1::Failure,
1920
},
20-
TestHistoryBuilder, DEFAULT_ACTIVITY_TYPE,
2121
};
2222

2323
static DID_FAIL: AtomicBool = AtomicBool::new(false);

0 commit comments

Comments
 (0)