in-memory storage #32
4 changed files with 10 additions and 10 deletions
|
@ -265,7 +265,7 @@ impl<S: BayouState> Bayou<S> {
|
||||||
);
|
);
|
||||||
self.k2v
|
self.k2v
|
||||||
.row(&self.path, &ts.to_string())
|
.row(&self.path, &ts.to_string())
|
||||||
.set_value(seal_serialize(&op, &self.key)?)
|
.set_value(&seal_serialize(&op, &self.key)?)
|
||||||
.push()
|
.push()
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
@ -500,7 +500,7 @@ impl K2vWatch {
|
||||||
}
|
}
|
||||||
_ = this.notify.notified() => {
|
_ = this.notify.notified() => {
|
||||||
let rand = u128::to_be_bytes(thread_rng().gen()).to_vec();
|
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);
|
error!("Error in bayou k2v watch updater loop: {}", e);
|
||||||
tokio::time::sleep(Duration::from_secs(30)).await;
|
tokio::time::sleep(Duration::from_secs(30)).await;
|
||||||
|
|
|
@ -104,11 +104,11 @@ impl LoginProvider for StaticLoginProvider {
|
||||||
bucket,
|
bucket,
|
||||||
};*/
|
};*/
|
||||||
let storage: storage::Builders = match user.storage {
|
let storage: storage::Builders = match user.storage {
|
||||||
StaticStorage::InMemory => X,
|
StaticStorage::InMemory => Box::new(storage::in_memory::FullMem {}),
|
||||||
StaticStorage::Garage => Y,
|
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?;
|
let (_, public_key) = CryptoKeys::load_salt_and_public(&k2v_client).await?;
|
||||||
|
|
||||||
Ok(PublicCredentials {
|
Ok(PublicCredentials {
|
||||||
|
|
|
@ -361,7 +361,7 @@ async fn k2v_lock_loop_internal(
|
||||||
Some(orphan) => k2v.from_orphan(orphan).expect("Source & target must be storage compatible"),
|
Some(orphan) => k2v.from_orphan(orphan).expect("Source & target must be storage compatible"),
|
||||||
None => k2v.row(pk, sk),
|
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);
|
error!("Could not take lock: {}", e);
|
||||||
tokio::time::sleep(Duration::from_secs(30)).await;
|
tokio::time::sleep(Duration::from_secs(30)).await;
|
||||||
}
|
}
|
||||||
|
@ -432,7 +432,7 @@ impl EncryptedMessage {
|
||||||
send.push().await?;
|
send.push().await?;
|
||||||
|
|
||||||
// Update watch key to signal new mail
|
// 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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,7 +282,7 @@ impl MailboxInternal {
|
||||||
rfc822_size: mail.raw.len(),
|
rfc822_size: mail.raw.len(),
|
||||||
};
|
};
|
||||||
let meta_blob = seal_serialize(&meta, &self.encryption_key)?;
|
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>(())
|
Ok::<_, anyhow::Error>(())
|
||||||
},
|
},
|
||||||
self.uid_index.opportunistic_sync()
|
self.uid_index.opportunistic_sync()
|
||||||
|
@ -326,7 +326,7 @@ impl MailboxInternal {
|
||||||
rfc822_size: mail.raw.len(),
|
rfc822_size: mail.raw.len(),
|
||||||
};
|
};
|
||||||
let meta_blob = seal_serialize(&meta, &self.encryption_key)?;
|
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>(())
|
Ok::<_, anyhow::Error>(())
|
||||||
},
|
},
|
||||||
self.uid_index.opportunistic_sync()
|
self.uid_index.opportunistic_sync()
|
||||||
|
@ -410,7 +410,7 @@ impl MailboxInternal {
|
||||||
// Copy mail meta in K2V
|
// Copy mail meta in K2V
|
||||||
let meta = &from.fetch_meta(&[source_id]).await?[0];
|
let meta = &from.fetch_meta(&[source_id]).await?[0];
|
||||||
let meta_blob = seal_serialize(meta, &self.encryption_key)?;
|
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>(())
|
Ok::<_, anyhow::Error>(())
|
||||||
},
|
},
|
||||||
self.uid_index.opportunistic_sync(),
|
self.uid_index.opportunistic_sync(),
|
||||||
|
|
Loading…
Reference in a new issue