CONDSTORE #71

Merged
quentin merged 21 commits from feat/condstore-try-2 into main 2024-01-15 07:07:07 +00:00
4 changed files with 19 additions and 18 deletions
Showing only changes of commit 0c6e745d11 - Show all commits

8
Cargo.lock generated
View file

@ -1806,7 +1806,8 @@ dependencies = [
[[package]] [[package]]
name = "imap-codec" name = "imap-codec"
version = "1.0.0" version = "2.0.0"
source = "git+https://github.com/superboum/imap-codec?branch=custom/aerogramme#4c7891d400e69c864fc079463bbd2c28e2d46cf3"
dependencies = [ dependencies = [
"abnf-core", "abnf-core",
"base64 0.21.5", "base64 0.21.5",
@ -1821,7 +1822,7 @@ dependencies = [
[[package]] [[package]]
name = "imap-flow" name = "imap-flow"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/duesee/imap-flow.git?rev=e45ce7bb6ab6bda3c71a0c7b05e9b558a5902e90#e45ce7bb6ab6bda3c71a0c7b05e9b558a5902e90" source = "git+https://github.com/superboum/imap-flow.git?branch=custom/aerogramme#525429781f375580cba824de584593b242245ff7"
dependencies = [ dependencies = [
"bounded-static", "bounded-static",
"bytes", "bytes",
@ -1832,7 +1833,8 @@ dependencies = [
[[package]] [[package]]
name = "imap-types" name = "imap-types"
version = "1.0.0" version = "2.0.0"
source = "git+https://github.com/superboum/imap-codec?branch=custom/aerogramme#4c7891d400e69c864fc079463bbd2c28e2d46cf3"
dependencies = [ dependencies = [
"base64 0.21.5", "base64 0.21.5",
"bounded-static", "bounded-static",

View file

@ -58,16 +58,14 @@ aws-sdk-s3 = "1.9.0"
eml-codec = { git = "https://git.deuxfleurs.fr/Deuxfleurs/eml-codec.git", branch = "main" } eml-codec = { git = "https://git.deuxfleurs.fr/Deuxfleurs/eml-codec.git", branch = "main" }
smtp-message = { git = "http://github.com/Alexis211/kannader", branch = "feature/lmtp" } smtp-message = { git = "http://github.com/Alexis211/kannader", branch = "feature/lmtp" }
smtp-server = { git = "http://github.com/Alexis211/kannader", branch = "feature/lmtp" } smtp-server = { git = "http://github.com/Alexis211/kannader", branch = "feature/lmtp" }
imap-codec = { version = "1.0.0", features = ["bounded-static", "ext_condstore_qresync"] } imap-codec = { version = "2.0.0", features = ["bounded-static", "ext_condstore_qresync"] }
imap-flow = { git = "https://github.com/duesee/imap-flow.git", rev = "e45ce7bb6ab6bda3c71a0c7b05e9b558a5902e90" } imap-flow = { git = "https://github.com/superboum/imap-flow.git", branch = "custom/aerogramme" }
[dev-dependencies] [dev-dependencies]
[patch.crates-io] [patch.crates-io]
#imap-types = { git = "https://github.com/duesee/imap-codec", branch = "v2" } imap-types = { git = "https://github.com/superboum/imap-codec", branch = "custom/aerogramme" }
#imap-codec = { git = "https://github.com/duesee/imap-codec", branch = "v2" } imap-codec = { git = "https://github.com/superboum/imap-codec", branch = "custom/aerogramme" }
imap-types = { path = "../../imap-codec/imap-types" }
imap-codec = { path = "../../imap-codec/imap-codec" }
[[test]] [[test]]
name = "behavior" name = "behavior"

View file

@ -1,7 +1,7 @@
use std::num::NonZeroU32; use std::num::NonZeroU32;
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use imap_codec::imap_types::sequence::{self, SeqOrUid, Sequence, SequenceSet}; use imap_codec::imap_types::sequence::{SeqOrUid, Sequence, SequenceSet};
use crate::mail::uidindex::{ImapUid, UidIndex}; use crate::mail::uidindex::{ImapUid, UidIndex};
use crate::mail::unique_ident::UniqueIdent; use crate::mail::unique_ident::UniqueIdent;
@ -61,10 +61,8 @@ impl<'a> Index<'a> {
if self.imap_index.is_empty() { if self.imap_index.is_empty() {
return vec![]; return vec![];
} }
let iter_strat = sequence::Strategy::Naive { let largest = self.last().expect("The mailbox is not empty").uid;
largest: self.last().expect("The mailbox is not empty").uid, let mut unroll_seq = sequence_set.iter(largest).collect::<Vec<_>>();
};
let mut unroll_seq = sequence_set.iter(iter_strat).collect::<Vec<_>>();
unroll_seq.sort(); unroll_seq.sort();
let start_seq = match unroll_seq.iter().next() { let start_seq = match unroll_seq.iter().next() {
@ -103,11 +101,9 @@ impl<'a> Index<'a> {
if self.imap_index.is_empty() { if self.imap_index.is_empty() {
return Ok(vec![]); return Ok(vec![]);
} }
let iter_strat = sequence::Strategy::Naive { let largest = NonZeroU32::try_from(self.imap_index.len() as u32)?;
largest: NonZeroU32::try_from(self.imap_index.len() as u32)?,
};
let mut acc = sequence_set let mut acc = sequence_set
.iter(iter_strat) .iter(largest)
.map(|wanted_id| { .map(|wanted_id| {
self.imap_index self.imap_index
.get((wanted_id.get() as usize) - 1) .get((wanted_id.get() as usize) - 1)

View file

@ -175,6 +175,11 @@ async fn client(mut ctx: ClientContext) -> Result<()> {
} }
} }
}, },
flow => {
server.enqueue_status(Status::bye(None, "Unsupported server flow event").unwrap());
tracing::error!("session task exited for {:?} due to unsupported flow {:?}", ctx.addr, flow);
}
}, },
// Managing response generated by Aerogramme // Managing response generated by Aerogramme