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§
Sourcefn 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 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
Sourcefn 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<'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.
Sourcefn 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_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.
Sourcefn 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_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.
Sourcefn 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 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.
Sourcefn 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 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.