You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: upgrade momento sdk - consistency, less copypasta (#150)
This change establishes a common pattern for interacting with the
service. Rather than copy/pasting matches, MomentoError -> CliError
mapping and json dump code around, this names those functionalities
as functions:
* interact_with_momento: Completes a momento future and maps the
result to a Result< HappyCaseType, CliError >
* print_whatever_this_is_as_json: prints whatever you feed it as json
* drop windows lint, linux lint is enough
* also choco install protoc in a windows build near you. Relates to tokio-rs/prost#620
This change was precipitated by the change in the SDK to simplify
and coalesce client creation behind the SimpleCacheClientBuilder and
triggered by the SDK upgrade.
There are small changes to debug and error messages, but this change
should cause no functional changes.
tired of copypasta.
```
pub async fn delete_cache(cache_name: String, auth_token: String) -> Result<(), CliError> {
debug!("deleting cache...");
let mut momento = get_momento_client(auth_token).await?;
match momento.delete_cache(&cache_name).await {
Ok(_) => (),
Err(e) => return Err(CliError { msg: e.to_string() }),
};
Ok(())
}
```
becomes
```
pub async fn delete_cache(cache_name: String, auth_token: String) -> Result<(), CliError> {
let mut client = get_momento_client(auth_token).await?;
interact_with_momento("deleting cache...", client.delete_cache(&cache_name)).await
}
```
0 commit comments