From 34208ba7c520aa34b5cf59af8758937752291eed Mon Sep 17 00:00:00 2001 From: Lucas Kent Date: Wed, 7 Feb 2024 22:27:56 +1100 Subject: [PATCH] remove unused async (#1458) --- .../transforms/cassandra/sink_cluster/mod.rs | 5 ++-- .../cassandra/sink_cluster/node_pool.rs | 2 +- .../cassandra/sink_cluster/rewrite.rs | 25 +++++++++---------- .../cassandra/sink_cluster/test_router.rs | 2 +- .../tuneable_consistency_scatter.rs | 6 ++--- .../src/transforms/protect/key_management.rs | 2 +- shotover/src/transforms/protect/local_kek.rs | 2 +- 7 files changed, 21 insertions(+), 23 deletions(-) diff --git a/shotover/src/transforms/cassandra/sink_cluster/mod.rs b/shotover/src/transforms/cassandra/sink_cluster/mod.rs index 02462850d..37aed7f36 100644 --- a/shotover/src/transforms/cassandra/sink_cluster/mod.rs +++ b/shotover/src/transforms/cassandra/sink_cluster/mod.rs @@ -269,7 +269,7 @@ impl CassandraSinkCluster { } if self.keyspaces_rx.has_changed()? { - self.pool.update_keyspaces(&mut self.keyspaces_rx).await; + self.pool.update_keyspaces(&mut self.keyspaces_rx); } // CAREFUL: indexes into messages are invalidated here @@ -523,8 +523,7 @@ impl CassandraSinkCluster { } self.message_rewriter - .rewrite_responses(tables_to_rewrite, &mut responses) - .await?; + .rewrite_responses(tables_to_rewrite, &mut responses)?; for response in responses.iter_mut() { if let Some((id, metadata)) = get_prepared_result_message(response) { diff --git a/shotover/src/transforms/cassandra/sink_cluster/node_pool.rs b/shotover/src/transforms/cassandra/sink_cluster/node_pool.rs index f269ec0a7..008b87127 100644 --- a/shotover/src/transforms/cassandra/sink_cluster/node_pool.rs +++ b/shotover/src/transforms/cassandra/sink_cluster/node_pool.rs @@ -115,7 +115,7 @@ impl NodePool { } } - pub async fn update_keyspaces(&mut self, keyspaces_rx: &mut KeyspaceChanRx) { + pub fn update_keyspaces(&mut self, keyspaces_rx: &mut KeyspaceChanRx) { let updated_keyspaces = keyspaces_rx.borrow_and_update().clone(); self.keyspace_metadata = updated_keyspaces; } diff --git a/shotover/src/transforms/cassandra/sink_cluster/rewrite.rs b/shotover/src/transforms/cassandra/sink_cluster/rewrite.rs index 1a0835d50..064c8af0c 100644 --- a/shotover/src/transforms/cassandra/sink_cluster/rewrite.rs +++ b/shotover/src/transforms/cassandra/sink_cluster/rewrite.rs @@ -193,22 +193,18 @@ impl MessageRewriter { /// Rewrite responses using the `Vec` returned by rewrite_requests. /// All extra responses are combined back into the amount of responses expected by the client. - pub async fn rewrite_responses( + pub fn rewrite_responses( &self, tables_to_rewrite: Vec, responses: &mut Vec, ) -> Result<()> { for table_to_rewrite in tables_to_rewrite { - self.rewrite_response(table_to_rewrite, responses).await?; + self.rewrite_response(table_to_rewrite, responses)?; } Ok(()) } - async fn rewrite_response( - &self, - table: TableToRewrite, - responses: &mut Vec, - ) -> Result<()> { + fn rewrite_response(&self, table: TableToRewrite, responses: &mut Vec) -> Result<()> { fn get_warnings(message: &mut Message) -> Vec { if let Some(Frame::Cassandra(frame)) = message.frame() { frame.warnings.clone() @@ -237,8 +233,7 @@ impl MessageRewriter { warnings.extend(get_warnings(&mut peers_response)); warnings.extend(get_warnings(local_response)); - self.rewrite_table_local(table, local_response, peers_response, warnings) - .await?; + self.rewrite_table_local(table, local_response, peers_response, warnings)?; local_response.invalidate_cache(); } } @@ -275,8 +270,12 @@ impl MessageRewriter { Err(MessageParseError::ParseFailure(err)) => return Err(err), }; - self.rewrite_table_peers(table, client_peers_response, nodes, warnings) - .await?; + self.rewrite_table_peers( + table, + client_peers_response, + nodes, + warnings, + )?; client_peers_response.invalidate_cache(); } } @@ -352,7 +351,7 @@ impl MessageRewriter { Ok(()) } - async fn rewrite_table_peers( + fn rewrite_table_peers( &self, table: TableToRewrite, peers_response: &mut Message, @@ -503,7 +502,7 @@ impl MessageRewriter { } } - async fn rewrite_table_local( + fn rewrite_table_local( &self, table: TableToRewrite, local_response: &mut Message, diff --git a/shotover/src/transforms/cassandra/sink_cluster/test_router.rs b/shotover/src/transforms/cassandra/sink_cluster/test_router.rs index 4cb1750be..4ca040938 100644 --- a/shotover/src/transforms/cassandra/sink_cluster/test_router.rs +++ b/shotover/src/transforms/cassandra/sink_cluster/test_router.rs @@ -49,7 +49,7 @@ mod test_token_aware_router { ) .unwrap(); - router.update_keyspaces(&mut keyspaces_rx).await; + router.update_keyspaces(&mut keyspaces_rx); router .add_prepared_result(id.clone(), prepared_metadata()) diff --git a/shotover/src/transforms/distributed/tuneable_consistency_scatter.rs b/shotover/src/transforms/distributed/tuneable_consistency_scatter.rs index 66111d44a..5899153bb 100644 --- a/shotover/src/transforms/distributed/tuneable_consistency_scatter.rs +++ b/shotover/src/transforms/distributed/tuneable_consistency_scatter.rs @@ -308,7 +308,7 @@ mod scatter_transform_tests { assert_eq!(message.frame().unwrap(), &expected); } - async fn build_chains(route_map: HashMap) -> Vec { + fn build_chains(route_map: HashMap) -> Vec { route_map .into_values() .map(|x| x.build_buffered(10)) @@ -343,7 +343,7 @@ mod scatter_transform_tests { ); let mut tuneable_success_consistency = Box::new(TuneableConsistentencyScatter { - route_map: build_chains(two_of_three).await, + route_map: build_chains(two_of_three), write_consistency: 2, read_consistency: 2, }); @@ -370,7 +370,7 @@ mod scatter_transform_tests { ); let mut tuneable_fail_consistency = Box::new(TuneableConsistentencyScatter { - route_map: build_chains(one_of_three).await, + route_map: build_chains(one_of_three), write_consistency: 2, read_consistency: 2, }); diff --git a/shotover/src/transforms/protect/key_management.rs b/shotover/src/transforms/protect/key_management.rs index 87077b0f6..abe3b0daa 100644 --- a/shotover/src/transforms/protect/key_management.rs +++ b/shotover/src/transforms/protect/key_management.rs @@ -82,7 +82,7 @@ impl KeyManager { async fn get_key(&self, dek: Option>, kek_alt: Option) -> Result { match &self { KeyManager::AWSKms(aws) => aws.get_key(dek, kek_alt).await, - KeyManager::Local(local) => local.get_key(dek).await, + KeyManager::Local(local) => local.get_key(dek), } } } diff --git a/shotover/src/transforms/protect/local_kek.rs b/shotover/src/transforms/protect/local_kek.rs index 0a8641988..d6a9e1221 100644 --- a/shotover/src/transforms/protect/local_kek.rs +++ b/shotover/src/transforms/protect/local_kek.rs @@ -20,7 +20,7 @@ pub struct DEKStructure { } impl LocalKeyManagement { - pub async fn get_key(&self, dek: Option>) -> Result { + pub fn get_key(&self, dek: Option>) -> Result { match dek { None => { let plaintext_dek = gen_key();