Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle metadata for get_configuration and subscribe_configuration #118

Merged
merged 4 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/configuration/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 4 additions & 2 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand All @@ -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
}
Expand All @@ -329,14 +330,15 @@ 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>,
{
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
}
Expand Down