Database schema optimization - part 2
This commit is contained in:
@@ -44,6 +44,7 @@ pub struct JmapConfig {
|
||||
pub mail_parse_max_items: usize,
|
||||
pub mail_max_size: usize,
|
||||
pub mail_autoexpunge_after: Option<u64>,
|
||||
pub email_submission_autoexpunge_after: Option<u64>,
|
||||
|
||||
pub contact_parse_max_items: usize,
|
||||
pub calendar_parse_max_items: usize,
|
||||
@@ -276,6 +277,10 @@ impl JmapConfig {
|
||||
.property_or_default::<Option<Duration>>("email.auto-expunge", "30d")
|
||||
.map(|d| d.map(|d| d.as_secs()))
|
||||
.unwrap_or_default(),
|
||||
email_submission_autoexpunge_after: config
|
||||
.property_or_default::<Option<Duration>>("email-submission.auto-expunge", "3d")
|
||||
.map(|d| d.map(|d| d.as_secs()))
|
||||
.unwrap_or_default(),
|
||||
sieve_max_script_name: config
|
||||
.property("sieve.untrusted.limits.name-length")
|
||||
.unwrap_or(512),
|
||||
|
||||
@@ -354,7 +354,7 @@ impl Server {
|
||||
collection: Collection::Email.into(),
|
||||
document_id: 0,
|
||||
class: ValueClass::IndexProperty(IndexPropertyClass::Integer {
|
||||
property: EmailField::Stats.into(),
|
||||
property: EmailField::ReceivedToSize.into(),
|
||||
value: 0,
|
||||
}),
|
||||
},
|
||||
@@ -363,7 +363,7 @@ impl Server {
|
||||
collection: Collection::Email.into(),
|
||||
document_id: u32::MAX,
|
||||
class: ValueClass::IndexProperty(IndexPropertyClass::Integer {
|
||||
property: EmailField::Stats.into(),
|
||||
property: EmailField::ReceivedToSize.into(),
|
||||
value: u64::MAX,
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -13,8 +13,8 @@ use std::{
|
||||
use store::{
|
||||
BlobStore, Key, LogKey, SUBSPACE_LOGS, SerializeInfallible, Store, U32_LEN,
|
||||
write::{
|
||||
AnyClass, BatchBuilder, BlobOp, DirectoryClass, InMemoryClass, Operation, TaskQueueClass,
|
||||
ValueClass, ValueOp, key::DeserializeBigEndian, now,
|
||||
AnyClass, BatchBuilder, BlobOp, DirectoryClass, InMemoryClass, Operation, SearchIndex,
|
||||
TaskQueueClass, ValueClass, ValueOp, key::DeserializeBigEndian, now,
|
||||
},
|
||||
};
|
||||
use store::{
|
||||
@@ -148,7 +148,7 @@ async fn restore_file(store: Store, blob_store: BlobStore, path: &Path) {
|
||||
batch.set(
|
||||
ValueClass::TaskQueue(TaskQueueClass::UpdateIndex {
|
||||
due,
|
||||
collection: Collection::Email,
|
||||
index: SearchIndex::Email,
|
||||
is_insert: true,
|
||||
}),
|
||||
0u64.serialize(),
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
use crate::{auth::AccessToken, sharing::notification::ShareNotification};
|
||||
use ahash::AHashSet;
|
||||
use rkyv::{
|
||||
option::ArchivedOption,
|
||||
primitive::{ArchivedU32, ArchivedU64},
|
||||
@@ -15,8 +14,8 @@ use std::{borrow::Cow, fmt::Debug};
|
||||
use store::{
|
||||
Serialize, SerializeInfallible,
|
||||
write::{
|
||||
Archive, Archiver, BatchBuilder, BlobOp, DirectoryClass, IntoOperations, TaskQueueClass,
|
||||
ValueClass, now,
|
||||
Archive, Archiver, BatchBuilder, BlobOp, DirectoryClass, IntoOperations, SearchIndex,
|
||||
TaskQueueClass, ValueClass, now,
|
||||
},
|
||||
};
|
||||
use types::{
|
||||
@@ -38,7 +37,8 @@ pub enum IndexValue<'x> {
|
||||
value: IndexItem<'x>,
|
||||
},
|
||||
SearchIndex {
|
||||
hashes: AHashSet<u64>,
|
||||
index: SearchIndex,
|
||||
hash: u64,
|
||||
},
|
||||
Blob {
|
||||
value: BlobHash,
|
||||
@@ -376,11 +376,11 @@ fn build_index(
|
||||
}
|
||||
}
|
||||
}
|
||||
IndexValue::SearchIndex { .. } => {
|
||||
IndexValue::SearchIndex { index, .. } => {
|
||||
batch.set(
|
||||
ValueClass::TaskQueue(TaskQueueClass::UpdateIndex {
|
||||
due: now(),
|
||||
collection: batch.last_collection().unwrap_or(Collection::None),
|
||||
index,
|
||||
is_insert: set,
|
||||
}),
|
||||
vec![],
|
||||
@@ -508,20 +508,15 @@ fn merge_index(
|
||||
batch.index(field, new_value.into_owned());
|
||||
}
|
||||
}
|
||||
(
|
||||
IndexValue::SearchIndex { hashes: old_hashes },
|
||||
IndexValue::SearchIndex { hashes: new_hashes },
|
||||
) => {
|
||||
if old_hashes != new_hashes {
|
||||
batch.set(
|
||||
ValueClass::TaskQueue(TaskQueueClass::UpdateIndex {
|
||||
due: now(),
|
||||
collection: batch.last_collection().unwrap_or(Collection::None),
|
||||
is_insert: true,
|
||||
}),
|
||||
vec![],
|
||||
);
|
||||
}
|
||||
(IndexValue::SearchIndex { index, .. }, IndexValue::SearchIndex { .. }) => {
|
||||
batch.set(
|
||||
ValueClass::TaskQueue(TaskQueueClass::UpdateIndex {
|
||||
due: now(),
|
||||
index,
|
||||
is_insert: true,
|
||||
}),
|
||||
vec![],
|
||||
);
|
||||
}
|
||||
(
|
||||
IndexValue::Property {
|
||||
|
||||
Reference in New Issue
Block a user