pub struct AutoDiscoveryBackend { /* private fields */ }Expand description
Auto-discovery distributed backend.
Automatically discovers peers on the local network using mDNS/Bonjour and establishes connections for gradient synchronization.
Implementations§
Source§impl AutoDiscoveryBackend
impl AutoDiscoveryBackend
Sourcepub async fn new() -> Result<Self>
pub async fn new() -> Result<Self>
Create a new auto-discovery backend with default configuration.
Sourcepub async fn with_config(config: AutoDiscoveryConfig) -> Result<Self>
pub async fn with_config(config: AutoDiscoveryConfig) -> Result<Self>
Create a new auto-discovery backend with custom configuration.
Sourcepub fn peer_id_string(&self) -> String
pub fn peer_id_string(&self) -> String
Get the local node’s peer ID as a string.
Sourcepub fn topology(&self) -> SharedTopology
pub fn topology(&self) -> SharedTopology
Get the current cluster topology.
Sourcepub fn peer_count(&self) -> usize
pub fn peer_count(&self) -> usize
Get the number of discovered peers.
Sourcepub async fn wait_for_peers(
&self,
min_peers: usize,
timeout_duration: Duration,
) -> Result<usize>
pub async fn wait_for_peers( &self, min_peers: usize, timeout_duration: Duration, ) -> Result<usize>
Wait for a minimum number of peers to be discovered.
Returns the number of peers found, or an error if timeout occurs.
Sourcepub async fn establish_ring(&self) -> Result<()>
pub async fn establish_ring(&self) -> Result<()>
Ensure the ring is established, initialising it exactly once.
Uses tokio::sync::OnceCell::get_or_try_init so that exactly one
concurrent caller performs the TCP connection and all others wait.
If the connection attempt fails the cell remains unset, allowing the
caller to retry on the next all-reduce.
Sourcepub fn is_ring_ready(&self) -> bool
pub fn is_ring_ready(&self) -> bool
Check if the ring has been successfully established.
Returns true iff establish_ring has completed successfully at least
once. This is a cheap non-blocking check suitable for logging.
Trait Implementations§
Source§impl Debug for AutoDiscoveryBackend
impl Debug for AutoDiscoveryBackend
Source§impl DistributedBackend for AutoDiscoveryBackend
impl DistributedBackend for AutoDiscoveryBackend
Source§fn world_size(&self) -> usize
fn world_size(&self) -> usize
Auto Trait Implementations§
impl !Freeze for AutoDiscoveryBackend
impl !RefUnwindSafe for AutoDiscoveryBackend
impl Send for AutoDiscoveryBackend
impl Sync for AutoDiscoveryBackend
impl Unpin for AutoDiscoveryBackend
impl UnsafeUnpin for AutoDiscoveryBackend
impl !UnwindSafe for AutoDiscoveryBackend
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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