Refactor: decouple email body and attachment storage

This commit is contained in:
rustmailer
2026-03-24 21:48:04 +08:00
parent c19f3977ba
commit a41b5417e3
31 changed files with 1630 additions and 1152 deletions
+7 -6
View File
@@ -35,7 +35,10 @@ use crate::{
cache::imap::mailbox::MailBox,
database::{list_all_impl, secondary_find_impl, with_transaction},
error::BichonResult,
indexer::manager::{EML_INDEX_MANAGER, ENVELOPE_INDEX_MANAGER},
indexer::{
attachment::ATTACHMENT_INDEX_MANAGER, eml::EML_INDEX_MANAGER,
manager::ENVELOPE_INDEX_MANAGER,
},
users::{role::DEFAULT_ACCOUNT_MANAGER_ROLE_ID, UserModel, DEFAULT_ADMIN_USER_ID},
},
utc_now,
@@ -355,17 +358,15 @@ impl AccountV4 {
if matches!(account.account_type, AccountType::IMAP) {
SYNC_TASKS.stop(account.id).await?;
AccountRunningState::delete(account.id).await?;
//BICHON_CONTEXT.clean_account(account.id).await?;
}
OAuth2AccessToken::try_delete(account.id).await?;
UserModel::cleanup_account(account.id).await?;
MailBox::clean(account.id).await?;
ENVELOPE_INDEX_MANAGER
.delete_account_envelopes(account.id)
.await?;
EML_INDEX_MANAGER
let content_hashes = ENVELOPE_INDEX_MANAGER
.delete_account_envelopes(account.id)
.await?;
EML_INDEX_MANAGER.delete(&content_hashes).await?;
ATTACHMENT_INDEX_MANAGER.delete(&content_hashes).await?;
Self::delete_account(account.id).await?;
info!("Sequential cleanup completed for account: {}", account.id);
Ok(())