Skip to content

Commit d2ce031

Browse files
committed
Upgrade to 2024 edition
1 parent b78573c commit d2ce031

File tree

18 files changed

+122
-121
lines changed

18 files changed

+122
-121
lines changed

.github/workflows/per-pr.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
submodules: recursive
2222
- uses: dtolnay/rust-toolchain@stable
2323
with:
24-
toolchain: 1.84.0
24+
toolchain: 1.85.0
2525
- name: Install protoc
2626
uses: arduino/setup-protoc@v3
2727
with:
@@ -56,7 +56,7 @@ jobs:
5656
- uses: actions/checkout@v4
5757
- uses: dtolnay/rust-toolchain@stable
5858
with:
59-
toolchain: 1.84.0
59+
toolchain: 1.85.0
6060
- name: Install protoc
6161
uses: arduino/setup-protoc@v3
6262
with:
@@ -100,7 +100,7 @@ jobs:
100100
- uses: actions/checkout@v4
101101
- uses: dtolnay/rust-toolchain@stable
102102
with:
103-
toolchain: 1.84.0
103+
toolchain: 1.85.0
104104
- name: Install protoc
105105
uses: arduino/setup-protoc@v3
106106
with:
@@ -125,7 +125,7 @@ jobs:
125125
- uses: actions/checkout@v4
126126
- uses: dtolnay/rust-toolchain@stable
127127
with:
128-
toolchain: 1.84.0
128+
toolchain: 1.85.0
129129
- name: Install protoc
130130
uses: arduino/setup-protoc@v3
131131
with:

client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "temporal-client"
33
version = "0.1.0"
4-
edition = "2021"
4+
edition = "2024"
55
authors = ["Spencer Judge <[email protected]>"]
66
license-file = { workspace = true }
77
description = "Clients for interacting with Temporal Clusters"

core-api/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "temporal-sdk-core-api"
33
version = "0.1.0"
4-
edition = "2021"
4+
edition = "2024"
55
authors = ["Spencer Judge <[email protected]>"]
66
license-file = { workspace = true }
77
description = "Interface definitions for the Temporal Core SDK"

