chore(deps): update to tonic 0.12, prost 0.13 (#2250)

Resolve #2248
This commit is contained in:
Ellie Huxtable 2024-07-10 15:46:51 +01:00 committed by GitHub
parent eb5dae9c5d
commit 353981e794
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 94 additions and 103 deletions

174
Cargo.lock generated
View File

@ -320,9 +320,10 @@ dependencies = [
"atuin-history",
"dashmap",
"eyre",
"hyper-util",
"listenfd",
"prost",
"prost-types",
"prost 0.13.1",
"prost-types 0.12.6",
"protox",
"rand",
"time",
@ -392,7 +393,7 @@ dependencies = [
"async-trait",
"atuin-common",
"atuin-server-database",
"axum 0.7.5",
"axum",
"axum-server",
"base64 0.22.1",
"config",
@ -453,34 +454,6 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
[[package]]
name = "axum"
version = "0.6.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf"
dependencies = [
"async-trait",
"axum-core 0.3.4",
"bitflags 1.3.2",
"bytes",
"futures-util",
"http 0.2.12",
"http-body 0.4.6",
"hyper 0.14.29",
"itoa",
"matchit",
"memchr",
"mime",
"percent-encoding",
"pin-project-lite",
"rustversion",
"serde",
"sync_wrapper 0.1.2",
"tower",
"tower-layer",
"tower-service",
]
[[package]]
name = "axum"
version = "0.7.5"
@ -488,7 +461,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf"
dependencies = [
"async-trait",
"axum-core 0.4.3",
"axum-core",
"bytes",
"futures-util",
"http 1.1.0",
@ -515,23 +488,6 @@ dependencies = [
"tracing",
]
[[package]]
name = "axum-core"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c"
dependencies = [
"async-trait",
"bytes",
"futures-util",
"http 0.2.12",
"http-body 0.4.6",
"mime",
"rustversion",
"tower-layer",
"tower-service",
]
[[package]]
name = "axum-core"
version = "0.4.3"
@ -1802,14 +1758,15 @@ dependencies = [
[[package]]
name = "hyper-timeout"
version = "0.4.1"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1"
checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793"
dependencies = [
"hyper 0.14.29",
"hyper 1.4.0",
"hyper-util",
"pin-project-lite",
"tokio",
"tokio-io-timeout",
"tower-service",
]
[[package]]
@ -2719,25 +2676,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29"
dependencies = [
"bytes",
"prost-derive",
"prost-derive 0.12.6",
]
[[package]]
name = "prost"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13db3d3fde688c61e2446b4d843bc27a7e8af269a69440c0308021dc92333cc"
dependencies = [
"bytes",
"prost-derive 0.13.1",
]
[[package]]
name = "prost-build"
version = "0.12.6"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4"
checksum = "5bb182580f71dd070f88d01ce3de9f4da5021db7115d2e1c3605a754153b77c1"
dependencies = [
"bytes",
"heck 0.5.0",
"itertools 0.12.1",
"itertools 0.13.0",
"log",
"multimap",
"once_cell",
"petgraph",
"prettyplease",
"prost",
"prost-types",
"prost 0.13.1",
"prost-types 0.13.1",
"regex",
"syn 2.0.68",
"tempfile",
@ -2757,16 +2724,29 @@ dependencies = [
]
[[package]]
name = "prost-reflect"
name = "prost-derive"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f5eec97d5d34bdd17ad2db2219aabf46b054c6c41bd5529767c9ce55be5898f"
checksum = "18bec9b0adc4eba778b33684b7ba3e7137789434769ee3ce3930463ef904cfca"
dependencies = [
"anyhow",
"itertools 0.13.0",
"proc-macro2",
"quote",
"syn 2.0.68",
]
[[package]]
name = "prost-reflect"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55a6a9143ae25c25fa7b6a48d6cc08b10785372060009c25140a4e7c340e95af"
dependencies = [
"logos",
"miette",
"once_cell",
"prost",
"prost-types",
"prost 0.13.1",
"prost-types 0.13.1",
]
[[package]]
@ -2775,33 +2755,42 @@ version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0"
dependencies = [
"prost",
"prost 0.12.6",
]
[[package]]
name = "prost-types"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cee5168b05f49d4b0ca581206eb14a7b22fafd963efe729ac48eb03266e25cc2"
dependencies = [
"prost 0.13.1",
]
[[package]]
name = "protox"
version = "0.6.1"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac532509cee918d40f38c3e12f8ef9230f215f017d54de7dd975015538a42ce7"
checksum = "70cdc4ca5487c1fddc30fa2bebba28c0f250f80c944190652ccaaeb157349175"
dependencies = [
"bytes",
"miette",
"prost",
"prost 0.13.1",
"prost-reflect",
"prost-types",
"prost-types 0.13.1",
"protox-parse",
"thiserror",
]
[[package]]
name = "protox-parse"
version = "0.6.1"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f6c33f43516fe397e2f930779d720ca12cd057f7da4cd6326a0ef78d69dee96"
checksum = "a3a462d115462c080ae000c29a47f0b3985737e5d3a995fcdbcaa5c782068dde"
dependencies = [
"logos",
"miette",
"prost-types",
"prost-types 0.13.1",
"thiserror",
]
@ -4076,16 +4065,6 @@ dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "tokio-io-timeout"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf"
dependencies = [
"pin-project-lite",
"tokio",
]
[[package]]
name = "tokio-macros"
version = "2.3.0"
@ -4142,23 +4121,26 @@ dependencies = [
[[package]]
name = "tonic"
version = "0.11.0"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13"
checksum = "f738b6a169a29bca4e39656db89c44a08e09c5b700b896ee9e7459f0652e81dd"
dependencies = [
"async-stream",
"async-trait",
"axum 0.6.20",
"base64 0.21.7",
"axum",
"base64 0.22.1",
"bytes",
"h2 0.3.26",
"http 0.2.12",
"http-body 0.4.6",
"hyper 0.14.29",
"h2 0.4.5",
"http 1.1.0",
"http-body 1.0.0",
"http-body-util",
"hyper 1.4.0",
"hyper-timeout",
"hyper-util",
"percent-encoding",
"pin-project",
"prost",
"prost 0.13.1",
"socket2",
"tokio",
"tokio-stream",
"tower",
@ -4169,9 +4151,9 @@ dependencies = [
[[package]]
name = "tonic-build"
version = "0.11.0"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be4ef6dd70a610078cb4e338a0f79d06bc759ff1b22d2120c2ff02ae264ba9c2"
checksum = "690943cc223adcdd67bb597a2e573ead1b88e999ba37528fe8e6356bf44b29b6"
dependencies = [
"prettyplease",
"proc-macro2",
@ -4182,12 +4164,12 @@ dependencies = [
[[package]]
name = "tonic-types"
version = "0.11.0"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4aa089471d8d4c60ec3aef047739713a4695f0b309d4cea0073bc55201064f4"
checksum = "f0509febcea1e686cc699f7a6c5d322fef27f19a4dd7e7feacd587fd3d9b4360"
dependencies = [
"prost",
"prost-types",
"prost 0.13.1",
"prost-types 0.13.1",
"tonic",
]

View File

@ -27,16 +27,18 @@ tracing = { workspace = true }
tracing-subscriber = { workspace = true }
dashmap = "5.5.3"
tonic-types = "0.11.0"
tonic = "0.11"
prost = "0.12"
tonic-types = "0.12.0"
tonic = "0.12"
prost = "0.13"
prost-types = "0.12"
tokio-stream = {version="0.1.14", features=["net"]}
hyper-util = "0.1"
rand.workspace = true
[target.'cfg(target_os = "linux")'.dependencies]
listenfd = "1.0.1"
[build-dependencies]
protox = "0.6.0"
tonic-build = "0.11"
protox = "0.7.0"
tonic-build = "0.12"

View File

@ -4,6 +4,8 @@ use tokio::net::TcpStream;
use tonic::transport::{Channel, Endpoint, Uri};
use tower::service_fn;
use hyper_util::rt::TokioIo;
#[cfg(unix)]
use tokio::net::UnixStream;
@ -23,9 +25,11 @@ impl HistoryClient {
pub async fn new(path: String) -> Result<Self> {
let channel = Endpoint::try_from("http://atuin_local_daemon:0")?
.connect_with_connector(service_fn(move |_: Uri| {
let path = path.to_string();
let path = path.clone();
UnixStream::connect(path)
async move {
Ok::<_, std::io::Error>(TokioIo::new(UnixStream::connect(path.clone()).await?))
}
}))
.await
.map_err(|_| eyre!("failed to connect to local atuin daemon. Is it running?"))?;
@ -40,6 +44,7 @@ impl HistoryClient {
let channel = Endpoint::try_from("http://atuin_local_daemon:0")?
.connect_with_connector(service_fn(move |_: Uri| {
let url = format!("127.0.0.1:{}", port);
TcpStream::connect(url)
}))
.await

View File

@ -207,6 +207,7 @@ async fn start_server(settings: Settings, history: HistoryService) -> Result<()>
};
let uds_stream = UnixListenerStream::new(uds);
Server::builder()
.add_service(HistoryServer::new(history))
.serve_with_incoming_shutdown(
@ -214,6 +215,7 @@ async fn start_server(settings: Settings, history: HistoryService) -> Result<()>
shutdown_signal(cleanup.then_some(socket_path.into())),
)
.await?;
Ok(())
}