pub struct ServerDiscovery { /* private fields */ }Expand description
Server discovery service.
Implementations§
Source§impl ServerDiscovery
impl ServerDiscovery
Sourcepub fn with_seeds(seeds: Vec<String>) -> Self
pub fn with_seeds(seeds: Vec<String>) -> Self
Create with custom seeds.
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Set discovery timeout.
Sourcepub fn prefer_ssl(self, prefer: bool) -> Self
pub fn prefer_ssl(self, prefer: bool) -> Self
Set SSL preference.
Sourcepub fn discover(&self) -> Vec<DiscoveredServer>
pub fn discover(&self) -> Vec<DiscoveredServer>
Discover servers by resolving DNS seeds.
Returns a list of discovered servers with resolved addresses.
Sourcepub async fn discover_and_test(&self) -> Vec<DiscoveredServer>
pub async fn discover_and_test(&self) -> Vec<DiscoveredServer>
Discover and test servers for connectivity.
This performs actual TCP connections to verify reachability.
Sourcepub async fn best_server(&self) -> Result<DiscoveredServer>
pub async fn best_server(&self) -> Result<DiscoveredServer>
Get the best server based on latency.
Sourcepub async fn reachable_servers(&self) -> Vec<DiscoveredServer>
pub async fn reachable_servers(&self) -> Vec<DiscoveredServer>
Get all reachable servers sorted by latency.
Sourcepub async fn random_server(&self) -> Result<DiscoveredServer>
pub async fn random_server(&self) -> Result<DiscoveredServer>
Get a random reachable server.
Trait Implementations§
Source§impl Clone for ServerDiscovery
impl Clone for ServerDiscovery
Source§fn clone(&self) -> ServerDiscovery
fn clone(&self) -> ServerDiscovery
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ServerDiscovery
impl Debug for ServerDiscovery
Auto Trait Implementations§
impl Freeze for ServerDiscovery
impl RefUnwindSafe for ServerDiscovery
impl Send for ServerDiscovery
impl Sync for ServerDiscovery
impl Unpin for ServerDiscovery
impl UnwindSafe for ServerDiscovery
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