CONDSTORE #71

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

4
Cargo.lock generated
View file

@ -1807,7 +1807,7 @@ dependencies = [
[[package]] [[package]]
name = "imap-codec" name = "imap-codec"
version = "2.0.0" version = "2.0.0"
source = "git+https://github.com/superboum/imap-codec?branch=custom/aerogramme#088fa93bfb4040fc4364aa6e9487fff4375429c3" source = "git+https://github.com/superboum/imap-codec?branch=custom/aerogramme#3fdc1f3184ec121823d44b3f39e56b448ac80751"
dependencies = [ dependencies = [
"abnf-core", "abnf-core",
"base64 0.21.5", "base64 0.21.5",
@ -1834,7 +1834,7 @@ dependencies = [
[[package]] [[package]]
name = "imap-types" name = "imap-types"
version = "2.0.0" version = "2.0.0"
source = "git+https://github.com/superboum/imap-codec?branch=custom/aerogramme#088fa93bfb4040fc4364aa6e9487fff4375429c3" source = "git+https://github.com/superboum/imap-codec?branch=custom/aerogramme#3fdc1f3184ec121823d44b3f39e56b448ac80751"
dependencies = [ dependencies = [
"base64 0.21.5", "base64 0.21.5",
"bounded-static", "bounded-static",

View file

@ -1,4 +1,4 @@
use std::num::NonZeroU32; use std::num::{NonZeroU32, NonZeroU64};
use std::sync::Arc; use std::sync::Arc;
use anyhow::{anyhow, Error, Result}; use anyhow::{anyhow, Error, Result};
@ -348,7 +348,7 @@ impl MailboxView {
// 6. Format the result according to the client's taste: // 6. Format the result according to the client's taste:
// either return UID or ID. // either return UID or ID.
let final_selection = kept_idx.into_iter().chain(kept_query.into_iter()); let final_selection = kept_idx.iter().chain(kept_query.iter());
let selection_fmt = match uid { let selection_fmt = match uid {
true => final_selection.map(|in_idx| in_idx.uid).collect(), true => final_selection.map(|in_idx| in_idx.uid).collect(),
_ => final_selection.map(|in_idx| in_idx.i).collect(), _ => final_selection.map(|in_idx| in_idx.i).collect(),
@ -356,8 +356,15 @@ impl MailboxView {
// 7. Add the modseq entry if needed // 7. Add the modseq entry if needed
let is_modseq = crit.is_modseq(); let is_modseq = crit.is_modseq();
let maybe_modseq = match is_modseq {
true => {
let final_selection = kept_idx.iter().chain(kept_query.iter());
final_selection.map(|in_idx| in_idx.modseq).max().map(|r| NonZeroU64::try_from(r)).transpose()?
},
_ => None,
};
Ok((vec![Body::Data(Data::Search(selection_fmt))], is_modseq)) Ok((vec![Body::Data(Data::Search(selection_fmt, maybe_modseq))], is_modseq))
} }
// ---- // ----