core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "temporal-sdk-core"
33
version = "0.1.0"
44
authors = ["Spencer Judge <[email protected]>", "Vitaly Arbuzov <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
license-file = { workspace = true }
77
description = "Library for building new Temporal SDKs"
88
homepage = "https://temporal.io/"

core/src/core_tests/queries.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use crate::{
22
test_help::{
3-
build_mock_pollers, canned_histories, hist_to_poll_resp, mock_worker, single_hist_mock_sg,
4-
MockPollCfg, MocksHolder, ResponseType, WorkerExt,
3+
MockPollCfg, MocksHolder, ResponseType, WorkerExt, build_mock_pollers, canned_histories,
4+
hist_to_poll_resp, mock_worker, single_hist_mock_sg,
55
},
6-
worker::{client::mocks::mock_workflow_client, LEGACY_QUERY_ID},
6+
worker::{LEGACY_QUERY_ID, client::mocks::mock_workflow_client},
77
};
88
use futures_util::stream;
99
use std::{
@@ -12,30 +12,30 @@ use std::{
1212
};
1313
use temporal_sdk_core_api::Worker as WorkerTrait;
1414
use temporal_sdk_core_protos::{
15+
TestHistoryBuilder,
1516
coresdk::{
1617
workflow_activation::{
17-
remove_from_cache::EvictionReason, workflow_activation_job, WorkflowActivationJob,
18+
WorkflowActivationJob, remove_from_cache::EvictionReason, workflow_activation_job,
1819
},
1920
workflow_commands::{
20-
query_result, ActivityCancellationType, CompleteWorkflowExecution,
21-
ContinueAsNewWorkflowExecution, QueryResult, RequestCancelActivity,
21+
ActivityCancellationType, CompleteWorkflowExecution, ContinueAsNewWorkflowExecution,
22+
QueryResult, RequestCancelActivity, query_result,
2223
},
2324
workflow_completion::WorkflowActivationCompletion,
2425
},
2526
temporal::api::{
2627
common::v1::Payload,
2728
enums::v1::{CommandType, EventType},
2829
failure::v1::Failure,
29-
history::v1::{history_event, ActivityTaskCancelRequestedEventAttributes, History},
30+
history::v1::{ActivityTaskCancelRequestedEventAttributes, History, history_event},
3031
query::v1::WorkflowQuery,
3132
workflowservice::v1::{
3233
GetWorkflowExecutionHistoryResponse, RespondWorkflowTaskCompletedResponse,
3334
},
3435
},
35-
TestHistoryBuilder,
3636
};
3737
use temporal_sdk_core_test_utils::{
38-
query_ok, schedule_activity_cmd, start_timer_cmd, WorkerTestHelpers,
38+
WorkerTestHelpers, query_ok, schedule_activity_cmd, start_timer_cmd,
3939
};
4040

4141
#[rstest::rstest]
@@ -826,7 +826,7 @@ async fn legacy_query_combined_with_timer_fire_repro() {
826826
assert_matches!(
827827
task.jobs.as_slice(),
828828
[WorkflowActivationJob {
829-
variant: Some(workflow_activation_job::Variant::QueryWorkflow(ref q)),
829+
variant: Some(workflow_activation_job::Variant::QueryWorkflow(q)),
830830
}]
831831
if q.query_id == "the-query"
832832
);
@@ -844,7 +844,7 @@ async fn legacy_query_combined_with_timer_fire_repro() {
844844
assert_matches!(
845845
task.jobs.as_slice(),
846846
[WorkflowActivationJob {
847-
variant: Some(workflow_activation_job::Variant::QueryWorkflow(ref q)),
847+
variant: Some(workflow_activation_job::Variant::QueryWorkflow(q)),
848848
}]
849849
if q.query_id == LEGACY_QUERY_ID
850850
);

core/src/replay/mod.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,23 @@
33
//! users during testing.
44
55
use crate::{
6+
Worker,
67
worker::{
7-
client::mocks::{mock_manual_workflow_client, MockManualWorkerClient},
88
PostActivateHookData,
9+
client::mocks::{MockManualWorkerClient, mock_manual_workflow_client},
910
},
10-
Worker,
1111
};
1212
use futures_util::{FutureExt, Stream, StreamExt};
1313
use parking_lot::Mutex;
14-
use std::sync::OnceLock;
1514
use std::{
1615
pin::Pin,
17-
sync::Arc,
16+
sync::{Arc, OnceLock},
1817
task::{Context, Poll},
1918
};
2019
use temporal_sdk_core_api::worker::WorkerConfig;
20+
pub use temporal_sdk_core_protos::{
21+
DEFAULT_WORKFLOW_TYPE, HistoryInfo, TestHistoryBuilder, default_wes_attribs,
22+
};
2123
use temporal_sdk_core_protos::{
2224
coresdk::workflow_activation::remove_from_cache::EvictionReason,
2325
temporal::api::{
@@ -28,10 +30,7 @@ use temporal_sdk_core_protos::{
2830
},
2931
},
3032
};
31-
pub use temporal_sdk_core_protos::{
32-
default_wes_attribs, HistoryInfo, TestHistoryBuilder, DEFAULT_WORKFLOW_TYPE,
33-
};
34-
use tokio::sync::{mpsc, mpsc::UnboundedSender, Mutex as TokioMutex};
33+
use tokio::sync::{Mutex as TokioMutex, mpsc, mpsc::UnboundedSender};
3534
use tokio_stream::wrappers::UnboundedReceiverStream;
3635
use tokio_util::sync::CancellationToken;
3736

@@ -202,7 +201,7 @@ impl Historator {
202201
/// we're ready to replay the next history, or whatever else.
203202
pub(crate) fn get_post_activate_hook(
204203
&self,
205-
) -> impl Fn(&Worker, PostActivateHookData) + Send + Sync {
204+
) -> impl Fn(&Worker, PostActivateHookData) + Send + Sync + use<> {
206205
let done_tx = self.replay_done_tx.clone();
207206
move |worker, data| {
208207
if !data.replaying {

core/src/worker/workflow/history_update.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::{
55
workflow::{CacheMissFetchReq, PermittedWFT, PreparedWFT},
66
},
77
};
8-
use futures_util::{future::BoxFuture, FutureExt, Stream, TryFutureExt};
8+
use futures_util::{FutureExt, Stream, TryFutureExt, future::BoxFuture};
99
use itertools::Itertools;
1010
use std::{
1111
collections::VecDeque,
@@ -20,8 +20,7 @@ use std::{
2020
use temporal_sdk_core_protos::temporal::api::{
2121
enums::v1::EventType,
2222
history::v1::{
23-
history_event, history_event::Attributes, History, HistoryEvent,
24-
WorkflowTaskCompletedEventAttributes,
23+
History, HistoryEvent, WorkflowTaskCompletedEventAttributes, history_event::Attributes,
2524
},
2625
};
2726
use tracing::Instrument;
@@ -651,9 +650,7 @@ impl HistoryUpdate {
651650
.iter()
652651
.skip_while(|e| e.event_id < from_id)
653652
.find_map(|e| match &e.attributes {
654-
Some(history_event::Attributes::WorkflowTaskCompletedEventAttributes(ref a)) => {
655-
Some(a)
656-
}
653+
Some(Attributes::WorkflowTaskCompletedEventAttributes(a)) => Some(a),
657654
_ => None,
658655
})
659656
}
@@ -794,19 +791,19 @@ mod tests {
794791
use super::*;
795792
use crate::{
796793
replay::{HistoryInfo, TestHistoryBuilder},
797-
test_help::{canned_histories, hist_to_poll_resp, mock_sdk_cfg, MockPollCfg, ResponseType},
794+
test_help::{MockPollCfg, ResponseType, canned_histories, hist_to_poll_resp, mock_sdk_cfg},
798795
worker::client::mocks::mock_workflow_client,
799796
};
800797
use futures_util::{StreamExt, TryStreamExt};
801798
use std::sync::atomic::{AtomicUsize, Ordering};
802799
use temporal_client::WorkflowOptions;
803800
use temporal_sdk::WfContext;
804801
use temporal_sdk_core_protos::{
802+
DEFAULT_WORKFLOW_TYPE,
805803
temporal::api::{
806804
common::v1::WorkflowExecution, enums::v1::WorkflowTaskFailedCause,
807805
workflowservice::v1::GetWorkflowExecutionHistoryResponse,
808806
},
809-
DEFAULT_WORKFLOW_TYPE,
810807
};
811808

812809
impl From<HistoryInfo> for HistoryUpdate {

core/src/worker/workflow/machines/workflow_machines.rs

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
mod local_acts;
22

33
use super::{
4+
Machines, NewMachineWithCommand, TemporalStateMachine,
45
cancel_external_state_machine::new_external_cancel,
56
cancel_workflow_state_machine::cancel_workflow,
67
complete_workflow_state_machine::complete_workflow,
@@ -9,34 +10,32 @@ use super::{
910
patch_state_machine::has_change, signal_external_state_machine::new_external_signal,
1011
timer_state_machine::new_timer, upsert_search_attributes_state_machine::upsert_search_attrs,
1112
workflow_machines::local_acts::LocalActivityData,
12-
workflow_task_state_machine::WorkflowTaskMachine, Machines, NewMachineWithCommand,
13-
TemporalStateMachine,
13+
workflow_task_state_machine::WorkflowTaskMachine,
1414
};
1515
use crate::{
1616
abstractions::dbg_panic,
1717
internal_flags::{CoreInternalFlags, InternalFlags},
1818
protosext::{
19-
protocol_messages::{IncomingProtocolMessage, IncomingProtocolMessageBody},
2019
CompleteLocalActivityData, HistoryEventExt, ValidScheduleLA,
20+
protocol_messages::{IncomingProtocolMessage, IncomingProtocolMessageBody},
2121
},
22-
telemetry::{metrics::MetricsContext, VecDisplayer},
22+
telemetry::{VecDisplayer, metrics::MetricsContext},
2323
worker::{
24+
ExecutingLAId, LocalActRequest, LocalActivityExecutionResult, LocalActivityResolution,
2425
workflow::{
26+
CommandID, DrivenWorkflow, HistoryUpdate, InternalFlagsRef, LocalResolution,
27+
OutgoingJob, RunBasics, WFCommand, WFCommandVariant, WFMachinesError,
28+
WorkflowStartedInfo,
2529
history_update::NextWFT,
2630
machines::{
27-
activity_state_machine::ActivityMachine,
31+
HistEventData, activity_state_machine::ActivityMachine,
2832
child_workflow_state_machine::ChildWorkflowMachine,
2933
modify_workflow_properties_state_machine::modify_workflow_properties,
3034
nexus_operation_state_machine::NexusOperationMachine,
3135
patch_state_machine::VERSION_SEARCH_ATTR_KEY, update_state_machine::UpdateMachine,
3236
upsert_search_attributes_state_machine::upsert_search_attrs_internal,
33-
HistEventData,
3437
},
35-
CommandID, DrivenWorkflow, HistoryUpdate, InternalFlagsRef, LocalResolution,
36-
OutgoingJob, RunBasics, WFCommand, WFCommandVariant, WFMachinesError,
37-
WorkflowStartedInfo,
3838
},
39-
ExecutingLAId, LocalActRequest, LocalActivityExecutionResult, LocalActivityResolution,
4039
},
4140
};
4241
use anyhow::Context;
@@ -58,17 +57,17 @@ use temporal_sdk_core_protos::{
5857
common::{NamespacedWorkflowExecution, VersioningIntent},
5958
workflow_activation,
6059
workflow_activation::{
61-
workflow_activation_job, NotifyHasPatch, UpdateRandomSeed, WorkflowActivation,
60+
NotifyHasPatch, UpdateRandomSeed, WorkflowActivation, workflow_activation_job,
6261
},
6362
workflow_commands::ContinueAsNewWorkflowExecution,
6463
},
6564
temporal::api::{
6665
command::v1::{
67-
command::Attributes as ProtoCmdAttrs, Command as ProtoCommand, CommandAttributesExt,
66+
Command as ProtoCommand, CommandAttributesExt, command::Attributes as ProtoCmdAttrs,
6867
},
6968
enums::v1::EventType,
70-
history::v1::{history_event, HistoryEvent},
71-
protocol::v1::{message::SequencingId, Message as ProtocolMessage},
69+
history::v1::{HistoryEvent, history_event},
70+
protocol::v1::{Message as ProtocolMessage, message::SequencingId},
7271
sdk::v1::{UserMetadata, WorkflowTaskCompletedMetadata},
7372
},
7473
};
@@ -241,7 +240,7 @@ where
241240
macro_rules! cancel_machine {
242241
($self:expr, $cmd_id:expr, $machine_variant:ident, $cancel_method:ident $(, $args:expr )* $(,)?) => {{
243242
let m_key = $self.get_machine_key($cmd_id)?;
244-
let machine = if let Machines::$machine_variant(ref mut m) = $self.machine_mut(m_key) {
243+
let machine = if let Machines::$machine_variant(m) = $self.machine_mut(m_key) {
245244
m
246245
} else {
247246
return Err(WFMachinesError::Nondeterminism(format!(
@@ -1190,8 +1189,8 @@ impl WorkflowMachines {
11901189
}
11911190
c => {
11921191
return Err(WFMachinesError::Fatal(format!(
1193-
"A machine requested to create a new command of an unsupported type: {c:?}"
1194-
)))
1192+
"A machine requested to create a new command of an unsupported type: {c:?}"
1193+
)));
11951194
}
11961195
},
11971196
MachineResponse::IssueFakeLocalActivityMarker(seq) => {
@@ -1213,7 +1212,9 @@ impl WorkflowMachines {
12131212
let more_responses = lam.try_resolve_with_dat(preres)?;
12141213
self.process_machine_responses(smk, more_responses)?;
12151214
} else {
1216-
panic!("A non local-activity machine returned a request cancel LA response");
1215+
panic!(
1216+
"A non local-activity machine returned a request cancel LA response"
1217+
);
12171218
}
12181219
}
12191220
// If it's in the request queue, just rip it out.
@@ -1231,7 +1232,9 @@ impl WorkflowMachines {
12311232
)?;
12321233
self.process_machine_responses(smk, more_responses)?;
12331234
} else {
1234-
panic!("A non local-activity machine returned a request cancel LA response");
1235+
panic!(
1236+
"A non local-activity machine returned a request cancel LA response"
1237+
);
12351238
}
12361239
} else {
12371240
// Finally, if we know about the LA at all, it's currently running, so

0 commit comments

Comments
 (0)