pub struct PathPlannerConfig {Show 14 fields
pub max_cache_capacity: u64,
pub cache_ttl: Duration,
pub refresh_period: Duration,
pub max_cached_paths: usize,
pub edge_penalty: f64,
pub min_ack_rate: f64,
pub min_paths_anonymity_floor: usize,
pub latency_halflife: Duration,
pub capacity_reference: u128,
pub return_path_weight_temper: f64,
pub return_path_exploration: f64,
pub max_plausible_loopback_rtt: Duration,
pub min_loopbacks_for_rate: u32,
pub min_loopback_return_rate: f64,
}Expand description
Configuration for PathPlanner’s internal path cache.
Fields§
§max_cache_capacity: u64Maximum number of (source, destination, options) entries in the path cache.
cache_ttl: DurationTime-to-live for a cached path list. When an entry expires the next
PathPlanner::resolve_routing call transparently recomputes it (lazy refresh).
Candidate weights are computed once, when the entry is filled, and frozen in the
[hopr_utils::statistics::WeightedCollection] – so this bounds how stale the weights a
live session draws from can be, not merely how stale the candidate set is. At the previous
60 s a relay that stopped delivering kept its full share of return-path draws for a minute
after the graph had already scored it down.
refresh_period: DurationPeriod between proactive background cache-refresh sweeps.
Held at half the TTL so a steady-state session is normally served from an entry that was re-weighted rather than one that expired under it.
max_cached_paths: usizeMaximum number of candidate paths the selector may return per query. All returned candidates are validated and cached. Must be at least 1: a zero limit leaves the selector unable to return any multi-hop path.
edge_penalty: f64Penalty multiplier for edges lacking probe-based quality observations.
Applied during path cost evaluation to down-weight unprobed edges.
Must be finite and in 0.0..=1.0.
min_ack_rate: f64Minimum acceptable message acknowledgment rate for path selection.
Edges with an ack rate below this threshold are excluded from candidate paths.
Must be finite and in 0.0..=1.0.
min_paths_anonymity_floor: usizeCandidate count below which no latency-based pruning occurs.
When fewer paths than this value are found, the selector returns all of them
unchanged (min(found_count, floor) semantics — the floor is never a minimum
to fabricate). Set to 0 to disable pruning entirely.
latency_halflife: DurationTotal path latency at which the latency factor in the composite weight equals 0.5. Higher values make the weight less sensitive to latency differences.
capacity_reference: u128Reference channel balance used to scale the capacity factor in the composite weight.
capacity_factor saturates at 1.0 near this value.
Defaults to 10_000_000 (~10 MiB in wxHOPR tokens).
return_path_weight_temper: f64Exponent applied to path weights before sampling, flattening the distribution. Despite the name it applies to forward draws as well as to return draws (the name is kept for configuration compatibility).
Paths are drawn weighted-random by path value, which concentrates a session’s SURBs, and its
forward packets, on the few highest-valued relays — losing one then costs far more than the
reliable-mode loss tolerance, and a forward path that collapses on one relayer goes dark
with it. Raising each weight to γ ∈ (0, 1] compresses the spread between good and bad
candidates without changing their order: w' = w^γ.
1.0 samples by raw path value (most traffic on the best relays, largest blast radius when
one dies). Values approaching 0.0 tend to a uniform draw (smallest blast radius, most
traffic on poor relays). With weights (0.4, 0.3, 0.2, 0.1), γ = 0.5 moves the busiest
relay’s share from 40% to 33% and the ratio between busiest and least-busy from 4.0 to 2.0.
Defaults to 0.5.
return_path_exploration: f64Fraction of path draws, forward and return, made uniformly at random instead of by weight (the name is kept for configuration compatibility).
Weights come from observations, and observations only exist for paths that get selected — a closed loop in which a path that falls out of favour stops being measured, so its score can never recover and it is never chosen again. Spending a small share of draws uniformly keeps the plausible candidates under observation, which is what lets a recovered one climb back.
Plausible means a tempered weight of at least a tenth of the best candidate’s. That leaves out a relayer on probation and an edge probes measured dead, and also a healthy path slow or thin enough to weigh less than a tenth. An exploring return draw takes one of those only within a node-wide allowance of one a second, while an ordinary return draw keeps it at its tempered weight: a reply through a relayer on probation is what revives it. A forward draw, exploring or not, never takes one, as a forward packet probes nothing.
Costs throughput in proportion: this share of draws, forward and return, deliberately ignores
which plausible candidate looks best. Candidates have already passed the selector’s gates
(open channels, min_ack_rate, and so on) before reaching here, so an exploratory draw never
takes a route the cost function rejected. 0.0 disables it. Defaults to 0.1.
max_plausible_loopback_rtt: DurationUpper bound on a loopback probe’s round-trip time considered plausible. Measurements above this cap (clock skew, stale telemetry) are discarded instead of poisoning the latency EMA with an absurd value.
min_loopbacks_for_rate: u32Loops over an edge from which the share that returned, not a single returned loop, decides whether
its relay delivers (handed to the graph through ChannelGraph::with_starvation). Below it, one returned loop
keeps the relay and none starves it. Few loops cross an edge in a sparse network, so this stays small.
min_loopback_return_rate: f64Share of loops over an edge that must return, once there are min_loopbacks_for_rate of them, for
its relay to stay routable. A relay dropping what it should forward still returns the odd loop, so
this is never zero. In (0.0, 1.0].
Trait Implementations§
Source§impl Clone for PathPlannerConfig
impl Clone for PathPlannerConfig
Source§fn clone(&self) -> PathPlannerConfig
fn clone(&self) -> PathPlannerConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for PathPlannerConfig
Source§impl Debug for PathPlannerConfig
impl Debug for PathPlannerConfig
Source§impl Default for PathPlannerConfig
impl Default for PathPlannerConfig
Source§fn default() -> Self
fn default() -> Self
Return PathPlannerConfig { max_cache_capacity: 10_000, cache_ttl: Duration::from_secs(10), refresh_period: Duration::from_secs(5), max_cached_paths: 50, edge_penalty: 0.5, min_ack_rate: 0.1, min_paths_anonymity_floor: 8, latency_halflife: Duration::from_millis(100), capacity_reference: 10_000_000, return_path_weight_temper: 0.5, return_path_exploration: 0.1, max_plausible_loopback_rtt: Duration::from_secs(30), min_loopbacks_for_rate: 3, min_loopback_return_rate: 0.1 }
Source§impl PartialEq for PathPlannerConfig
impl PartialEq for PathPlannerConfig
impl StructuralPartialEq for PathPlannerConfig
Auto Trait Implementations§
impl Freeze for PathPlannerConfig
impl RefUnwindSafe for PathPlannerConfig
impl Send for PathPlannerConfig
impl Sync for PathPlannerConfig
impl Unpin for PathPlannerConfig
impl UnsafeUnpin for PathPlannerConfig
impl UnwindSafe for PathPlannerConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.