aboutsummaryrefslogtreecommitdiff
path: root/src/bayou.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2023-11-17 15:23:05 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2023-11-17 15:23:05 +0100
commit89cb8d9572d623baa858cc1c6a8472053728eafc (patch)
treebeca0d28b9d157b11b6db06f9e1c8377cab5acdc /src/bayou.rs
parente92dc35564e91ce4e6a8defa9e8b52eef9e55fae (diff)
downloadaerogramme-89cb8d9572d623baa858cc1c6a8472053728eafc.tar.gz
aerogramme-89cb8d9572d623baa858cc1c6a8472053728eafc.zip
no more error on baiyou
Diffstat (limited to 'src/bayou.rs')
-rw-r--r--src/bayou.rs15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/bayou.rs b/src/bayou.rs
index d3027c5..72c2b80 100644
--- a/src/bayou.rs
+++ b/src/bayou.rs
@@ -1,4 +1,3 @@
-use std::str::FromStr;
use std::sync::{Arc, Weak};
use std::time::{Duration, Instant};
@@ -6,7 +5,6 @@ use anyhow::{anyhow, bail, Result};
use log::{debug, error, info};
use rand::prelude::*;
use serde::{Deserialize, Serialize};
-use tokio::io::AsyncReadExt;
use tokio::sync::{watch, Notify};
use crate::cryptoblob::*;
@@ -233,7 +231,7 @@ impl<S: BayouState> Bayou<S> {
// Save info that sync has been done
self.last_sync = new_last_sync;
- self.last_sync_watch_ct = new_last_sync_watch_ct;
+ self.last_sync_watch_ct = self.k2v.from_orphan(new_last_sync_watch_ct).expect("Source & target storage must be compatible");
Ok(())
}
@@ -245,7 +243,7 @@ impl<S: BayouState> Bayou<S> {
Some(t) => Instant::now() > t + (CHECKPOINT_INTERVAL / 5),
_ => true,
};
- let changed = self.last_sync_watch_ct != *self.watch.rx.borrow();
+ let changed = self.last_sync_watch_ct.to_orphan() != *self.watch.rx.borrow();
if too_old || changed {
self.sync().await?;
}
@@ -266,12 +264,9 @@ impl<S: BayouState> Bayou<S> {
.unwrap_or(&self.checkpoint.0),
);
self.k2v
- .insert_item(
- &self.path,
- &ts.to_string(),
- seal_serialize(&op, &self.key)?,
- None,
- )
+ .row(&self.path, &ts.to_string())
+ .set_value(seal_serialize(&op, &self.key)?)
+ .push()
.await?;
self.watch.notify.notify_one();