Message caching improvements

This commit is contained in:
mdecimus
2025-05-06 16:00:16 +02:00
parent b8329afeba
commit e69b5ec2b7
87 changed files with 2835 additions and 2536 deletions

View File

@@ -7,7 +7,7 @@
use common::storage::index::{
IndexItem, IndexValue, IndexableAndSerializableObject, IndexableObject,
};
use jmap_proto::types::value::AclGrant;
use jmap_proto::types::{collection::SyncCollection, value::AclGrant};
use store::{SerializeInfallible, write::key::KeySerializer};
use crate::{IDX_NAME, IDX_TIME, IDX_UID};
@@ -44,7 +44,9 @@ impl IndexableObject for Calendar {
+ self.default_alerts.iter().map(|a| a.size()).sum::<usize>() as u32
+ self.name.len() as u32,
},
IndexValue::LogChild { prefix: None },
IndexValue::LogContainer {
sync_collection: SyncCollection::Calendar.into(),
},
]
.into_iter()
}
@@ -80,7 +82,9 @@ impl IndexableObject for &ArchivedCalendar {
+ self.default_alerts.iter().map(|a| a.size()).sum::<usize>() as u32
+ self.name.len() as u32,
},
IndexValue::LogChild { prefix: None },
IndexValue::LogContainer {
sync_collection: SyncCollection::Calendar.into(),
},
]
.into_iter()
}
@@ -122,7 +126,10 @@ impl IndexableObject for CalendarEvent {
+ self.names.iter().map(|n| n.name.len() as u32).sum::<u32>()
+ self.size,
},
IndexValue::LogChild { prefix: None },
IndexValue::LogItem {
sync_collection: SyncCollection::Calendar.into(),
prefix: None,
},
]
.into_iter()
}
@@ -162,7 +169,10 @@ impl IndexableObject for &ArchivedCalendarEvent {
+ self.names.iter().map(|n| n.name.len() as u32).sum::<u32>()
+ self.size,
},
IndexValue::LogChild { prefix: None },
IndexValue::LogItem {
sync_collection: SyncCollection::Calendar.into(),
prefix: None,
},
]
.into_iter()
}

View File

@@ -7,7 +7,7 @@
use common::storage::index::{
IndexItem, IndexValue, IndexableAndSerializableObject, IndexableObject,
};
use jmap_proto::types::value::AclGrant;
use jmap_proto::types::{collection::SyncCollection, value::AclGrant};
use store::SerializeInfallible;
use crate::{IDX_NAME, IDX_UID};
@@ -32,7 +32,9 @@ impl IndexableObject for AddressBook {
+ self.description.as_ref().map_or(0, |n| n.len() as u32)
+ self.name.len() as u32,
},
IndexValue::LogChild { prefix: None },
IndexValue::LogContainer {
sync_collection: SyncCollection::AddressBook.into(),
},
]
.into_iter()
}
@@ -59,7 +61,9 @@ impl IndexableObject for &ArchivedAddressBook {
+ self.description.as_ref().map_or(0, |n| n.len() as u32)
+ self.name.len() as u32,
},
IndexValue::LogChild { prefix: None },
IndexValue::LogContainer {
sync_collection: SyncCollection::AddressBook.into(),
},
]
.into_iter()
}
@@ -88,7 +92,10 @@ impl IndexableObject for ContactCard {
+ self.names.iter().map(|n| n.name.len() as u32).sum::<u32>()
+ self.size,
},
IndexValue::LogChild { prefix: None },
IndexValue::LogItem {
sync_collection: SyncCollection::AddressBook.into(),
prefix: None,
},
]
.into_iter()
}
@@ -115,7 +122,10 @@ impl IndexableObject for &ArchivedContactCard {
+ self.names.iter().map(|n| n.name.len() as u32).sum::<u32>()
+ self.size,
},
IndexValue::LogChild { prefix: None },
IndexValue::LogItem {
sync_collection: SyncCollection::AddressBook.into(),
prefix: None,
},
]
.into_iter()
}

View File

@@ -8,7 +8,7 @@ use common::storage::{
folder::FolderHierarchy,
index::{IndexValue, IndexableAndSerializableObject, IndexableObject},
};
use jmap_proto::types::{property::Property, value::AclGrant};
use jmap_proto::types::{collection::SyncCollection, property::Property, value::AclGrant};
use super::{ArchivedFileNode, FileNode};
@@ -36,7 +36,9 @@ impl IndexableObject for FileNode {
IndexValue::Acl {
value: (&self.acls).into(),
},
IndexValue::LogChild { prefix: None },
IndexValue::LogContainer {
sync_collection: SyncCollection::FileNode.into(),
},
]);
if let Some(file) = &self.file {
@@ -80,7 +82,9 @@ impl IndexableObject for &ArchivedFileNode {
.collect::<Vec<_>>()
.into(),
},
IndexValue::LogChild { prefix: None },
IndexValue::LogContainer {
sync_collection: SyncCollection::FileNode.into(),
},
]);
let size = self.size();

View File

@@ -60,6 +60,8 @@ impl DavHierarchy for Server {
account_id: u32,
collection: Collection,
) -> trc::Result<Arc<DavResources>> {
let todo = "fix";
let is_files = collection == Collection::FileNode;
let mut change_id = self
.store()