Skip to content

Commit

Permalink
remove protocol crate dependencies on boringssl
Browse files Browse the repository at this point in the history
The protocol crates transitively depend on boringssl through the
default features in the config/common crates.

This PR removes the transitive dependencies where possible by
making boringssl an optional but default feature where it is
required.
  • Loading branch information
brayniac committed Apr 8, 2024
1 parent 0c05f32 commit 95b3613
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 10 deletions.
6 changes: 5 additions & 1 deletion src/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ license = { workspace = true }
boring = { workspace = true }
clocksource = { workspace = true }
metriken = { workspace = true }
pelikan-net = { workspace = true, features = ["boringssl"] }
pelikan-net = { workspace = true, default-features = false }
ringlog = { workspace = true }
serde = { workspace = true, features = ["derive"] }

[features]
default = ["boringssl"]
boringssl = ["pelikan-net/boringssl"]
1 change: 1 addition & 0 deletions src/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ pub mod bytes;
pub mod expiry;
pub mod metrics;
pub mod signal;
#[cfg(feature = "boringssl")]
pub mod ssl;
pub mod traits;
6 changes: 5 additions & 1 deletion src/config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ repository = { workspace = true }
license = { workspace = true }

[dependencies]
common = { path = "../common" }
common = { path = "../common", default-features = false }
log = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
toml = { workspace = true }

[features]
default = ["boringssl"]
boringssl = ["common/boringssl"]
2 changes: 2 additions & 0 deletions src/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ mod sockio;
mod stats_log;
mod tcp;
pub mod time;
#[cfg(feature = "boringssl")]
mod tls;
mod units;
mod worker;
Expand All @@ -44,5 +45,6 @@ pub use sockio::{Sockio, SockioConfig};
pub use stats_log::StatsLogConfig;
pub use tcp::{Tcp, TcpConfig};
pub use time::{Time, TimeConfig, TimeType};
#[cfg(feature = "boringssl")]
pub use tls::{Tls, TlsConfig};
pub use worker::{Worker, WorkerConfig};
3 changes: 3 additions & 0 deletions src/config/src/pingproxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub struct PingproxyConfig {

#[serde(default)]
time: Time,
#[cfg(feature = "boringssl")]
#[serde(default)]
tls: Tls,

Expand Down Expand Up @@ -126,6 +127,7 @@ impl TimeConfig for PingproxyConfig {
}
}

#[cfg(feature = "boringssl")]
impl TlsConfig for PingproxyConfig {
fn tls(&self) -> &Tls {
&self.tls
Expand Down Expand Up @@ -183,6 +185,7 @@ impl Default for PingproxyConfig {
klog: Default::default(),
sockio: Default::default(),
tcp: Default::default(),
#[cfg(feature = "boringssl")]
tls: Default::default(),
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/config/src/pingserver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub struct PingserverConfig {
worker: Worker,
#[serde(default)]
time: Time,
#[cfg(feature = "boringssl")]
#[serde(default)]
tls: Tls,

Expand Down Expand Up @@ -110,6 +111,7 @@ impl TimeConfig for PingserverConfig {
}
}

#[cfg(feature = "boringssl")]
impl TlsConfig for PingserverConfig {
fn tls(&self) -> &Tls {
&self.tls
Expand Down Expand Up @@ -175,6 +177,7 @@ impl Default for PingserverConfig {
klog: Default::default(),
sockio: Default::default(),
tcp: Default::default(),
#[cfg(feature = "boringssl")]
tls: Default::default(),
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/config/src/rds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub struct RdsConfig {
worker: Worker,
#[serde(default)]
time: Time,
#[cfg(feature = "boringssl")]
#[serde(default)]
tls: Tls,
#[serde(default)]
Expand Down Expand Up @@ -160,6 +161,7 @@ impl TimeConfig for RdsConfig {
}
}

#[cfg(feature = "boringssl")]
impl TlsConfig for RdsConfig {
fn tls(&self) -> &Tls {
&self.tls
Expand Down Expand Up @@ -195,6 +197,7 @@ impl Default for RdsConfig {
klog: Default::default(),
sockio: Default::default(),
tcp: Default::default(),
#[cfg(feature = "boringssl")]
tls: Default::default(),
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/config/src/segcache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub struct SegcacheConfig {
worker: Worker,
#[serde(default)]
time: Time,
#[cfg(feature = "boringssl")]
#[serde(default)]
tls: Tls,
#[serde(default)]
Expand Down Expand Up @@ -160,6 +161,7 @@ impl TimeConfig for SegcacheConfig {
}
}

#[cfg(feature = "boringssl")]
impl TlsConfig for SegcacheConfig {
fn tls(&self) -> &Tls {
&self.tls
Expand Down Expand Up @@ -195,6 +197,7 @@ impl Default for SegcacheConfig {
klog: Default::default(),
sockio: Default::default(),
tcp: Default::default(),
#[cfg(feature = "boringssl")]
tls: Default::default(),
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/logger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ repository = { workspace = true }
license = { workspace = true }

[dependencies]
common = { path = "../common" }
config = { path = "../config" }
common = { path = "../common", default-features = false }
config = { path = "../config", default-features = false }
ringlog = { workspace = true }
4 changes: 2 additions & 2 deletions src/protocol/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ license = { workspace = true }

[dependencies]
bytes = { workspace = true }
common = { path = "../../common" }
config = { path = "../../config" }
common = { path = "../../common", default-features = false }
config = { path = "../../config", default-features = false }
logger = { path = "../../logger" }
storage-types = { path = "../../storage/types" }

Expand Down
2 changes: 1 addition & 1 deletion src/protocol/memcache/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ path = "benches/request_parsing.rs"
harness = false

[dependencies]
common = { path = "../../common" }
common = { path = "../../common", default-features = false }
clocksource = { workspace = true }
logger = { path = "../../logger" }
metriken = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions src/protocol/ping/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ path = "benches/ping.rs"
harness = false

[dependencies]
common = { path = "../../common" }
config = { path = "../../config" }
logger = { path = "../../logger" }
common = { path = "../../common", default-features = false }
config = { path = "../../config", default-features = false }
logger = { path = "../../logger", default-features = false }
metriken = { workspace = true }
protocol-common = { path = "../../protocol/common" }
storage-types = { path = "../../storage/types" }
Expand Down

0 comments on commit 95b3613

Please sign in to comment.