CONDSTORE #71

Merged
quentin merged 21 commits from feat/condstore-try-2 into main 2024-01-15 07:07:07 +00:00
3 changed files with 12 additions and 7 deletions
Showing only changes of commit f5b73182f2 - 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#eb37f06a0e8d2543f60063ec80cde9e9dcb150f1" source = "git+https://github.com/superboum/imap-codec?branch=custom/aerogramme#990e709450ff4f8986b08d2b84e28f651b74f181"
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#eb37f06a0e8d2543f60063ec80cde9e9dcb150f1" source = "git+https://github.com/superboum/imap-codec?branch=custom/aerogramme#990e709450ff4f8986b08d2b84e28f651b74f181"
dependencies = [ dependencies = [
"base64 0.21.5", "base64 0.21.5",
"bounded-static", "bounded-static",

View file

@ -3,7 +3,7 @@ use std::num::NonZeroU32;
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use imap_codec::imap_types::sequence::{SeqOrUid, Sequence, SequenceSet}; use imap_codec::imap_types::sequence::{SeqOrUid, Sequence, SequenceSet};
use crate::mail::uidindex::{ImapUid, UidIndex}; use crate::mail::uidindex::{ImapUid, ModSeq, UidIndex};
use crate::mail::unique_ident::UniqueIdent; use crate::mail::unique_ident::UniqueIdent;
pub struct Index<'a> { pub struct Index<'a> {
@ -17,12 +17,10 @@ impl<'a> Index<'a> {
.iter() .iter()
.enumerate() .enumerate()
.map(|(i_enum, (&uid, &uuid))| { .map(|(i_enum, (&uid, &uuid))| {
let flags = internal let (_, modseq, flags) = internal
.table .table
.get(&uuid) .get(&uuid)
.ok_or(anyhow!("mail is missing from index"))? .ok_or(anyhow!("mail is missing from index"))?;
.2
.as_ref();
let i_int: u32 = (i_enum + 1).try_into()?; let i_int: u32 = (i_enum + 1).try_into()?;
let i: NonZeroU32 = i_int.try_into()?; let i: NonZeroU32 = i_int.try_into()?;
@ -30,6 +28,7 @@ impl<'a> Index<'a> {
i, i,
uid, uid,
uuid, uuid,
modseq: *modseq,
flags, flags,
}) })
}) })
@ -134,6 +133,7 @@ pub struct MailIndex<'a> {
pub i: NonZeroU32, pub i: NonZeroU32,
pub uid: ImapUid, pub uid: ImapUid,
pub uuid: UniqueIdent, pub uuid: UniqueIdent,
pub modseq: ModSeq,
pub flags: &'a Vec<String>, pub flags: &'a Vec<String>,
} }

View file

@ -90,6 +90,7 @@ impl<'a> MailView<'a> {
Ok(body) Ok(body)
} }
MessageDataItemName::InternalDate => self.internal_date(), MessageDataItemName::InternalDate => self.internal_date(),
MessageDataItemName::ModSeq => Ok(self.modseq()),
}) })
.collect::<Result<Vec<_>, _>>()?; .collect::<Result<Vec<_>, _>>()?;
@ -252,6 +253,10 @@ impl<'a> MailView<'a> {
.ok_or(anyhow!("Unable to parse internal date"))?; .ok_or(anyhow!("Unable to parse internal date"))?;
Ok(MessageDataItem::InternalDate(DateTime::unvalidated(dt))) Ok(MessageDataItem::InternalDate(DateTime::unvalidated(dt)))
} }
fn modseq(&self) -> MessageDataItem<'static> {
MessageDataItem::ModSeq(self.in_idx.modseq)
}
} }
pub enum SeenFlag { pub enum SeenFlag {