mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-09-02 17:15:43 +00:00
chore(easytier): gate hotpath-rs 0.19 dependency and off-mode shim
Re-enable the hotpath profiler as an optional dependency gated behind the feature (default off). In off builds the crate stays out of the dependency graph entirely: plus a local module provide no-op // macros so call sites compile unchanged. Also add a guarding the mutual exclusivity of with the / global allocators.
This commit is contained in:
+11
-6
@@ -58,6 +58,8 @@ chrono = { version = "0.4.37", features = ["serde"] }
|
|||||||
guarden = "0.2"
|
guarden = "0.2"
|
||||||
quanta = "0.12"
|
quanta = "0.12"
|
||||||
|
|
||||||
|
hotpath = { version = "0.19", default-features = false, optional = true }
|
||||||
|
|
||||||
delegate = "0.13.5"
|
delegate = "0.13.5"
|
||||||
|
|
||||||
itertools = "0.14.0"
|
itertools = "0.14.0"
|
||||||
@@ -410,11 +412,14 @@ tracing = ["tokio/tracing", "dep:console-subscriber"]
|
|||||||
magic-dns = ["dep:hickory-client", "dep:hickory-server"]
|
magic-dns = ["dep:hickory-client", "dep:hickory-server"]
|
||||||
faketcp = ["dep:flume"]
|
faketcp = ["dep:flume"]
|
||||||
zstd = ["dep:zstd"]
|
zstd = ["dep:zstd"]
|
||||||
# Deprecated: hotpath profiling has been removed. These feature aliases are
|
hotpath = [
|
||||||
# retained as no-ops so existing build scripts using `--features hotpath*`
|
"dep:hotpath",
|
||||||
# continue to work without pulling in any dependencies.
|
"hotpath/hotpath",
|
||||||
hotpath = []
|
"hotpath/tokio",
|
||||||
hotpath-cpu = ["hotpath"]
|
"hotpath/parking_lot",
|
||||||
hotpath-alloc = ["hotpath"]
|
"hotpath/flume",
|
||||||
|
]
|
||||||
|
hotpath-cpu = ["hotpath", "hotpath/hotpath-cpu"]
|
||||||
|
hotpath-alloc = ["hotpath", "hotpath/hotpath-alloc"]
|
||||||
# For Network Extension on macOS
|
# For Network Extension on macOS
|
||||||
macos-ne = []
|
macos-ne = []
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
//! No-op stand-in for the `hotpath` macros used by this crate, selected when
|
||||||
|
//! the `hotpath` feature is disabled.
|
||||||
|
//!
|
||||||
|
//! Keeping `hotpath` as an optional dependency means default builds do not pull
|
||||||
|
//! the profiler (or any of its transitive dependencies) into the dependency
|
||||||
|
//! graph. These macros expand to their input unchanged, mirroring `hotpath`'s
|
||||||
|
//! own disabled mode so call sites compile identically with or without the
|
||||||
|
//! feature.
|
||||||
|
//!
|
||||||
|
//! The macros are `#[macro_export]`-ed so that `lib.rs`' `extern crate self as
|
||||||
|
//! hotpath` alias exposes them through the same `hotpath::...` paths used when
|
||||||
|
//! the feature is enabled.
|
||||||
|
|
||||||
|
/// No-op mirroring `hotpath::channel!`: returns the channel expression
|
||||||
|
/// unchanged (dropping any optional trailing `label`/`log`/`capacity` args).
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! channel {
|
||||||
|
($expr:expr $(, $($rest:tt)*)?) => {
|
||||||
|
$expr
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// No-op mirroring `hotpath::mutex!`: returns the expression unchanged.
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! mutex {
|
||||||
|
($expr:expr $(, $($rest:tt)*)?) => {
|
||||||
|
$expr
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// No-op mirroring `hotpath::rw_lock!`: returns the expression unchanged.
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! rw_lock {
|
||||||
|
($expr:expr $(, $($rest:tt)*)?) => {
|
||||||
|
$expr
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -5,6 +5,20 @@ use std::io;
|
|||||||
use clap::Command;
|
use clap::Command;
|
||||||
use clap_complete::{Generator, Shell};
|
use clap_complete::{Generator, Shell};
|
||||||
|
|
||||||
|
// When the `hotpath` feature is off, alias the current crate as `hotpath` so
|
||||||
|
// call sites keep using `hotpath::...` paths, and provide a local no-op shim
|
||||||
|
// for the profiling macros. This keeps `hotpath` an optional dependency: the
|
||||||
|
// profiler is absent from the dependency graph entirely in default builds.
|
||||||
|
#[cfg(not(feature = "hotpath"))]
|
||||||
|
extern crate self as hotpath;
|
||||||
|
#[cfg(not(feature = "hotpath"))]
|
||||||
|
mod hotpath_off;
|
||||||
|
|
||||||
|
// `hotpath-alloc` registers a global profiling allocator, which is mutually
|
||||||
|
// exclusive with the `jemalloc`/`mimalloc` global allocators.
|
||||||
|
#[cfg(all(feature = "hotpath-alloc", any(feature = "jemalloc", feature = "mimalloc")))]
|
||||||
|
compile_error!("feature `hotpath-alloc` cannot be enabled together with `jemalloc` or `mimalloc`");
|
||||||
|
|
||||||
// Re-export `Instant` at the crate root so public APIs that expose it
|
// Re-export `Instant` at the crate root so public APIs that expose it
|
||||||
// (e.g. `Route::get_peer_info_last_update_time`) reference a deliberate
|
// (e.g. `Route::get_peer_info_last_update_time`) reference a deliberate
|
||||||
// public type rather than leaking an inaccessible one.
|
// public type rather than leaking an inaccessible one.
|
||||||
|
|||||||
Reference in New Issue
Block a user