Trait nacos_sdk::api::config::ConfigService

source ·
pub trait ConfigService: Send + Sync {
    // Required methods
    fn get_config<'life0, 'async_trait>(
        &'life0 self,
        data_id: String,
        group: String,
    ) -> Pin<Box<dyn Future<Output = Result<ConfigResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn publish_config<'life0, 'async_trait>(
        &'life0 self,
        data_id: String,
        group: String,
        content: String,
        content_type: Option<String>,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn publish_config_cas<'life0, 'async_trait>(
        &'life0 self,
        data_id: String,
        group: String,
        content: String,
        content_type: Option<String>,
        cas_md5: String,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn publish_config_beta<'life0, 'async_trait>(
        &'life0 self,
        data_id: String,
        group: String,
        content: String,
        content_type: Option<String>,
        beta_ips: String,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn publish_config_param<'life0, 'async_trait>(
        &'life0 self,
        data_id: String,
        group: String,
        content: String,
        content_type: Option<String>,
        cas_md5: Option<String>,
        params: HashMap<String, String>,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn remove_config<'life0, 'async_trait>(
        &'life0 self,
        data_id: String,
        group: String,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn add_listener<'life0, 'async_trait>(
        &'life0 self,
        data_id: String,
        group: String,
        listener: Arc<dyn ConfigChangeListener>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn remove_listener<'life0, 'async_trait>(
        &'life0 self,
        data_id: String,
        group: String,
        listener: Arc<dyn ConfigChangeListener>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Api ConfigService.

§Examples

 let mut config_service = nacos_sdk::api::config::ConfigServiceBuilder::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 get_config<'life0, 'async_trait>( &'life0 self, data_id: String, group: String, ) -> Pin<Box<dyn Future<Output = Result<ConfigResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get config, return the content.

Attention to error::Error::ConfigNotFound, error::Error::ConfigQueryConflict

source

fn publish_config<'life0, 'async_trait>( &'life0 self, data_id: String, group: String, content: String, content_type: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Publish config, return true/false.

source

fn publish_config_cas<'life0, 'async_trait>( &'life0 self, data_id: String, group: String, content: String, content_type: Option<String>, cas_md5: String, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Cas publish config with cas_md5 (prev content’s md5), return true/false.

source

fn publish_config_beta<'life0, 'async_trait>( &'life0 self, data_id: String, group: String, content: String, content_type: Option<String>, beta_ips: String, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Beta publish config, return true/false.

source

fn publish_config_param<'life0, 'async_trait>( &'life0 self, data_id: String, group: String, content: String, content_type: Option<String>, cas_md5: Option<String>, params: HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Publish config with params (see keys [constants::*]), return true/false.

source

fn remove_config<'life0, 'async_trait>( &'life0 self, data_id: String, group: String, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Remove config, return true/false.

source

fn add_listener<'life0, 'async_trait>( &'life0 self, data_id: String, group: String, listener: Arc<dyn ConfigChangeListener>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Listen the config change.

source

fn remove_listener<'life0, 'async_trait>( &'life0 self, data_id: String, group: String, listener: Arc<dyn ConfigChangeListener>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Remove a Listener.

Implementors§