aboutsummaryrefslogtreecommitdiff
path: root/aerogramme/src/k2v_util.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2024-03-08 08:17:03 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2024-03-08 08:17:03 +0100
commit1a43ce5ac7033c148f64a033f2b1d335e95e11d5 (patch)
tree60b234604170fe207248458a9c4cdd3f4b7c36f2 /aerogramme/src/k2v_util.rs
parentbb9cb386b65834c44cae86bd100f800883022062 (diff)
downloadaerogramme-1a43ce5ac7033c148f64a033f2b1d335e95e11d5.tar.gz
aerogramme-1a43ce5ac7033c148f64a033f2b1d335e95e11d5.zip
WIP refactor
Diffstat (limited to 'aerogramme/src/k2v_util.rs')
-rw-r--r--aerogramme/src/k2v_util.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/aerogramme/src/k2v_util.rs b/aerogramme/src/k2v_util.rs
new file mode 100644
index 0000000..3cd969b
--- /dev/null
+++ b/aerogramme/src/k2v_util.rs
@@ -0,0 +1,26 @@
+/*
+use anyhow::Result;
+// ---- UTIL: function to wait for a value to have changed in K2V ----
+
+pub async fn k2v_wait_value_changed(
+ k2v: &storage::RowStore,
+ key: &storage::RowRef,
+) -> Result<CausalValue> {
+ loop {
+ if let Some(ct) = prev_ct {
+ match k2v.poll_item(pk, sk, ct.clone(), None).await? {
+ None => continue,
+ Some(cv) => return Ok(cv),
+ }
+ } else {
+ match k2v.read_item(pk, sk).await {
+ Err(k2v_client::Error::NotFound) => {
+ k2v.insert_item(pk, sk, vec![0u8], None).await?;
+ }
+ Err(e) => return Err(e.into()),
+ Ok(cv) => return Ok(cv),
+ }
+ }
+ }
+}
+*/