diff --git a/Cargo.lock b/Cargo.lock index 48fb1ed..3c70978 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -186,6 +186,8 @@ version = "1.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c31a0499c1dc64f458ad13872de75c0eb7e3fdb0e67964610c914b034fc5956e" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -536,6 +538,15 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.76" @@ -704,6 +715,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkg-config" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" + [[package]] name = "ppv-lite86" version = "0.2.20" @@ -1301,6 +1318,7 @@ dependencies = [ "tower-service", "tracing", "webpki-roots", + "zstd", ] [[package]] @@ -1630,3 +1648,31 @@ name = "zeroize" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" + +[[package]] +name = "zstd" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "7.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.13+zstd.1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/Cargo.toml b/Cargo.toml index b0f020f..cec6840 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,7 @@ thiserror = "1.0.67" tokio = { version = "1.41.1", features = ["time"] } tokio-muxt = "0.5.0" tokio-stream = "0.1.16" -tonic = { version = "0.12.3", features = ["tls", "tls-webpki-roots"] } +tonic = { version = "0.12.3", features = ["tls", "tls-webpki-roots", "zstd"] } tonic-side-effect = "0.2.0" tower-service = "0.3.3" tracing = "0.1.40" diff --git a/src/service/stream.rs b/src/service/stream.rs index b1b62d6..b7ca05e 100644 --- a/src/service/stream.rs +++ b/src/service/stream.rs @@ -1,5 +1,5 @@ use prost_types::method_options::IdempotencyLevel; -use tonic::{transport::Channel, IntoRequest}; +use tonic::{codec::CompressionEncoding, transport::Channel, IntoRequest}; use tonic_side_effect::{FrameSignal, RequestFrameMonitor}; use super::{ @@ -69,7 +69,7 @@ impl ReadServiceRequest { req: types::ReadRequest, ) -> Self { Self { - client, + client: client.accept_compressed(CompressionEncoding::Zstd), stream: stream.into(), req, } @@ -116,7 +116,7 @@ impl ReadSessionServiceRequest { req: types::ReadSessionRequest, ) -> Self { Self { - client, + client: client.accept_compressed(CompressionEncoding::Zstd), stream: stream.into(), req, } @@ -188,7 +188,7 @@ impl AppendServiceRequest { req: types::AppendInput, ) -> Self { Self { - client, + client: client.send_compressed(CompressionEncoding::Zstd), append_retry_policy, frame_signal, stream: stream.into(), @@ -261,7 +261,7 @@ where req: S, ) -> Self { Self { - client, + client: client.send_compressed(CompressionEncoding::Zstd), stream: stream.into(), req: Some(req), }