mirror of https://github.com/dapr/rust-sdk.git
Handle metadata for get_configuration and subscribe_configuration (#118)
* Add metadata parameter for config get and subscribe Signed-off-by: David Blackwood <david.blackwood@rockwellautomation.com> * Bump version Signed-off-by: David Blackwood <david.blackwood@rockwellautomation.com> * Revert "Bump version" This reverts commit77470758de
. Signed-off-by: David Blackwood <david.blackwood@rockwellautomation.com> * Revert "Bump version" This reverts commit77470758de
. Signed-off-by: David Blackwood <david.blackwood@rockwellautomation.com> --------- Signed-off-by: David Blackwood <david.blackwood@rockwellautomation.com>
This commit is contained in:
parent
ceaccb1218
commit
a9df2d9a25
|
@ -20,14 +20,14 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
|
||||
// save key-value pair in the state store
|
||||
let response = client
|
||||
.get_configuration(CONFIGSTORE_NAME, vec![(&key)])
|
||||
.get_configuration(CONFIGSTORE_NAME, vec![(&key)], None)
|
||||
.await?;
|
||||
let val = response.items.get("hello").unwrap();
|
||||
println!("Configuration value: {val:?}");
|
||||
|
||||
// Subscribe for configuration changes
|
||||
let mut stream = client
|
||||
.subscribe_configuration(CONFIGSTORE_NAME, vec![(&key)])
|
||||
.subscribe_configuration(CONFIGSTORE_NAME, vec![(&key)], None)
|
||||
.await?;
|
||||
|
||||
let mut subscription_id = String::new();
|
||||
|
|
|
@ -311,6 +311,7 @@ impl<T: DaprInterface> Client<T> {
|
|||
&mut self,
|
||||
store_name: S,
|
||||
keys: Vec<K>,
|
||||
metadata: Option<HashMap<String, String>>,
|
||||
) -> Result<GetConfigurationResponse, Error>
|
||||
where
|
||||
S: Into<String>,
|
||||
|
@ -319,7 +320,7 @@ impl<T: DaprInterface> Client<T> {
|
|||
let request = GetConfigurationRequest {
|
||||
store_name: store_name.into(),
|
||||
keys: keys.into_iter().map(|key| key.into()).collect(),
|
||||
metadata: Default::default(),
|
||||
metadata: metadata.unwrap_or_default(),
|
||||
};
|
||||
self.0.get_configuration(request).await
|
||||
}
|
||||
|
@ -329,6 +330,7 @@ impl<T: DaprInterface> Client<T> {
|
|||
&mut self,
|
||||
store_name: S,
|
||||
keys: Vec<S>,
|
||||
metadata: Option<HashMap<String, String>>,
|
||||
) -> Result<Streaming<SubscribeConfigurationResponse>, Error>
|
||||
where
|
||||
S: Into<String>,
|
||||
|
@ -336,7 +338,7 @@ impl<T: DaprInterface> Client<T> {
|
|||
let request = SubscribeConfigurationRequest {
|
||||
store_name: store_name.into(),
|
||||
keys: keys.into_iter().map(|key| key.into()).collect(),
|
||||
metadata: Default::default(),
|
||||
metadata: metadata.unwrap_or_default(),
|
||||
};
|
||||
self.0.subscribe_configuration(request).await
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue