pub struct MirrorManager { /* private fields */ }Expand description
Manages multiple mirrors for a repository, providing failover.
Implementations§
Source§impl MirrorManager
impl MirrorManager
Sourcepub fn add_mirror(&mut self, mirror: MirrorMetadata)
pub fn add_mirror(&mut self, mirror: MirrorMetadata)
Add a mirror to the manager.
Sourcepub fn remove_mirror(&mut self, url: &str) -> bool
pub fn remove_mirror(&mut self, url: &str) -> bool
Remove a mirror by URL.
Sourcepub fn select_best_mirror(&self) -> Option<&MirrorMetadata>
pub fn select_best_mirror(&self) -> Option<&MirrorMetadata>
Select the best available mirror.
Returns the highest-priority mirror that is not offline. Falls back to the first mirror if all are offline.
Sourcepub fn mark_offline(&mut self, url: &str)
pub fn mark_offline(&mut self, url: &str)
Mark a mirror as offline after a failed connection.
Sourcepub fn mark_online(&mut self, url: &str)
pub fn mark_online(&mut self, url: &str)
Mark a mirror as online after a successful connection.
Sourcepub fn list_mirrors(&self) -> &[MirrorMetadata]
pub fn list_mirrors(&self) -> &[MirrorMetadata]
List all mirrors.
Sourcepub fn mirror_count(&self) -> usize
pub fn mirror_count(&self) -> usize
Return the number of mirrors.