This commit is contained in:
rustmailer
2026-05-22 22:21:46 +08:00
parent 6eca351994
commit 0dd81f599d
3 changed files with 16 additions and 16 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ async fn run_interactive() {
let main_options = vec![ let main_options = vec![
"Reset Admin Password", "Reset Admin Password",
"Migrate Legacy v0.3.7 Storage to v1.0.x", "Migrate Legacy v0.3.7 Storage to v1.x",
"Exit", "Exit",
]; ];
+6 -12
View File
@@ -11,7 +11,7 @@ use indicatif::{ProgressBar, ProgressStyle};
pub fn handle_migration(theme: &ColorfulTheme) { pub fn handle_migration(theme: &ColorfulTheme) {
println!( println!(
"\n{}", "\n{}",
style("MIGRATION: Bichon v0.3.7 Storage Architecture → v1.0.x") style("MIGRATION: Bichon v0.3.7 Storage Architecture → v1.x")
.bold() .bold()
.yellow() .yellow()
); );
@@ -20,7 +20,7 @@ pub fn handle_migration(theme: &ColorfulTheme) {
"{}", "{}",
style( style(
"This tool migrates data from the legacy v0.3.7 Tantivy-based storage \ "This tool migrates data from the legacy v0.3.7 Tantivy-based storage \
architecture to the new v1.0.x \ architecture to the new v1.x \
separated index and Fjall-backed storage format." separated index and Fjall-backed storage format."
) )
.dim() .dim()
@@ -32,7 +32,7 @@ pub fn handle_migration(theme: &ColorfulTheme) {
"Legacy v0.3.7 architecture:\n\ "Legacy v0.3.7 architecture:\n\
envelope metadata stored in Tantivy\n\ envelope metadata stored in Tantivy\n\
message data stored in Tantivy\n\n\ message data stored in Tantivy\n\n\
New v1.0.x architecture:\n\ New v1.x architecture:\n\
mail indexes stored in Tantivy\n\ mail indexes stored in Tantivy\n\
attachment indexes stored in Tantivy\n\ attachment indexes stored in Tantivy\n\
raw message data stored in Fjall\n\ raw message data stored in Fjall\n\
@@ -163,7 +163,7 @@ pub fn handle_migration(theme: &ColorfulTheme) {
println!("----------------------------------------"); println!("----------------------------------------");
println!( println!(
"\n{} Checking legacy v0.x storage layout...", "\n{} Checking legacy v0.3.7 storage layout...",
style("").yellow() style("").yellow()
); );
@@ -172,7 +172,7 @@ pub fn handle_migration(theme: &ColorfulTheme) {
println!( println!(
"{} {}", "{} {}",
style("").green(), style("").green(),
style("Legacy v0.3.7 Tantivy-based storage detected. Migration to v1.0 is required.") style("Legacy v0.3.7 Tantivy-based storage detected. Migration to v1.x is required.")
.yellow() .yellow()
); );
} }
@@ -186,7 +186,7 @@ pub fn handle_migration(theme: &ColorfulTheme) {
println!( println!(
"{}", "{}",
style( style(
"The selected directories may already be using the v1.0 storage architecture." "The selected directories may already be using the v1.x storage architecture."
) )
.dim() .dim()
); );
@@ -288,12 +288,6 @@ pub fn handle_migration(theme: &ColorfulTheme) {
style(batch_size).cyan().bold() style(batch_size).cyan().bold()
); );
println!(
"{} Using batch size: {}\n",
style("").green(),
style(batch_size).cyan().bold()
);
let legacy = LegacyDirs::new(index_path.clone(), data_path.clone()); let legacy = LegacyDirs::new(index_path.clone(), data_path.clone());
let total_segments = match count_eml_segments(&legacy) { let total_segments = match count_eml_segments(&legacy) {
Ok(n) => n, Ok(n) => n,
+9 -3
View File
@@ -68,7 +68,9 @@ impl BlobManager {
} }
} }
Err(e) => tracing::error!("Fjall email_ks error: {:?}", e), Err(e) => tracing::error!("Fjall email_ks error: {:?}", e),
_ => {} Ok(true) => {
tracing::debug!("Email blob already exists (dedup): {}", &email_hash);
}
} }
if let Some(attachments) = eml.attachments { if let Some(attachments) = eml.attachments {
@@ -80,7 +82,9 @@ impl BlobManager {
} }
} }
Err(e) => tracing::error!("Fjall attach_ks error: {:?}", e), Err(e) => tracing::error!("Fjall attach_ks error: {:?}", e),
_ => {} Ok(true) => {
tracing::debug!("Attachment blob already exists (dedup): {}", &a_hash);
}
} }
} }
} }
@@ -185,7 +189,9 @@ impl BlobManager {
} }
pub async fn queue(&self, email: DetachedEmail) { pub async fn queue(&self, email: DetachedEmail) {
let _ = self.sender.send(email).await; if let Err(e) = self.sender.send(email).await {
tracing::error!("BlobManager channel closed, email lost: {:#?}", e);
}
} }
pub fn get_email(&self, content_hash: &str) -> BichonResult<Option<Bytes>> { pub fn get_email(&self, content_hash: &str) -> BichonResult<Option<Bytes>> {