nacos_sdk::api::naming

Trait NamingService

Source
pub trait NamingService: Send + Sync {
    // Required methods
    fn register_instance<'life0, 'async_trait>(
        &'life0 self,
        service_name: String,
        group_name: Option<String>,
        service_instance: ServiceInstance,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn deregister_instance<'life0, 'async_trait>(
        &'life0 self,
        service_name: String,
        group_name: Option<String>,
        service_instance: ServiceInstance,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn batch_register_instance<'life0, 'async_trait>(
        &'life0 self,
        service_name: String,
        group_name: Option<String>,
        service_instances: Vec<ServiceInstance>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_all_instances<'life0, 'async_trait>(
        &'life0 self,
        service_name: String,
        group_name: Option<String>,
        clusters: Vec<String>,
        subscribe: bool,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ServiceInstance>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn select_instances<'life0, 'async_trait>(
        &'life0 self,
        service_name: String,
        group_name: Option<String>,
        clusters: Vec<String>,
        subscribe: bool,
        healthy: bool,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ServiceInstance>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn select_one_healthy_instance<'life0, 'async_trait>(
        &'life0 self,
        service_name: String,
        group_name: Option<String>,
        clusters: Vec<String>,
        subscribe: bool,
    ) -> Pin<Box<dyn Future<Output = Result<ServiceInstance>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_service_list<'life0, 'async_trait>(
        &'life0 self,
        page_no: i32,
        page_size: i32,
        group_name: Option<String>,
    ) -> Pin<Box<dyn Future<Output = Result<(Vec<String>, i32)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn subscribe<'life0, 'async_trait>(
        &'life0 self,
        service_name: String,
        group_name: Option<String>,
        clusters: Vec<String>,
        event_listener: Arc<dyn NamingEventListener>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn unsubscribe<'life0, 'async_trait>(
        &'life0 self,
        service_name: String,
        group_name: Option<String>,
        clusters: Vec<String>,
        event_listener: Arc<dyn NamingEventListener>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Api NamingService.

§Examples

 let mut naming_service = nacos_sdk::api::naming::NamingServiceBuilder::new(
       nacos_sdk::api::props::ClientProps::new()
          .server_addr("127.0.0.1:8848")
          // Attention! "public" is "", it is recommended to customize the namespace with clear meaning.
          .namespace("")
          .app_name("todo-your-app-name"),
  )
  .build()?;

Required Methods§

Source

fn register_instance<'life0, 'async_trait>( &'life0 self, service_name: String, group_name: Option<String>, service_instance: ServiceInstance, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn deregister_instance<'life0, 'async_trait>( &'life0 self, service_name: String, group_name: Option<String>, service_instance: ServiceInstance, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn batch_register_instance<'life0, 'async_trait>( &'life0 self, service_name: String, group_name: Option<String>, service_instances: Vec<ServiceInstance>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_all_instances<'life0, 'async_trait>( &'life0 self, service_name: String, group_name: Option<String>, clusters: Vec<String>, subscribe: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<ServiceInstance>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn select_instances<'life0, 'async_trait>( &'life0 self, service_name: String, group_name: Option<String>, clusters: Vec<String>, subscribe: bool, healthy: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<ServiceInstance>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn select_one_healthy_instance<'life0, 'async_trait>( &'life0 self, service_name: String, group_name: Option<String>, clusters: Vec<String>, subscribe: bool, ) -> Pin<Box<dyn Future<Output = Result<ServiceInstance>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_service_list<'life0, 'async_trait>( &'life0 self, page_no: i32, page_size: i32, group_name: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<(Vec<String>, i32)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn subscribe<'life0, 'async_trait>( &'life0 self, service_name: String, group_name: Option<String>, clusters: Vec<String>, event_listener: Arc<dyn NamingEventListener>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn unsubscribe<'life0, 'async_trait>( &'life0 self, service_name: String, group_name: Option<String>, clusters: Vec<String>, event_listener: Arc<dyn NamingEventListener>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§