various fixes

This commit is contained in:
Quentin 2023-11-23 15:16:44 +01:00
parent 14c7a96c28
commit 8cd9801030
Signed by: quentin
GPG key ID: E9602264D639FF68
4 changed files with 10 additions and 10 deletions

View file

@ -265,7 +265,7 @@ impl<S: BayouState> Bayou<S> {
);
self.k2v
.row(&self.path, &ts.to_string())
.set_value(seal_serialize(&op, &self.key)?)
.set_value(&seal_serialize(&op, &self.key)?)
.push()
.await?;
@ -500,7 +500,7 @@ impl K2vWatch {
}
_ = this.notify.notified() => {
let rand = u128::to_be_bytes(thread_rng().gen()).to_vec();
if let Err(e) = row.set_value(rand).push().await
if let Err(e) = row.set_value(&rand).push().await
{
error!("Error in bayou k2v watch updater loop: {}", e);
tokio::time::sleep(Duration::from_secs(30)).await;

View file

@ -104,11 +104,11 @@ impl LoginProvider for StaticLoginProvider {
bucket,
};*/
let storage: storage::Builders = match user.storage {
StaticStorage::InMemory => X,
StaticStorage::Garage => Y,
StaticStorage::InMemory => Box::new(storage::in_memory::FullMem {}),
StaticStorage::Garage(c) => Box::new(storage::garage::GrgCreds {}),
};
let k2v_client = storage.k2v_client()?;
let k2v_client = storage.row_store()?;
let (_, public_key) = CryptoKeys::load_salt_and_public(&k2v_client).await?;
Ok(PublicCredentials {

View file

@ -361,7 +361,7 @@ async fn k2v_lock_loop_internal(
Some(orphan) => k2v.from_orphan(orphan).expect("Source & target must be storage compatible"),
None => k2v.row(pk, sk),
};
if let Err(e) = row.set_value(lock).push().await {
if let Err(e) = row.set_value(&lock).push().await {
error!("Could not take lock: {}", e);
tokio::time::sleep(Duration::from_secs(30)).await;
}
@ -432,7 +432,7 @@ impl EncryptedMessage {
send.push().await?;
// Update watch key to signal new mail
watch_ct.set_value(gen_ident().0.to_vec()).push().await?;
watch_ct.set_value(gen_ident().0.as_ref()).push().await?;
Ok(())
}

View file

@ -282,7 +282,7 @@ impl MailboxInternal {
rfc822_size: mail.raw.len(),
};
let meta_blob = seal_serialize(&meta, &self.encryption_key)?;
self.k2v.row(&self.mail_path, &ident.to_string()).set_value(meta_blob).push().await?;
self.k2v.row(&self.mail_path, &ident.to_string()).set_value(&meta_blob).push().await?;
Ok::<_, anyhow::Error>(())
},
self.uid_index.opportunistic_sync()
@ -326,7 +326,7 @@ impl MailboxInternal {
rfc822_size: mail.raw.len(),
};
let meta_blob = seal_serialize(&meta, &self.encryption_key)?;
self.k2v.row(&self.mail_path, &ident.to_string()).set_value(meta_blob).push().await?;
self.k2v.row(&self.mail_path, &ident.to_string()).set_value(&meta_blob).push().await?;
Ok::<_, anyhow::Error>(())
},
self.uid_index.opportunistic_sync()
@ -410,7 +410,7 @@ impl MailboxInternal {
// Copy mail meta in K2V
let meta = &from.fetch_meta(&[source_id]).await?[0];
let meta_blob = seal_serialize(meta, &self.encryption_key)?;
self.k2v.row(&self.mail_path, &new_id.to_string()).set_value(meta_blob).push().await?;
self.k2v.row(&self.mail_path, &new_id.to_string()).set_value(&meta_blob).push().await?;
Ok::<_, anyhow::Error>(())
},
self.uid_index.opportunistic_sync(),