aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2023-11-02 16:17:11 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2023-11-02 16:17:11 +0100
commitbf67935c54f5f66f4cab4ceb58c1b5831b9421b0 (patch)
treec578ddead0551a585dc1bee321687e3ff39e43a2
parenta65f5b25894faa9802d274beb394f40062c65bae (diff)
downloadaerogramme-bf67935c54f5f66f4cab4ceb58c1b5831b9421b0.tar.gz
aerogramme-bf67935c54f5f66f4cab4ceb58c1b5831b9421b0.zip
add rust analyzer to the shell
-rw-r--r--flake.nix2
-rw-r--r--src/mail/incoming.rs2
-rw-r--r--src/mail/mailbox.rs18
3 files changed, 9 insertions, 13 deletions
diff --git a/flake.nix b/flake.nix
index 8304326..4bea061 100644
--- a/flake.nix
+++ b/flake.nix
@@ -58,10 +58,12 @@
buildInputs = [
cargo2nix.packages.x86_64-linux.default
fenix.packages.x86_64-linux.minimal.toolchain
+ fenix.packages.x86_64-linux.rust-analyzer
];
shellHook = ''
echo "AEROGRAME DEVELOPMENT SHELL ${fenix.packages.x86_64-linux.minimal.rustc}"
export RUST_SRC_PATH="${fenix.packages.x86_64-linux.latest.rust-src}/lib/rustlib/src/rust/library"
+ export RUST_ANALYZER_INTERNALS_DO_NOT_USE='this is unstable'
'';
};
diff --git a/src/mail/incoming.rs b/src/mail/incoming.rs
index 4e3fc8c..e550e98 100644
--- a/src/mail/incoming.rs
+++ b/src/mail/incoming.rs
@@ -198,7 +198,7 @@ async fn move_incoming_message(
// 2 parse mail and add to inbox
let msg = IMF::try_from(&plain_mail[..]).map_err(|_| anyhow!("Invalid email body"))?;
inbox
- .append_from_s3(msg, id, &object_key, message_key)
+ .append_from_s3(msg, id, object.to_ref(), message_key)
.await?;
// 3 delete from incoming
diff --git a/src/mail/mailbox.rs b/src/mail/mailbox.rs
index 581f432..83039d5 100644
--- a/src/mail/mailbox.rs
+++ b/src/mail/mailbox.rs
@@ -14,7 +14,7 @@ use crate::login::Credentials;
use crate::mail::uidindex::*;
use crate::mail::unique_ident::*;
use crate::mail::IMF;
-use crate::storage::{RowStore, BlobStore};
+use crate::storage::{RowStore, BlobStore, self};
use crate::time::now_msec;
pub struct Mailbox {
@@ -121,13 +121,13 @@ impl Mailbox {
&self,
msg: IMF<'a>,
ident: UniqueIdent,
- s3_key: &str,
+ blob_ref: storage::BlobRef,
message_key: Key,
) -> Result<()> {
self.mbox
.write()
.await
- .append_from_s3(msg, ident, s3_key, message_key)
+ .append_from_s3(msg, ident, blob_ref, message_key)
.await
}
@@ -348,20 +348,14 @@ impl MailboxInternal {
&mut self,
mail: IMF<'a>,
ident: UniqueIdent,
- s3_key: &str,
+ blob_ref: storage::BlobRef,
message_key: Key,
) -> Result<()> {
futures::try_join!(
async {
// Copy mail body from previous location
- let cor = CopyObjectRequest {
- bucket: self.bucket.clone(),
- key: format!("{}/{}", self.mail_path, ident),
- copy_source: format!("{}/{}", self.bucket, s3_key),
- metadata_directive: Some("REPLACE".into()),
- ..Default::default()
- };
- self.s3.copy_object(cor).await?;
+ let dst = self.s3.blob(format!("{}/{}", self.mail_path, ident));
+ blob_ref.copy(dst).await?;
Ok::<_, anyhow::Error>(())
},
async {