pub struct RelayManager;Expand description
Scores relay candidates.
Holds no role of its own: whether this device is acting as a relay is answered by the forwarding governor from what the device has actually carried, not predicted here from thresholds. What remains is the comparison of other devices as onward candidates.
Implementations§
Source§impl RelayManager
impl RelayManager
Sourcepub fn calculate_relay_score(&self, relay: &RelayInfo) -> f32
pub fn calculate_relay_score(&self, relay: &RelayInfo) -> f32
Calculates a score for a potential relay.
Higher score = better relay candidate.
Sourcepub fn select_best_relays(
&self,
candidates: Vec<RelayInfo>,
count: usize,
max_congestion_level: f32,
) -> Vec<RelayInfo>
pub fn select_best_relays( &self, candidates: Vec<RelayInfo>, count: usize, max_congestion_level: f32, ) -> Vec<RelayInfo>
Selects the best relays from a list of candidates.
§Arguments
candidates- List of potential relayscount- Number of relays to selectmax_congestion_level- Congestion level (0.0-1.0) at or above which a candidate is considered overloaded and excluded; pass the caller’s path policy (e.g.PathConfig::max_congestion_level)
§Returns
Returns up to count relay candidates, sorted by score (best first).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RelayManager
impl RefUnwindSafe for RelayManager
impl Send for RelayManager
impl Sync for RelayManager
impl Unpin for RelayManager
impl UnsafeUnpin for RelayManager
impl UnwindSafe for RelayManager
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
Mutably borrows from an owned value. Read more