pub struct PathManager { /* private fields */ }Expand description
Manager for tracking and closing redundant paths
Manages open paths and closes redundant ones when a best path is selected. Rules:
- Never close relay paths (they’re fallback)
- Keep at least MIN_DIRECT_PATHS direct paths open
- Never close the selected path
Implementations§
Source§impl PathManager
impl PathManager
Sourcepub fn with_min_direct_paths(min_direct_paths: usize) -> Self
pub fn with_min_direct_paths(min_direct_paths: usize) -> Self
Create a path manager with custom minimum direct paths
Sourcepub fn remove_path(&mut self, addr: &SocketAddr)
pub fn remove_path(&mut self, addr: &SocketAddr)
Remove a path
Sourcepub fn set_selected_path(&mut self, addr: SocketAddr)
pub fn set_selected_path(&mut self, addr: SocketAddr)
Set the selected (best) path
Sourcepub fn selected_path(&self) -> Option<SocketAddr>
pub fn selected_path(&self) -> Option<SocketAddr>
Get the selected path
Sourcepub fn contains(&self, addr: &SocketAddr) -> bool
pub fn contains(&self, addr: &SocketAddr) -> bool
Check if a path is tracked
Sourcepub fn is_relay_path(&self, addr: &SocketAddr) -> bool
pub fn is_relay_path(&self, addr: &SocketAddr) -> bool
Check if a path is a relay path
Sourcepub fn direct_path_count(&self) -> usize
pub fn direct_path_count(&self) -> usize
Count of open direct paths
Sourcepub fn relay_path_count(&self) -> usize
pub fn relay_path_count(&self) -> usize
Count of open relay paths
Sourcepub fn open_paths(&self) -> Vec<&PathInfo>
pub fn open_paths(&self) -> Vec<&PathInfo>
Get all open paths
Sourcepub fn close_redundant_paths(&mut self) -> Vec<SocketAddr>
pub fn close_redundant_paths(&mut self) -> Vec<SocketAddr>
Close redundant paths, returning list of closed addresses
Rules:
- Only close direct paths (never relay - they’re fallback)
- Don’t close the selected path
- Keep at least min_direct_paths direct paths open
Sourcepub fn update_rtt(&mut self, addr: &SocketAddr, rtt: Duration)
pub fn update_rtt(&mut self, addr: &SocketAddr, rtt: Duration)
Update RTT for a path
Sourcepub fn mark_open(&mut self, addr: &SocketAddr)
pub fn mark_open(&mut self, addr: &SocketAddr)
Mark a path as open
Sourcepub fn mark_closed(&mut self, addr: &SocketAddr)
pub fn mark_closed(&mut self, addr: &SocketAddr)
Mark a path as closed
Trait Implementations§
Source§impl Debug for PathManager
impl Debug for PathManager
Source§impl Default for PathManager
impl Default for PathManager
Source§fn default() -> PathManager
fn default() -> PathManager
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PathManager
impl RefUnwindSafe for PathManager
impl Send for PathManager
impl Sync for PathManager
impl Unpin for PathManager
impl UnwindSafe for PathManager
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