Spam filter performance and accuracy improvements (part 4)

This commit is contained in:
mdecimus
2025-12-03 19:26:28 +01:00
parent e127ac0067
commit 50dce48a85
111 changed files with 1714 additions and 635 deletions

View File

@@ -450,7 +450,12 @@ async fn process_changes(
Change::InsertItem(id) | Change::UpdateItem(id) => {
let document_id = id as u32;
if let Some(archive) = server
.archive(account_id, collection.collection(false), document_id)
.store()
.get_value::<Archive<AlignedBytes>>(ValueKey::archive(
account_id,
collection.collection(false),
document_id,
))
.await
.caused_by(trc::location!())?
{
@@ -473,7 +478,12 @@ async fn process_changes(
Change::InsertContainer(id) | Change::UpdateContainer(id) => {
let document_id = id as u32;
if let Some(archive) = server
.archive(account_id, collection.collection(true), document_id)
.store()
.get_value::<Archive<AlignedBytes>>(ValueKey::archive(
account_id,
collection.collection(true),
document_id,
))
.await
.caused_by(trc::location!())?
{

View File

@@ -34,8 +34,8 @@ use common::{
i18n,
};
use store::{
rand,
write::{BatchBuilder, now},
ValueKey, rand,
write::{AlignedBytes, Archive, BatchBuilder, now},
};
use trc::AddContext;
use types::{
@@ -164,7 +164,12 @@ impl ItipIngest for Server {
if let Some(document_id) = document_id {
if let Some(archive) = self
.archive(account_id, Collection::CalendarEvent, document_id)
.store()
.get_value::<Archive<AlignedBytes>>(ValueKey::archive(
account_id,
Collection::CalendarEvent,
document_id,
))
.await
.caused_by(trc::location!())?
{
@@ -403,7 +408,12 @@ impl ItipIngest for Server {
async fn http_rsvp_handle(&self, query: &str, language: &str) -> trc::Result<String> {
let response = if let Some(rsvp) = decode_rsvp_response(self, query).await {
if let Some(archive) = self
.archive(rsvp.account_id, Collection::CalendarEvent, rsvp.document_id)
.store()
.get_value::<Archive<AlignedBytes>>(ValueKey::archive(
rsvp.account_id,
Collection::CalendarEvent,
rsvp.document_id,
))
.await
.caused_by(trc::location!())?
{

View File

@@ -21,7 +21,8 @@ use store::{
IterateParams, U16_LEN, U32_LEN, U64_LEN, ValueKey,
roaring::RoaringBitmap,
write::{
Archive, BatchBuilder, IndexPropertyClass, TaskEpoch, TaskQueueClass, ValueClass,
AlignedBytes, Archive, BatchBuilder, IndexPropertyClass, TaskEpoch, TaskQueueClass,
ValueClass,
key::{DeserializeBigEndian, KeySerializer},
now,
},
@@ -136,11 +137,12 @@ impl ItipAutoExpunge for Server {
for document_id in destroy_ids {
// Fetch event
if let Some(event_) = self
.archive(
.store()
.get_value::<Archive<AlignedBytes>>(ValueKey::archive(
account_id,
Collection::CalendarEventNotification,
document_id,
)
))
.await
.caused_by(trc::location!())?
{
@@ -328,7 +330,12 @@ impl DestroyArchive<Archive<&ArchivedCalendar>> {
let calendar_id = document_id;
for document_id in children_ids {
if let Some(event_) = server
.archive(account_id, Collection::CalendarEvent, document_id)
.store()
.get_value::<Archive<AlignedBytes>>(ValueKey::archive(
account_id,
Collection::CalendarEvent,
document_id,
))
.await?
{
DestroyArchive(
@@ -567,11 +574,12 @@ impl ArchivedCalendarEvent {
) -> trc::Result<String> {
for event_name in self.names.iter() {
if let Some(calendar_) = server
.archive(
.store()
.get_value::<Archive<AlignedBytes>>(ValueKey::archive(
access_token.primary_id,
Collection::Calendar,
event_name.parent_id.to_native(),
)
))
.await
.caused_by(trc::location!())?
{

View File

@@ -7,7 +7,10 @@
use super::{AddressBook, ArchivedAddressBook, ArchivedContactCard, ContactCard};
use crate::DestroyArchive;
use common::{Server, auth::AccessToken, storage::index::ObjectIndexBuilder};
use store::write::{Archive, BatchBuilder, now};
use store::{
ValueKey,
write::{AlignedBytes, Archive, BatchBuilder, now},
};
use trc::AddContext;
use types::collection::{Collection, VanishedCollection};
@@ -136,7 +139,12 @@ impl DestroyArchive<Archive<&ArchivedAddressBook>> {
let addressbook_id = document_id;
for document_id in children_ids {
if let Some(card_) = server
.archive(account_id, Collection::ContactCard, document_id)
.store()
.get_value::<Archive<AlignedBytes>>(ValueKey::archive(
account_id,
Collection::ContactCard,
document_id,
))
.await?
{
DestroyArchive(

View File

@@ -7,7 +7,10 @@
use super::{ArchivedFileNode, FileNode};
use crate::DestroyArchive;
use common::{Server, auth::AccessToken, storage::index::ObjectIndexBuilder};
use store::write::{Archive, BatchBuilder, now};
use store::{
ValueKey,
write::{AlignedBytes, Archive, BatchBuilder, now},
};
use trc::AddContext;
use types::collection::{Collection, VanishedCollection};
@@ -124,7 +127,12 @@ impl DestroyArchive<Vec<u32>> {
.with_collection(Collection::FileNode);
for document_id in self.0 {
if let Some(node) = server
.archive(account_id, Collection::FileNode, document_id)
.store()
.get_value::<Archive<AlignedBytes>>(ValueKey::archive(
account_id,
Collection::FileNode,
document_id,
))
.await?
{
// Delete record