diff --git a/nativelink-config/src/cas_server.rs b/nativelink-config/src/cas_server.rs index c8d84a9fb..03e2c4535 100644 --- a/nativelink-config/src/cas_server.rs +++ b/nativelink-config/src/cas_server.rs @@ -34,7 +34,7 @@ pub type InstanceName = String; #[allow(non_camel_case_types)] #[derive(Deserialize, Debug, Default, Clone, Copy)] -pub enum CompressionAlgorithm { +pub enum HttpCompressionAlgorithm { /// No compression. #[default] none, @@ -54,15 +54,15 @@ pub enum CompressionAlgorithm { /// and cloud-clients to use another. #[derive(Deserialize, Debug, Default)] #[serde(deny_unknown_fields)] -pub struct CompressionConfig { +pub struct HttpCompressionConfig { /// The compression algorithm that the server will use when sending /// responses to clients. Enabling this will likely save a lot of /// data transfer, but will consume a lot of CPU and add a lot of /// latency. /// see: /// - /// Default: CompressionAlgorithm::None - pub send_compression_algorithm: Option, + /// Default: `HttpCompressionAlgorithm::none` + pub send_compression_algorithm: Option, /// The compression algorithm that the server will accept from clients. /// The server will broadcast the supported compression algorithms to @@ -72,7 +72,7 @@ pub struct CompressionConfig { /// see: /// /// Defaults: {no supported compression} - pub accepted_compression_algorithms: Vec, + pub accepted_compression_algorithms: Vec, } #[derive(Deserialize, Debug)] @@ -371,7 +371,7 @@ pub struct HttpListener { /// Data transport compression configuration to use for this service. #[serde(default)] - pub compression: CompressionConfig, + pub compression: HttpCompressionConfig, /// Advanced Http server configuration. #[serde(default)] diff --git a/src/bin/nativelink.rs b/src/bin/nativelink.rs index d29f1283c..3be18cdce 100644 --- a/src/bin/nativelink.rs +++ b/src/bin/nativelink.rs @@ -27,7 +27,7 @@ use hyper::server::conn::Http; use hyper::{Response, StatusCode}; use mimalloc::MiMalloc; use nativelink_config::cas_server::{ - CasConfig, CompressionAlgorithm, GlobalConfig, ListenerConfig, ServerConfig, WorkerConfig, + CasConfig, GlobalConfig, HttpCompressionAlgorithm, ListenerConfig, ServerConfig, WorkerConfig, }; use nativelink_config::stores::ConfigDigestHashFunction; use nativelink_error::{make_err, Code, Error, ResultExt}; @@ -152,10 +152,10 @@ async fn inner_main( } } - fn into_encoding(from: &CompressionAlgorithm) -> Option { + fn into_encoding(from: &HttpCompressionAlgorithm) -> Option { match from { - CompressionAlgorithm::gzip => Some(CompressionEncoding::Gzip), - CompressionAlgorithm::none => None, + HttpCompressionAlgorithm::gzip => Some(CompressionEncoding::Gzip), + HttpCompressionAlgorithm::none => None, } } @@ -237,7 +237,7 @@ async fn inner_main( let mut service = v.into_service(); let send_algo = &http_config.compression.send_compression_algorithm; if let Some(encoding) = - into_encoding(&send_algo.unwrap_or(CompressionAlgorithm::none)) + into_encoding(&send_algo.unwrap_or(HttpCompressionAlgorithm::none)) { service = service.send_compressed(encoding); } @@ -263,7 +263,7 @@ async fn inner_main( let mut service = v.into_service(); let send_algo = &http_config.compression.send_compression_algorithm; if let Some(encoding) = - into_encoding(&send_algo.unwrap_or(CompressionAlgorithm::none)) + into_encoding(&send_algo.unwrap_or(HttpCompressionAlgorithm::none)) { service = service.send_compressed(encoding); } @@ -289,7 +289,7 @@ async fn inner_main( let mut service = v.into_service(); let send_algo = &http_config.compression.send_compression_algorithm; if let Some(encoding) = - into_encoding(&send_algo.unwrap_or(CompressionAlgorithm::none)) + into_encoding(&send_algo.unwrap_or(HttpCompressionAlgorithm::none)) { service = service.send_compressed(encoding); } @@ -315,7 +315,7 @@ async fn inner_main( let mut service = v.into_service(); let send_algo = &http_config.compression.send_compression_algorithm; if let Some(encoding) = - into_encoding(&send_algo.unwrap_or(CompressionAlgorithm::none)) + into_encoding(&send_algo.unwrap_or(HttpCompressionAlgorithm::none)) { service = service.send_compressed(encoding); } @@ -355,7 +355,7 @@ async fn inner_main( let mut service = v.into_service(); let send_algo = &http_config.compression.send_compression_algorithm; if let Some(encoding) = - into_encoding(&send_algo.unwrap_or(CompressionAlgorithm::none)) + into_encoding(&send_algo.unwrap_or(HttpCompressionAlgorithm::none)) { service = service.send_compressed(encoding); } @@ -379,7 +379,7 @@ async fn inner_main( let mut service = v.into_service(); let send_algo = &http_config.compression.send_compression_algorithm; if let Some(encoding) = - into_encoding(&send_algo.unwrap_or(CompressionAlgorithm::none)) + into_encoding(&send_algo.unwrap_or(HttpCompressionAlgorithm::none)) { service = service.send_compressed(encoding); } @@ -405,7 +405,7 @@ async fn inner_main( let mut service = v.into_service(); let send_algo = &http_config.compression.send_compression_algorithm; if let Some(encoding) = - into_encoding(&send_algo.unwrap_or(CompressionAlgorithm::none)) + into_encoding(&send_algo.unwrap_or(HttpCompressionAlgorithm::none)) { service = service.send_compressed(encoding); }