Skip to main content

DirectoryClient

Trait DirectoryClient 

Source
pub trait DirectoryClient: Send + Sync {
    // Required methods
    fn resolve_grpc_service<'life0, 'life1, 'async_trait>(
        &'life0 self,
        service_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<ServiceEndpoint, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn list_instances<'life0, 'life1, 'async_trait>(
        &'life0 self,
        module: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ServiceInstanceInfo>, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn register_instance<'life0, 'async_trait>(
        &'life0 self,
        info: RegisterInstanceInfo,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn deregister_instance<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        module: &'life1 str,
        instance_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn send_heartbeat<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        module: &'life1 str,
        instance_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
}
Expand description

Directory API trait for service discovery and instance management

This trait defines the contract for interacting with the module directory. It can be implemented by:

  • A local implementation that delegates to ModuleManager
  • A gRPC client for out-of-process modules

Required Methods§

Source

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

Resolve a gRPC service by its logical name to an endpoint

Source

fn list_instances<'life0, 'life1, 'async_trait>( &'life0 self, module: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<ServiceInstanceInfo>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

List all service instances for a given module

Source

fn register_instance<'life0, 'async_trait>( &'life0 self, info: RegisterInstanceInfo, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Register a new module instance with the directory

Source

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

Deregister a module instance (for graceful shutdown)

Source

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

Send a heartbeat for a module instance to indicate it’s still alive

Implementors§