Skip to main content

EndpointSubscription

Trait EndpointSubscription 

Source
pub trait EndpointSubscription: Send + 'static {
    type Error: Send + 'static;

    // Required methods
    fn endpoints(&self) -> Vec<String>;
    fn changed(&mut self) -> EndpointChangeFuture<'_, Self::Error>;

    // Provided method
    fn discovered_endpoints(&self) -> Vec<DiscoveredEndpoint> { ... }
}
Expand description

A live, complete snapshot of the endpoints for one logical service.

Discovery backends expose snapshots rather than backend-specific add/remove events so transports can recover consistently after a watch reconnect or a lagged consumer.

Required Associated Types§

Source

type Error: Send + 'static

Required Methods§

Source

fn endpoints(&self) -> Vec<String>

Returns the latest complete endpoint snapshot in stable order.

Source

fn changed(&mut self) -> EndpointChangeFuture<'_, Self::Error>

Waits until a new complete endpoint snapshot is available.

Provided Methods§

Source

fn discovered_endpoints(&self) -> Vec<DiscoveredEndpoint>

Returns endpoint metadata when the backend provides it.

Existing discovery implementations remain source-compatible and receive weight 1.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§