Skip to content

Commit 0b616db

Browse files
authored
[omdb] switch to async closures (#7814)
Similar to #7810.
1 parent da7799d commit 0b616db

File tree

5 files changed

+20
-18
lines changed

5 files changed

+20
-18
lines changed

dev-tools/omdb/src/bin/omdb/db.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2657,7 +2657,7 @@ async fn cmd_db_volume_lock_holder(
26572657
let maybe_volume_repair_record = datastore
26582658
.pool_connection_for_tests()
26592659
.await?
2660-
.transaction_async(|conn| async move {
2660+
.transaction_async(async move |conn| {
26612661
use db::schema::volume_repair::dsl;
26622662

26632663
conn.batch_execute_async(ALLOW_FULL_TABLE_SCAN_SQL).await?;
@@ -2802,7 +2802,7 @@ async fn cmd_db_region_used_by(
28022802
datastore
28032803
.pool_connection_for_tests()
28042804
.await?
2805-
.transaction_async(|conn| async move {
2805+
.transaction_async(async move |conn| {
28062806
use db::schema::disk::dsl;
28072807

28082808
conn.batch_execute_async(ALLOW_FULL_TABLE_SCAN_SQL).await?;
@@ -2829,7 +2829,7 @@ async fn cmd_db_region_used_by(
28292829
datastore
28302830
.pool_connection_for_tests()
28312831
.await?
2832-
.transaction_async(|conn| async move {
2832+
.transaction_async(async move |conn| {
28332833
use db::schema::snapshot::dsl;
28342834

28352835
conn.batch_execute_async(ALLOW_FULL_TABLE_SCAN_SQL).await?;
@@ -2860,7 +2860,7 @@ async fn cmd_db_region_used_by(
28602860
datastore
28612861
.pool_connection_for_tests()
28622862
.await?
2863-
.transaction_async(|conn| async move {
2863+
.transaction_async(async move |conn| {
28642864
use db::schema::image::dsl;
28652865

28662866
conn.batch_execute_async(ALLOW_FULL_TABLE_SCAN_SQL).await?;
@@ -5019,7 +5019,7 @@ async fn cmd_db_validate_volume_references(
50195019
let region_snapshots: Vec<RegionSnapshot> = datastore
50205020
.pool_connection_for_tests()
50215021
.await?
5022-
.transaction_async(|conn| async move {
5022+
.transaction_async(async move |conn| {
50235023
// Selecting all region snapshots requires a full table scan
50245024
conn.batch_execute_async(ALLOW_FULL_TABLE_SCAN_SQL).await?;
50255025

@@ -5053,7 +5053,7 @@ async fn cmd_db_validate_volume_references(
50535053
let matching_volumes = datastore
50545054
.pool_connection_for_tests()
50555055
.await?
5056-
.transaction_async(|conn| async move {
5056+
.transaction_async(async move |conn| {
50575057
// Selecting all volumes based on the data column requires a
50585058
// full table scan
50595059
conn.batch_execute_async(ALLOW_FULL_TABLE_SCAN_SQL).await?;
@@ -5159,7 +5159,7 @@ async fn cmd_db_validate_regions(
51595159
let datasets_and_regions: Vec<(CrucibleDataset, Region)> = datastore
51605160
.pool_connection_for_tests()
51615161
.await?
5162-
.transaction_async(|conn| async move {
5162+
.transaction_async(async move |conn| {
51635163
// Selecting all datasets and regions requires a full table scan
51645164
conn.batch_execute_async(ALLOW_FULL_TABLE_SCAN_SQL).await?;
51655165

@@ -5294,7 +5294,7 @@ async fn cmd_db_validate_regions(
52945294
let datasets: Vec<CrucibleDataset> = datastore
52955295
.pool_connection_for_tests()
52965296
.await?
5297-
.transaction_async(|conn| async move {
5297+
.transaction_async(async move |conn| {
52985298
// Selecting all datasets and regions requires a full table scan
52995299
conn.batch_execute_async(ALLOW_FULL_TABLE_SCAN_SQL).await?;
53005300

@@ -5418,7 +5418,7 @@ async fn cmd_db_validate_region_snapshots(
54185418
datastore
54195419
.pool_connection_for_tests()
54205420
.await?
5421-
.transaction_async(|conn| async move {
5421+
.transaction_async(async move |conn| {
54225422
// Selecting all datasets and region snapshots requires a
54235423
// full table scan
54245424
conn.batch_execute_async(ALLOW_FULL_TABLE_SCAN_SQL).await?;
@@ -5614,7 +5614,7 @@ async fn cmd_db_validate_region_snapshots(
56145614
let datasets_and_regions: Vec<(CrucibleDataset, Region)> = datastore
56155615
.pool_connection_for_tests()
56165616
.await?
5617-
.transaction_async(|conn| async move {
5617+
.transaction_async(async move |conn| {
56185618
// Selecting all datasets and regions requires a full table scan
56195619
conn.batch_execute_async(ALLOW_FULL_TABLE_SCAN_SQL).await?;
56205620

@@ -6908,7 +6908,7 @@ async fn cmd_db_vmm_list(
69086908
let vmms = datastore
69096909
.pool_connection_for_tests()
69106910
.await?
6911-
.transaction_async(|conn| async move {
6911+
.transaction_async(async move |conn| {
69126912
// If we are including deleted VMMs, we can no longer use indices on
69136913
// the VMM table, which do not index deleted VMMs. Thus, we must
69146914
// allow a full-table scan in that case.

dev-tools/omdb/src/bin/omdb/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ impl Omdb {
203203
}
204204

205205
let mut socket_stream = futures::stream::iter(addrs)
206-
.map(|sockaddr_v6| async move {
206+
.map(async move |sockaddr_v6| {
207207
(sockaddr_v6, try_connect(sockaddr_v6).await)
208208
})
209209
.buffer_unordered(3);

dev-tools/omdb/src/bin/omdb/mgs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ async fn cmd_mgs_inventory(
147147
None
148148
}
149149
}))
150-
.then(|sp_id| async move {
150+
.then(async move |sp_id| {
151151
c.sp_get(sp_id.type_, sp_id.slot)
152152
.await
153153
.with_context(|| format!("fetching info about SP {:?}", sp_id))

dev-tools/omdb/src/bin/omdb/nexus.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2643,7 +2643,7 @@ async fn cmd_nexus_blueprints_target_set(
26432643
// if `args.diff` is true, or later if `args.enabled` is "inherit" (or
26442644
// both).
26452645
let current_target = OnceCell::new();
2646-
let get_current_target = || async {
2646+
let get_current_target = async || {
26472647
current_target
26482648
.get_or_try_init(|| client.blueprint_target_view())
26492649
.await

dev-tools/omdb/src/bin/omdb/reconfigurator.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ impl ReconfiguratorArgs {
8080
log: &Logger,
8181
) -> anyhow::Result<()> {
8282
self.db_url_opts
83-
.with_datastore(omdb, log, |opctx, datastore| async move {
84-
match &self.command {
83+
.with_datastore(
84+
omdb,
85+
log,
86+
async move |opctx, datastore| match &self.command {
8587
ReconfiguratorCommands::Export(export_args) => {
8688
let _state = cmd_reconfigurator_export(
8789
&opctx,
@@ -109,8 +111,8 @@ impl ReconfiguratorArgs {
109111
)
110112
.await
111113
}
112-
}
113-
})
114+
},
115+
)
114116
.await
115117
}
116118
}

0 commit comments

Comments
 (0)