Merge pull request 'partial re-implementation of body ext' (#30) from bodyext into main
Reviewed-on: #30
This commit is contained in:
commit
609dde4139
9 changed files with 698 additions and 348 deletions
5
Cargo.lock
generated
5
Cargo.lock
generated
|
@ -843,9 +843,8 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "eml-codec"
|
name = "eml-codec"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://git.deuxfleurs.fr/Deuxfleurs/eml-codec.git?branch=main#a7bd3c475a58e42b86c163ec075ce01ddae7e60a"
|
||||||
checksum = "ac20cff537caf72385ffa5d9353ae63cb6c283a53665569408f040b8db36c90d"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.21.2",
|
"base64 0.21.2",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
|
|
@ -14,7 +14,7 @@ backtrace = "0.3"
|
||||||
base64 = "0.13"
|
base64 = "0.13"
|
||||||
clap = { version = "3.1.18", features = ["derive", "env"] }
|
clap = { version = "3.1.18", features = ["derive", "env"] }
|
||||||
duplexify = "1.1.0"
|
duplexify = "1.1.0"
|
||||||
eml-codec = "0.1.1"
|
eml-codec = { git = "https://git.deuxfleurs.fr/Deuxfleurs/eml-codec.git", branch = "main" }
|
||||||
hex = "0.4"
|
hex = "0.4"
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
im = "15"
|
im = "15"
|
||||||
|
|
|
@ -61,6 +61,7 @@
|
||||||
];
|
];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
echo "AEROGRAME DEVELOPMENT SHELL ${fenix.packages.x86_64-linux.minimal.rustc}"
|
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"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -384,7 +384,7 @@ impl<S: BayouState> Bayou<S> {
|
||||||
let cryptoblob = seal_serialize(&state_cp, &self.key)?;
|
let cryptoblob = seal_serialize(&state_cp, &self.key)?;
|
||||||
debug!("(cp) checkpoint body length: {}", cryptoblob.len());
|
debug!("(cp) checkpoint body length: {}", cryptoblob.len());
|
||||||
|
|
||||||
let por = PutObjectRequest{
|
let por = PutObjectRequest {
|
||||||
bucket: self.bucket.clone(),
|
bucket: self.bucket.clone(),
|
||||||
key: format!("{}/checkpoint/{}", self.path, ts_cp.to_string()),
|
key: format!("{}/checkpoint/{}", self.path, ts_cp.to_string()),
|
||||||
body: Some(cryptoblob.into()),
|
body: Some(cryptoblob.into()),
|
||||||
|
@ -437,7 +437,7 @@ impl<S: BayouState> Bayou<S> {
|
||||||
async fn list_checkpoints(&self) -> Result<Vec<(Timestamp, String)>> {
|
async fn list_checkpoints(&self) -> Result<Vec<(Timestamp, String)>> {
|
||||||
let prefix = format!("{}/checkpoint/", self.path);
|
let prefix = format!("{}/checkpoint/", self.path);
|
||||||
|
|
||||||
let lor = ListObjectsV2Request{
|
let lor = ListObjectsV2Request {
|
||||||
bucket: self.bucket.clone(),
|
bucket: self.bucket.clone(),
|
||||||
max_keys: Some(1000),
|
max_keys: Some(1000),
|
||||||
prefix: Some(prefix.clone()),
|
prefix: Some(prefix.clone()),
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -7,7 +7,7 @@ use std::sync::Arc;
|
||||||
use anyhow::{anyhow, bail, Context, Result};
|
use anyhow::{anyhow, bail, Context, Result};
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use k2v_client::{
|
use k2v_client::{
|
||||||
BatchInsertOp, BatchReadOp, CausalValue, CausalityToken, Filter, K2vClient, K2vValue
|
BatchInsertOp, BatchReadOp, CausalValue, CausalityToken, Filter, K2vClient, K2vValue,
|
||||||
};
|
};
|
||||||
use rand::prelude::*;
|
use rand::prelude::*;
|
||||||
use rusoto_core::HttpClient;
|
use rusoto_core::HttpClient;
|
||||||
|
@ -141,13 +141,13 @@ impl StorageCredentials {
|
||||||
self.aws_secret_access_key.clone(),
|
self.aws_secret_access_key.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let connector = hyper_rustls::HttpsConnectorBuilder::new()
|
let connector = hyper_rustls::HttpsConnectorBuilder::new()
|
||||||
.with_native_roots()
|
.with_native_roots()
|
||||||
.https_or_http()
|
.https_or_http()
|
||||||
.enable_http1()
|
.enable_http1()
|
||||||
.enable_http2()
|
.enable_http2()
|
||||||
.build();
|
.build();
|
||||||
let client = HttpClient::from_connector(connector);
|
let client = HttpClient::from_connector(connector);
|
||||||
|
|
||||||
Ok(S3Client::new_with(
|
Ok(S3Client::new_with(
|
||||||
client,
|
client,
|
||||||
|
|
|
@ -450,10 +450,10 @@ impl EncryptedMessage {
|
||||||
let por = PutObjectRequest {
|
let por = PutObjectRequest {
|
||||||
bucket: creds.storage.bucket.clone(),
|
bucket: creds.storage.bucket.clone(),
|
||||||
key: format!("incoming/{}", gen_ident()),
|
key: format!("incoming/{}", gen_ident()),
|
||||||
metadata: Some(
|
metadata: Some(
|
||||||
[(MESSAGE_KEY.to_string(), key_header)]
|
[(MESSAGE_KEY.to_string(), key_header)]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.collect::<HashMap<_, _>>(),
|
.collect::<HashMap<_, _>>(),
|
||||||
),
|
),
|
||||||
body: Some(self.encrypted_body.clone().into()),
|
body: Some(self.encrypted_body.clone().into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
@ -369,7 +369,7 @@ impl MailboxInternal {
|
||||||
// Save mail meta
|
// Save mail meta
|
||||||
let meta = MailMeta {
|
let meta = MailMeta {
|
||||||
internaldate: now_msec(),
|
internaldate: now_msec(),
|
||||||
headers: mail.parsed.raw_headers.to_vec(),
|
headers: mail.parsed.raw_headers.to_vec(),
|
||||||
message_key: message_key.clone(),
|
message_key: message_key.clone(),
|
||||||
rfc822_size: mail.raw.len(),
|
rfc822_size: mail.raw.len(),
|
||||||
};
|
};
|
||||||
|
@ -400,7 +400,7 @@ impl MailboxInternal {
|
||||||
futures::try_join!(
|
futures::try_join!(
|
||||||
async {
|
async {
|
||||||
// Delete mail body from S3
|
// Delete mail body from S3
|
||||||
let dor = DeleteObjectRequest{
|
let dor = DeleteObjectRequest {
|
||||||
bucket: self.bucket.clone(),
|
bucket: self.bucket.clone(),
|
||||||
key: format!("{}/{}", self.mail_path, ident),
|
key: format!("{}/{}", self.mail_path, ident),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -461,7 +461,7 @@ impl MailboxInternal {
|
||||||
futures::try_join!(
|
futures::try_join!(
|
||||||
async {
|
async {
|
||||||
// Copy mail body from S3
|
// Copy mail body from S3
|
||||||
let cor = CopyObjectRequest{
|
let cor = CopyObjectRequest {
|
||||||
bucket: self.bucket.clone(),
|
bucket: self.bucket.clone(),
|
||||||
key: format!("{}/{}", self.mail_path, new_id),
|
key: format!("{}/{}", self.mail_path, new_id),
|
||||||
copy_source: format!("{}/{}/{}", from.bucket, from.mail_path, source_id),
|
copy_source: format!("{}/{}/{}", from.bucket, from.mail_path, source_id),
|
||||||
|
|
|
@ -334,17 +334,22 @@ impl MailboxList {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_mailbox(&self, name: &str) -> bool {
|
fn has_mailbox(&self, name: &str) -> bool {
|
||||||
matches!(self.0.get(name), Some(MailboxListEntry {
|
matches!(
|
||||||
id_lww: (_, Some(_)),
|
self.0.get(name),
|
||||||
..
|
Some(MailboxListEntry {
|
||||||
}))
|
id_lww: (_, Some(_)),
|
||||||
|
..
|
||||||
|
})
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_mailbox(&self, name: &str) -> Option<(ImapUidvalidity, Option<UniqueIdent>)> {
|
fn get_mailbox(&self, name: &str) -> Option<(ImapUidvalidity, Option<UniqueIdent>)> {
|
||||||
self.0.get(name).map(|MailboxListEntry {
|
self.0.get(name).map(
|
||||||
id_lww: (_, mailbox_id),
|
|MailboxListEntry {
|
||||||
uidvalidity,
|
id_lww: (_, mailbox_id),
|
||||||
}| (*uidvalidity, *mailbox_id))
|
uidvalidity,
|
||||||
|
}| (*uidvalidity, *mailbox_id),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Ensures mailbox `name` maps to id `id`.
|
/// Ensures mailbox `name` maps to id `id`.
|
||||||
|
|
Loading…
Reference in a new issue