aboutsummaryrefslogtreecommitdiff
path: root/src/k2v-client/bin/k2v-cli.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-07-04 12:46:44 +0200
committerAlex Auvolat <alex@adnab.me>2022-07-04 12:46:44 +0200
commit17d0254c7c246aaa58e34d4454643579309aa356 (patch)
tree17a9eaa957f77db931668f95fe6ed630225cb32f /src/k2v-client/bin/k2v-cli.rs
parentc4be56704df81c257b07e8b83170f46346908013 (diff)
parent0850bac874029f0b8b278d75537dd037e5db57da (diff)
downloadgarage-17d0254c7c246aaa58e34d4454643579309aa356.tar.gz
garage-17d0254c7c246aaa58e34d4454643579309aa356.zip
Merge branch 'main' into background-task-manager
Diffstat (limited to 'src/k2v-client/bin/k2v-cli.rs')
-rw-r--r--src/k2v-client/bin/k2v-cli.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/k2v-client/bin/k2v-cli.rs b/src/k2v-client/bin/k2v-cli.rs
index 38c39361..884e7438 100644
--- a/src/k2v-client/bin/k2v-cli.rs
+++ b/src/k2v-client/bin/k2v-cli.rs
@@ -55,6 +55,19 @@ enum Command {
#[clap(flatten)]
output_kind: ReadOutputKind,
},
+ /// Watch changes on a single value
+ Poll {
+ /// Partition key to delete from
+ partition_key: String,
+ /// Sort key to delete from
+ sort_key: String,
+ /// Causality information
+ #[clap(short, long)]
+ causality: String,
+ /// Output formating
+ #[clap(flatten)]
+ output_kind: ReadOutputKind,
+ },
/// Delete a single value
Delete {
/// Partition key to delete from
@@ -324,6 +337,21 @@ async fn main() -> Result<(), Error> {
let res = client.read_item(&partition_key, &sort_key).await?;
output_kind.display_output(res);
}
+ Command::Poll {
+ partition_key,
+ sort_key,
+ causality,
+ output_kind,
+ } => {
+ let res_opt = client
+ .poll_item(&partition_key, &sort_key, causality.into(), None)
+ .await?;
+ if let Some(res) = res_opt {
+ output_kind.display_output(res);
+ } else {
+ println!("Delay expired and value didn't change.");
+ }
+ }
Command::ReadIndex {
output_kind,
filter,