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 resolve_rest_service<'life0, 'life1, 'async_trait>(
&'life0 self,
gear_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 get_openapi_spec<'life0, 'life1, 'async_trait>(
&'life0 self,
gear_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn list_instances<'life0, 'life1, 'async_trait>(
&'life0 self,
gear: &'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,
gear: &'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,
gear: &'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 gear directory. It can be implemented by:
- A local implementation that delegates to
GearManager - A gRPC client for out-of-process gears
Required Methods§
Sourcefn 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 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
Sourcefn resolve_rest_service<'life0, 'life1, 'async_trait>(
&'life0 self,
gear_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 resolve_rest_service<'life0, 'life1, 'async_trait>(
&'life0 self,
gear_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 REST endpoint (HTTP base URL) for a gear by its name.
Returns the base URL (e.g. http://billing:8080) that callers use to
make REST requests to the resolved gear.
Sourcefn get_openapi_spec<'life0, 'life1, 'async_trait>(
&'life0 self,
gear_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_openapi_spec<'life0, 'life1, 'async_trait>(
&'life0 self,
gear_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Retrieve the OpenAPI spec (JSON) published by a gear.
Sourcefn list_instances<'life0, 'life1, 'async_trait>(
&'life0 self,
gear: &'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 list_instances<'life0, 'life1, 'async_trait>(
&'life0 self,
gear: &'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 gear
Sourcefn 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 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 gear instance with the directory
Sourcefn deregister_instance<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
gear: &'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 deregister_instance<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
gear: &'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 gear instance (for graceful shutdown)
Sourcefn send_heartbeat<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
gear: &'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,
gear: &'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 gear instance to indicate it’s still alive
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".