From 8cd9801030e24c58621b3bed8723e8a8a4722ef8 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Thu, 23 Nov 2023 15:16:44 +0100 Subject: [PATCH] various fixes --- src/bayou.rs | 4 ++-- src/login/static_provider.rs | 6 +++--- src/mail/incoming.rs | 4 ++-- src/mail/mailbox.rs | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/bayou.rs b/src/bayou.rs index 72c2b80..3042f94 100644 --- a/src/bayou.rs +++ b/src/bayou.rs @@ -265,7 +265,7 @@ impl Bayou { ); 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; diff --git a/src/login/static_provider.rs b/src/login/static_provider.rs index 0e86cff..bd22060 100644 --- a/src/login/static_provider.rs +++ b/src/login/static_provider.rs @@ -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 { diff --git a/src/mail/incoming.rs b/src/mail/incoming.rs index da4c819..e3c729f 100644 --- a/src/mail/incoming.rs +++ b/src/mail/incoming.rs @@ -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(()) } diff --git a/src/mail/mailbox.rs b/src/mail/mailbox.rs index f27d50a..060267a 100644 --- a/src/mail/mailbox.rs +++ b/src/mail/mailbox.rs @@ -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(),