From 156c203eb83a02ef11f78b4434e328afffe060fe Mon Sep 17 00:00:00 2001 From: Matthew Keeler Date: Wed, 4 Dec 2024 16:50:25 -0500 Subject: [PATCH] compress -> event-compression --- contract-tests/Cargo.toml | 2 +- launchdarkly-server-sdk/Cargo.toml | 2 +- .../src/events/processor_builders.rs | 2 +- launchdarkly-server-sdk/src/events/sender.rs | 14 +++++++------- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/contract-tests/Cargo.toml b/contract-tests/Cargo.toml index ff42c72..2e66d1b 100644 --- a/contract-tests/Cargo.toml +++ b/contract-tests/Cargo.toml @@ -10,7 +10,7 @@ actix = "0.13.0" actix-web = "4.2.1" env_logger = "0.10.0" log = "0.4.14" -launchdarkly-server-sdk = { path = "../launchdarkly-server-sdk/", default-features = false, features = ["compress"]} +launchdarkly-server-sdk = { path = "../launchdarkly-server-sdk/", default-features = false, features = ["event-compression"]} serde = { version = "1.0.132", features = ["derive"] } serde_json = "1.0.73" futures = "0.3.12" diff --git a/launchdarkly-server-sdk/Cargo.toml b/launchdarkly-server-sdk/Cargo.toml index 0e629d2..a82942c 100644 --- a/launchdarkly-server-sdk/Cargo.toml +++ b/launchdarkly-server-sdk/Cargo.toml @@ -51,7 +51,7 @@ reqwest = { version = "0.12.4", features = ["json"] } [features] default = ["rustls"] rustls = ["hyper-rustls/http1", "hyper-rustls/http2", "eventsource-client/rustls"] -compress = ["flate2"] +event-compression = ["flate2"] [[example]] name = "print_flags" diff --git a/launchdarkly-server-sdk/src/events/processor_builders.rs b/launchdarkly-server-sdk/src/events/processor_builders.rs index 8adad88..75b7e8e 100644 --- a/launchdarkly-server-sdk/src/events/processor_builders.rs +++ b/launchdarkly-server-sdk/src/events/processor_builders.rs @@ -263,7 +263,7 @@ impl EventProcessorBuilder { self } - #[cfg(feature = "compress")] + #[cfg(feature = "event-compression")] /// Should the event payload sent to LaunchDarkly use gzip compression. By /// default this is false to prevent backward breaking compatibility issues with /// older versions of the relay proxy. diff --git a/launchdarkly-server-sdk/src/events/sender.rs b/launchdarkly-server-sdk/src/events/sender.rs index bfbed48..6331835 100644 --- a/launchdarkly-server-sdk/src/events/sender.rs +++ b/launchdarkly-server-sdk/src/events/sender.rs @@ -6,11 +6,11 @@ use chrono::DateTime; use crossbeam_channel::Sender; use std::collections::HashMap; -#[cfg(feature = "compress")] +#[cfg(feature = "event-compression")] use flate2::write::GzEncoder; -#[cfg(feature = "compress")] +#[cfg(feature = "event-compression")] use flate2::Compression; -#[cfg(feature = "compress")] +#[cfg(feature = "event-compression")] use std::io::Write; use futures::future::BoxFuture; @@ -44,7 +44,7 @@ pub struct HyperEventSender { http: hyper::Client, default_headers: HashMap<&'static str, String>, - // used with compress feature + // used with event-compression feature #[allow(dead_code)] compress_events: bool, } @@ -109,7 +109,7 @@ where serde_json::to_string_pretty(&events).unwrap_or_else(|e| e.to_string()) ); - // mut is needed for compress feature + // mut is needed for event-compression feature #[allow(unused_mut)] let mut payload = match serde_json::to_vec(&events) { Ok(json) => json, @@ -122,11 +122,11 @@ where } }; - // mut is needed for compress feature + // mut is needed for event-compression feature #[allow(unused_mut)] let mut additional_headers = self.default_headers.clone(); - #[cfg(feature = "compress")] + #[cfg(feature = "event-compression")] if self.compress_events { let mut e = GzEncoder::new(Vec::new(), Compression::default()); if e.write_all(payload.as_slice()).is_ok() {