Re enable h3 in reqwest and remove impl Sync on returned Future in binstalk-git-repo-api (#1783)

* Upgrade transitive dependencies

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Re-enable h3

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `binstalk-git-repo-api`

Remove `Sync` bound on returned `Future`, since `tokio::spawn` does not require it

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2024-06-18 23:30:23 +10:00 committed by GitHub
parent fc1117d0e4
commit ef7ca1ba9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 130 additions and 48 deletions

157
Cargo.lock generated
View file

@ -617,9 +617,9 @@ dependencies = [
[[package]] [[package]]
name = "cargo_toml" name = "cargo_toml"
version = "0.20.2" version = "0.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8cb1d556b8b8f36e5ca74938008be3ac102f5dcb5b68a0477e4249ae2291cd3" checksum = "4895c018bb228aa6b3ba1a0285543fcb4b704734c3fb1f72afaa75aa769500c1"
dependencies = [ dependencies = [
"serde", "serde",
"toml", "toml",
@ -2104,6 +2104,21 @@ dependencies = [
"tracing", "tracing",
] ]
[[package]]
name = "h3"
version = "0.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5069de1c2ac82d9e361b07f2b8a2c582ec071750e063530fc7f3b5197e24805"
dependencies = [
"bytes",
"fastrand 2.1.0",
"futures-util",
"http 1.1.0",
"pin-project-lite",
"tokio",
"tracing",
]
[[package]] [[package]]
name = "h3-quinn" name = "h3-quinn"
version = "0.0.3" version = "0.0.3"
@ -2112,9 +2127,23 @@ checksum = "2d4a1a1763e4f3e82ee9f1ecf2cf862b22cc7316ebe14684e42f94532b5ec64d"
dependencies = [ dependencies = [
"bytes", "bytes",
"futures", "futures",
"h3", "h3 0.0.2",
"quinn", "quinn 0.10.2",
"quinn-proto", "quinn-proto 0.10.6",
"tokio-util",
]
[[package]]
name = "h3-quinn"
version = "0.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8c01d99d7cf812fd34ddf135e6c940df9e24f2e759dbc7179fb0e54d4bd6551"
dependencies = [
"bytes",
"futures",
"h3 0.0.5",
"quinn 0.11.2",
"tokio",
"tokio-util", "tokio-util",
] ]
@ -2161,14 +2190,14 @@ dependencies = [
"futures-io", "futures-io",
"futures-util", "futures-util",
"h2 0.3.26", "h2 0.3.26",
"h3", "h3 0.0.2",
"h3-quinn", "h3-quinn 0.0.3",
"http 0.2.12", "http 0.2.12",
"idna 0.4.0", "idna 0.4.0",
"ipnet", "ipnet",
"native-tls", "native-tls",
"once_cell", "once_cell",
"quinn", "quinn 0.10.2",
"rand", "rand",
"ring 0.16.20", "ring 0.16.20",
"rustls 0.21.12", "rustls 0.21.12",
@ -2273,9 +2302,9 @@ dependencies = [
[[package]] [[package]]
name = "httparse" name = "httparse"
version = "1.9.3" version = "1.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0e7a4dd27b9476dc40cb050d3632d3bba3a70ddbff012285f7f8559a1e7e545" checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9"
[[package]] [[package]]
name = "httpdate" name = "httpdate"
@ -2311,19 +2340,21 @@ dependencies = [
[[package]] [[package]]
name = "hyper-rustls" name = "hyper-rustls"
version = "0.26.0" version = "0.27.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155"
dependencies = [ dependencies = [
"futures-util", "futures-util",
"http 1.1.0", "http 1.1.0",
"hyper", "hyper",
"hyper-util", "hyper-util",
"rustls 0.22.4", "rustls 0.23.10",
"rustls-native-certs",
"rustls-pki-types", "rustls-pki-types",
"tokio", "tokio",
"tokio-rustls 0.25.0", "tokio-rustls 0.26.0",
"tower-service", "tower-service",
"webpki-roots",
] ]
[[package]] [[package]]
@ -2847,9 +2878,9 @@ checksum = "933dca44d65cdd53b355d0b73d380a2ff5da71f87f036053188bf1eab6a19881"
[[package]] [[package]]
name = "miniz_oxide" name = "miniz_oxide"
version = "0.7.3" version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08"
dependencies = [ dependencies = [
"adler", "adler",
] ]
@ -3081,7 +3112,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
"redox_syscall 0.5.1", "redox_syscall 0.5.2",
"smallvec", "smallvec",
"windows-targets 0.52.5", "windows-targets 0.52.5",
] ]
@ -3181,8 +3212,8 @@ checksum = "8cc2c5017e4b43d5995dcea317bc46c1e09404c0a9664d2908f7f02dfe943d75"
dependencies = [ dependencies = [
"bytes", "bytes",
"pin-project-lite", "pin-project-lite",
"quinn-proto", "quinn-proto 0.10.6",
"quinn-udp", "quinn-udp 0.4.1",
"rustc-hash", "rustc-hash",
"rustls 0.21.12", "rustls 0.21.12",
"thiserror", "thiserror",
@ -3190,6 +3221,24 @@ dependencies = [
"tracing", "tracing",
] ]
[[package]]
name = "quinn"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4ceeeeabace7857413798eb1ffa1e9c905a9946a57d81fb69b4b71c4d8eb3ad"
dependencies = [
"bytes",
"futures-io",
"pin-project-lite",
"quinn-proto 0.11.3",
"quinn-udp 0.5.2",
"rustc-hash",
"rustls 0.23.10",
"thiserror",
"tokio",
"tracing",
]
[[package]] [[package]]
name = "quinn-proto" name = "quinn-proto"
version = "0.10.6" version = "0.10.6"
@ -3207,6 +3256,23 @@ dependencies = [
"tracing", "tracing",
] ]
[[package]]
name = "quinn-proto"
version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddf517c03a109db8100448a4be38d498df8a210a99fe0e1b9eaf39e78c640efe"
dependencies = [
"bytes",
"rand",
"ring 0.17.8",
"rustc-hash",
"rustls 0.23.10",
"slab",
"thiserror",
"tinyvec",
"tracing",
]
[[package]] [[package]]
name = "quinn-udp" name = "quinn-udp"
version = "0.4.1" version = "0.4.1"
@ -3220,6 +3286,19 @@ dependencies = [
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
[[package]]
name = "quinn-udp"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9096629c45860fc7fb143e125eb826b5e721e10be3263160c7d60ca832cf8c46"
dependencies = [
"libc",
"once_cell",
"socket2",
"tracing",
"windows-sys 0.52.0",
]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.36" version = "1.0.36"
@ -3299,9 +3378,9 @@ dependencies = [
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.5.1" version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.5.0",
] ]
@ -3359,9 +3438,9 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
[[package]] [[package]]
name = "reqwest" name = "reqwest"
version = "0.12.4" version = "0.12.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37"
dependencies = [ dependencies = [
"async-compression", "async-compression",
"base64 0.22.1", "base64 0.22.1",
@ -3371,6 +3450,8 @@ dependencies = [
"futures-core", "futures-core",
"futures-util", "futures-util",
"h2 0.4.5", "h2 0.4.5",
"h3 0.0.5",
"h3-quinn 0.0.6",
"http 1.1.0", "http 1.1.0",
"http-body", "http-body",
"http-body-util", "http-body-util",
@ -3386,18 +3467,20 @@ dependencies = [
"once_cell", "once_cell",
"percent-encoding", "percent-encoding",
"pin-project-lite", "pin-project-lite",
"rustls 0.22.4", "quinn 0.11.2",
"rustls 0.23.10",
"rustls-native-certs", "rustls-native-certs",
"rustls-pemfile 2.1.2", "rustls-pemfile 2.1.2",
"rustls-pki-types", "rustls-pki-types",
"serde", "serde",
"serde_json", "serde_json",
"serde_urlencoded", "serde_urlencoded",
"slab",
"sync_wrapper", "sync_wrapper",
"system-configuration", "system-configuration",
"tokio", "tokio",
"tokio-native-tls", "tokio-native-tls",
"tokio-rustls 0.25.0", "tokio-rustls 0.26.0",
"tokio-util", "tokio-util",
"tower-service", "tower-service",
"url", "url",
@ -3497,11 +3580,11 @@ dependencies = [
[[package]] [[package]]
name = "rustls" name = "rustls"
version = "0.22.4" version = "0.23.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402"
dependencies = [ dependencies = [
"log", "once_cell",
"ring 0.17.8", "ring 0.17.8",
"rustls-pki-types", "rustls-pki-types",
"rustls-webpki 0.102.4", "rustls-webpki 0.102.4",
@ -3903,9 +3986,9 @@ dependencies = [
[[package]] [[package]]
name = "sync_wrapper" name = "sync_wrapper"
version = "0.1.2" version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394"
[[package]] [[package]]
name = "synstructure" name = "synstructure"
@ -4117,11 +4200,11 @@ dependencies = [
[[package]] [[package]]
name = "tokio-rustls" name = "tokio-rustls"
version = "0.25.0" version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4"
dependencies = [ dependencies = [
"rustls 0.22.4", "rustls 0.23.10",
"rustls-pki-types", "rustls-pki-types",
"tokio", "tokio",
] ]
@ -4569,9 +4652,9 @@ dependencies = [
[[package]] [[package]]
name = "webpki-roots" name = "webpki-roots"
version = "0.26.2" version = "0.26.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c452ad30530b54a4d8e71952716a212b08efd0f3562baa66c29a618b07da7c3" checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd"
dependencies = [ dependencies = [
"rustls-pki-types", "rustls-pki-types",
] ]
@ -4988,9 +5071,9 @@ dependencies = [
[[package]] [[package]]
name = "zstd-sys" name = "zstd-sys"
version = "2.0.10+zstd.1.5.6" version = "2.0.11+zstd.1.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa" checksum = "75652c55c0b6f3e6f12eb786fe1bc960396bf05a1eb3bf1f3691c3610ac2e6d4"
dependencies = [ dependencies = [
"cc", "cc",
"pkg-config", "pkg-config",

View file

@ -35,7 +35,7 @@ flate2 = { version = "1.0.28", default-features = false }
futures-util = "0.3.30" futures-util = "0.3.30"
futures-io = "0.3.30" futures-io = "0.3.30"
httpdate = "1.0.2" httpdate = "1.0.2"
reqwest = { version = "0.12.4", features = [ reqwest = { version = "0.12.5", features = [
"http2", "http2",
"stream", "stream",
"zstd", "zstd",
@ -118,8 +118,7 @@ trust-dns = ["hickory-dns"]
# #
# Experimental HTTP/3 client, this would require `--cfg reqwest_unstable` # Experimental HTTP/3 client, this would require `--cfg reqwest_unstable`
# to be passed to `rustc`. # to be passed to `rustc`.
#http3 = ["reqwest/http3"] http3 = ["reqwest/http3"]
http3 = []
zstd-thin = ["zstd/thin"] zstd-thin = ["zstd/thin"]

View file

@ -204,8 +204,8 @@ impl GhApiClient {
where where
GraphQLFn: Fn(&remote::Client, &T, &str) -> GraphQLFut, GraphQLFn: Fn(&remote::Client, &T, &str) -> GraphQLFut,
RestfulFn: Fn(&remote::Client, &T, Option<&str>) -> RestfulFut, RestfulFn: Fn(&remote::Client, &T, Option<&str>) -> RestfulFut,
GraphQLFut: Future<Output = Result<U, GhApiError>> + Send + Sync + 'static, GraphQLFut: Future<Output = Result<U, GhApiError>> + Send + 'static,
RestfulFut: Future<Output = Result<U, GhApiError>> + Send + Sync + 'static, RestfulFut: Future<Output = Result<U, GhApiError>> + Send + 'static,
{ {
self.check_retry_after()?; self.check_retry_after()?;

View file

@ -39,7 +39,7 @@ pub(super) fn issue_restful_api<T>(
client: &remote::Client, client: &remote::Client,
path: &[&str], path: &[&str],
auth_token: Option<&str>, auth_token: Option<&str>,
) -> impl Future<Output = Result<T, GhApiError>> + Send + Sync + 'static ) -> impl Future<Output = Result<T, GhApiError>> + Send + 'static
where where
T: DeserializeOwned, T: DeserializeOwned,
{ {
@ -95,7 +95,7 @@ pub(super) fn issue_graphql_query<T>(
client: &remote::Client, client: &remote::Client,
query: String, query: String,
auth_token: &str, auth_token: &str,
) -> impl Future<Output = Result<T, GhApiError>> + Send + Sync + 'static ) -> impl Future<Output = Result<T, GhApiError>> + Send + 'static
where where
T: DeserializeOwned + Debug, T: DeserializeOwned + Debug,
{ {

View file

@ -74,7 +74,7 @@ pub(super) fn fetch_release_artifacts_restful_api(
tag, tag,
}: &GhRelease, }: &GhRelease,
auth_token: Option<&str>, auth_token: Option<&str>,
) -> impl Future<Output = Result<Artifacts, GhApiError>> + Send + Sync + 'static { ) -> impl Future<Output = Result<Artifacts, GhApiError>> + Send + 'static {
issue_restful_api( issue_restful_api(
client, client,
&["repos", owner, repo, "releases", "tags", tag], &["repos", owner, repo, "releases", "tags", tag],
@ -135,7 +135,7 @@ pub(super) fn fetch_release_artifacts_graphql_api(
tag, tag,
}: &GhRelease, }: &GhRelease,
auth_token: &str, auth_token: &str,
) -> impl Future<Output = Result<Artifacts, GhApiError>> + Send + Sync + 'static { ) -> impl Future<Output = Result<Artifacts, GhApiError>> + Send + 'static {
let client = client.clone(); let client = client.clone();
let auth_token = auth_token.to_compact_string(); let auth_token = auth_token.to_compact_string();

View file

@ -55,7 +55,7 @@ pub(super) fn fetch_repo_info_restful_api(
client: &remote::Client, client: &remote::Client,
GhRepo { owner, repo }: &GhRepo, GhRepo { owner, repo }: &GhRepo,
auth_token: Option<&str>, auth_token: Option<&str>,
) -> impl Future<Output = Result<Option<RepoInfo>, GhApiError>> + Send + Sync + 'static { ) -> impl Future<Output = Result<Option<RepoInfo>, GhApiError>> + Send + 'static {
issue_restful_api(client, &["repos", owner, repo], auth_token) issue_restful_api(client, &["repos", owner, repo], auth_token)
} }
@ -68,7 +68,7 @@ pub(super) fn fetch_repo_info_graphql_api(
client: &remote::Client, client: &remote::Client,
GhRepo { owner, repo }: &GhRepo, GhRepo { owner, repo }: &GhRepo,
auth_token: &str, auth_token: &str,
) -> impl Future<Output = Result<Option<RepoInfo>, GhApiError>> + Send + Sync + 'static { ) -> impl Future<Output = Result<Option<RepoInfo>, GhApiError>> + Send + 'static {
let query = format!( let query = format!(
r#" r#"
query {{ query {{