Skip to main content

Discovery

Trait Discovery 

Source
pub trait Discovery:
    Send
    + Sync
    + 'static {
    // Required methods
    fn register<'life0, 'async_trait>(
        &'life0 self,
        instance: ServiceInstance,
    ) -> Pin<Box<dyn Future<Output = Result<(), DiscoveryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn discover<'life0, 'life1, 'async_trait>(
        &'life0 self,
        service_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ServiceInstance>, DiscoveryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn heartbeat<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        service_name: &'life1 str,
        instance_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), DiscoveryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn deregister<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        service_name: &'life1 str,
        instance_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), DiscoveryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn watch<'life0, 'life1, 'async_trait>(
        &'life0 self,
        service_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<WatchStream, DiscoveryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Methods§

Source

fn register<'life0, 'async_trait>( &'life0 self, instance: ServiceInstance, ) -> Pin<Box<dyn Future<Output = Result<(), DiscoveryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Register a service instance. Returns error if registration fails.

Source

fn discover<'life0, 'life1, 'async_trait>( &'life0 self, service_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<ServiceInstance>, DiscoveryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Discover all healthy instances of a service.

Source

fn heartbeat<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, service_name: &'life1 str, instance_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), DiscoveryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Send a heartbeat to keep registration alive.

Source

fn deregister<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, service_name: &'life1 str, instance_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), DiscoveryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Remove a service instance from the registry.

Source

fn watch<'life0, 'life1, 'async_trait>( &'life0 self, service_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<WatchStream, DiscoveryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Watch for changes to a service’s instances. Returns a stream of instance lists.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§