diff --git a/Cargo.Bazel.Fuzzing.json.lock b/Cargo.Bazel.Fuzzing.json.lock index 7e463bccd73..7473c7f27cb 100644 --- a/Cargo.Bazel.Fuzzing.json.lock +++ b/Cargo.Bazel.Fuzzing.json.lock @@ -1,5 +1,5 @@ { - "checksum": "d49c2d6535ae0e33df43f23bf7877c04341c237a0782c81faa1e85ae9a4e8a6b", + "checksum": "677f22419b2df3054ffc429ee72f0aec466b5a320dfdfe534e9f3661b7b570e6", "crates": { "abnf 0.12.0": { "name": "abnf", @@ -19330,10 +19330,6 @@ "id": "syn 1.0.109", "target": "syn" }, - { - "id": "sync_wrapper 1.0.1", - "target": "sync_wrapper" - }, { "id": "tar 0.4.39", "target": "tar" @@ -85573,7 +85569,6 @@ "stubborn-io 0.3.2", "subtle 2.6.1", "syn 1.0.109", - "sync_wrapper 1.0.1", "tar 0.4.39", "tarpc 0.34.0", "tempfile 3.12.0", diff --git a/Cargo.Bazel.Fuzzing.toml.lock b/Cargo.Bazel.Fuzzing.toml.lock index dac639975f9..710ded74550 100644 --- a/Cargo.Bazel.Fuzzing.toml.lock +++ b/Cargo.Bazel.Fuzzing.toml.lock @@ -3245,7 +3245,6 @@ dependencies = [ "stubborn-io", "subtle", "syn 1.0.109", - "sync_wrapper 1.0.1", "tar", "tarpc", "tempfile", diff --git a/Cargo.Bazel.json.lock b/Cargo.Bazel.json.lock index ee47b208712..49ec3b9fb55 100644 --- a/Cargo.Bazel.json.lock +++ b/Cargo.Bazel.json.lock @@ -1,5 +1,5 @@ { - "checksum": "4002433162202c7300c4f17bf7105e405ab6e3b9f9cd9e3d56c3ebe98e04d509", + "checksum": "1e7c85da2d7d087631301df644749a5b22bad6efe59752b4a625f4ec089033a0", "crates": { "abnf 0.12.0": { "name": "abnf", @@ -19153,10 +19153,6 @@ "id": "syn 1.0.109", "target": "syn" }, - { - "id": "sync_wrapper 1.0.1", - "target": "sync_wrapper" - }, { "id": "tar 0.4.39", "target": "tar" @@ -85446,7 +85442,6 @@ "stubborn-io 0.3.2", "subtle 2.6.1", "syn 1.0.109", - "sync_wrapper 1.0.1", "tar 0.4.39", "tarpc 0.34.0", "tempfile 3.12.0", diff --git a/Cargo.Bazel.toml.lock b/Cargo.Bazel.toml.lock index 6274a4d7ccb..570ffb629fc 100644 --- a/Cargo.Bazel.toml.lock +++ b/Cargo.Bazel.toml.lock @@ -3234,7 +3234,6 @@ dependencies = [ "stubborn-io", "subtle", "syn 1.0.109", - "sync_wrapper 1.0.1", "tar", "tarpc", "tempfile", diff --git a/Cargo.lock b/Cargo.lock index 962c0a61319..95e75d122b3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5428,7 +5428,6 @@ version = "0.9.0" dependencies = [ "anyhow", "async-stream", - "axum", "byte-unit", "bytes", "futures", @@ -5436,8 +5435,6 @@ dependencies = [ "hyper 1.5.0", "rand 0.8.5", "slog", - "sync_wrapper 1.0.1", - "thiserror", "tokio", "tonic", ] @@ -19960,7 +19957,6 @@ dependencies = [ "axum", "clap 4.5.20", "http 1.1.0", - "ic-async-utils", "itertools 0.12.1", "reqwest 0.12.8", "thiserror", diff --git a/Cargo.toml b/Cargo.toml index 67206e66325..1f5075b6085 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -689,7 +689,6 @@ strum = { version = "0.26.3", features = ["derive"] } strum_macros = "0.26.4" subtle = "2.6.1" syn = { version = "1.0.109", features = ["fold", "full"] } -sync_wrapper = "1.0.1" tar = "0.4.39" tempfile = "3.12.0" thiserror = "1.0.62" diff --git a/bazel/external_crates.bzl b/bazel/external_crates.bzl index 55f29584cd5..32cbbb0cd7e 100644 --- a/bazel/external_crates.bzl +++ b/bazel/external_crates.bzl @@ -1203,9 +1203,6 @@ def external_crates_repository(name, cargo_lockfile, lockfile, sanitizers_enable "full", ], ), - "sync_wrapper": crate.spec( - version = "^1.0.1", - ), "tar": crate.spec( version = "^0.4.38", ), diff --git a/rs/async_utils/BUILD.bazel b/rs/async_utils/BUILD.bazel index ff581b82ac8..41ab87702fa 100644 --- a/rs/async_utils/BUILD.bazel +++ b/rs/async_utils/BUILD.bazel @@ -11,15 +11,12 @@ rust_library( # Keep sorted. "@crate_index//:anyhow", "@crate_index//:async-stream", - "@crate_index//:axum", "@crate_index//:byte-unit", "@crate_index//:bytes", "@crate_index//:futures", "@crate_index//:futures-util", "@crate_index//:hyper", "@crate_index//:slog", - "@crate_index//:sync_wrapper", - "@crate_index//:thiserror", "@crate_index//:tokio", "@crate_index//:tonic", ], diff --git a/rs/async_utils/Cargo.toml b/rs/async_utils/Cargo.toml index 658a667f022..78e8790f623 100644 --- a/rs/async_utils/Cargo.toml +++ b/rs/async_utils/Cargo.toml @@ -9,15 +9,12 @@ documentation.workspace = true [dependencies] anyhow = { workspace = true } async-stream = { workspace = true } -axum = { workspace = true } byte-unit = "4.0.14" bytes = { workspace = true } futures = { workspace = true } futures-util = { workspace = true } hyper = { workspace = true } slog = { workspace = true } -sync_wrapper = { workspace = true } -thiserror = { workspace = true } tokio = { workspace = true } tonic = { workspace = true } diff --git a/rs/async_utils/src/axum.rs b/rs/async_utils/src/axum.rs deleted file mode 100644 index 2a39243bb67..00000000000 --- a/rs/async_utils/src/axum.rs +++ /dev/null @@ -1,42 +0,0 @@ -use axum::body::{Body, HttpBody}; -use bytes::Bytes; -use futures_util::Stream; -use std::{ - pin::{pin, Pin}, - task::Poll, -}; -use sync_wrapper::SyncWrapper; - -/// Wrapper used for conversion from an Axum Body to a Reqwest one -pub struct BodyDataStream { - inner: SyncWrapper, -} - -impl BodyDataStream { - pub const fn new(body: Body) -> Self { - Self { - inner: SyncWrapper::new(body), - } - } -} - -impl Stream for BodyDataStream { - type Item = Result; - - #[inline] - fn poll_next( - mut self: Pin<&mut Self>, - cx: &mut core::task::Context<'_>, - ) -> Poll> { - loop { - let mut pinned = pin!(self.inner.get_mut()); - match futures_util::ready!(pinned.as_mut().poll_frame(cx)?) { - Some(frame) => match frame.into_data() { - Ok(data) => return Poll::Ready(Some(Ok(data))), - Err(_frame) => {} - }, - None => return Poll::Ready(None), - } - } - } -} diff --git a/rs/async_utils/src/lib.rs b/rs/async_utils/src/lib.rs index 366dbb7dc25..30ab8bda963 100644 --- a/rs/async_utils/src/lib.rs +++ b/rs/async_utils/src/lib.rs @@ -1,6 +1,5 @@ use slog::{info, Logger}; -pub mod axum; mod hyper; mod join_map; mod unix; diff --git a/rs/boundary_node/systemd_journal_gatewayd_shim/BUILD.bazel b/rs/boundary_node/systemd_journal_gatewayd_shim/BUILD.bazel index 2112c729dc9..16e571a749b 100644 --- a/rs/boundary_node/systemd_journal_gatewayd_shim/BUILD.bazel +++ b/rs/boundary_node/systemd_journal_gatewayd_shim/BUILD.bazel @@ -2,7 +2,6 @@ load("@rules_rust//rust:defs.bzl", "rust_binary") DEPENDENCIES = [ # Keep sorted. - "//rs/async_utils", "@crate_index//:anyhow", "@crate_index//:axum", "@crate_index//:clap", diff --git a/rs/boundary_node/systemd_journal_gatewayd_shim/Cargo.toml b/rs/boundary_node/systemd_journal_gatewayd_shim/Cargo.toml index 9640d0e3c46..d41c3ff976a 100644 --- a/rs/boundary_node/systemd_journal_gatewayd_shim/Cargo.toml +++ b/rs/boundary_node/systemd_journal_gatewayd_shim/Cargo.toml @@ -12,7 +12,6 @@ async-trait = { workspace = true } axum = { workspace = true } clap = { workspace = true } http = { workspace = true } -ic-async-utils = { path = "../../async_utils" } itertools = { workspace = true } reqwest = { workspace = true } thiserror = { workspace = true } diff --git a/rs/boundary_node/systemd_journal_gatewayd_shim/src/api.rs b/rs/boundary_node/systemd_journal_gatewayd_shim/src/api.rs index da5896f149c..c27c7e73185 100644 --- a/rs/boundary_node/systemd_journal_gatewayd_shim/src/api.rs +++ b/rs/boundary_node/systemd_journal_gatewayd_shim/src/api.rs @@ -7,7 +7,6 @@ use axum::{ http::StatusCode, response::{IntoResponse, Response}, }; -use ic_async_utils::axum::BodyDataStream; use itertools::{concat, Itertools}; use reqwest::Method; use url::Url; @@ -93,7 +92,7 @@ pub(crate) async fn entries( }); let (parts, body) = req.into_parts(); - let body_stream = BodyDataStream::new(body); + let body_stream = body.into_data_stream(); let mut upstream_req = reqwest::Request::new(Method::GET, u); diff --git a/rs/tests/src/nns_tests/registry_authentication_test.rs b/rs/tests/src/nns_tests/registry_authentication_test.rs index fd6fbcbc358..e3ecf86fa9e 100644 --- a/rs/tests/src/nns_tests/registry_authentication_test.rs +++ b/rs/tests/src/nns_tests/registry_authentication_test.rs @@ -20,7 +20,6 @@ use axum::{ extract::{Request, State}, routing::any, }; -use ic_async_utils::axum::BodyDataStream; use ic_crypto_utils_threshold_sig_der::threshold_sig_public_key_from_der; use ic_nns_test_utils::itest_helpers::{ forward_call_via_universal_canister, set_up_universal_canister, @@ -188,7 +187,7 @@ async fn mitm_service( let (parts, body) = req.into_parts(); *request.headers_mut() = parts.headers; - *request.body_mut() = Some(reqwest::Body::wrap_stream(BodyDataStream::new(body))); + *request.body_mut() = Some(reqwest::Body::wrap_stream(body.into_data_stream())); let response = client .execute(request)