diff --git a/core/src/ops/indexing/change_detection/detector.rs b/core/src/ops/indexing/change_detection/detector.rs index aa7edb376..b5a5d8b10 100644 --- a/core/src/ops/indexing/change_detection/detector.rs +++ b/core/src/ops/indexing/change_detection/detector.rs @@ -76,7 +76,8 @@ impl ChangeDetector { .ok_or_else(|| JobError::execution("Location not found".to_string()))?; // Create a persistent writer adapter to leverage the unified query logic - let persistence = PersistentWriterAdapter::new(ctx, location_record.uuid, location_record.entry_id); + let persistence = + PersistentWriterAdapter::new(ctx, location_record.uuid, location_record.entry_id); // Use the scoped query method let existing_entries = persistence.get_existing_entries(indexing_path).await?; diff --git a/core/src/ops/indexing/change_detection/persistent.rs b/core/src/ops/indexing/change_detection/persistent.rs index ba17b5e3a..c381907f5 100644 --- a/core/src/ops/indexing/change_detection/persistent.rs +++ b/core/src/ops/indexing/change_detection/persistent.rs @@ -226,10 +226,16 @@ impl ChangeHandler for PersistentWriter { .insert(parent_path.to_path_buf(), parent_id); } - let entry_id = - DBWriter::create_entry(&mut state, &self.db, library.as_deref(), metadata, 0, parent_path) - .await - .map_err(|e| anyhow::anyhow!("Failed to create entry: {}", e))?; + let entry_id = DBWriter::create_entry( + &mut state, + &self.db, + library.as_deref(), + metadata, + 0, + parent_path, + ) + .await + .map_err(|e| anyhow::anyhow!("Failed to create entry: {}", e))?; self.entry_id_cache.insert(metadata.path.clone(), entry_id); diff --git a/core/src/ops/indexing/db_writer.rs b/core/src/ops/indexing/db_writer.rs index 2388a2425..12cb37809 100644 --- a/core/src/ops/indexing/db_writer.rs +++ b/core/src/ops/indexing/db_writer.rs @@ -762,12 +762,9 @@ impl DBWriter { existing_active.entry_count = Set(existing_active.entry_count.unwrap() + 1); existing_active.last_verified_at = Set(chrono::Utc::now()); - let updated = existing_active - .update(db) - .await - .map_err(|e| { - JobError::execution(format!("Failed to update content identity: {}", e)) - })?; + let updated = existing_active.update(db).await.map_err(|e| { + JobError::execution(format!("Failed to update content identity: {}", e)) + })?; (updated, false) } else { @@ -868,10 +865,7 @@ impl DBWriter { existing_active.last_verified_at = Set(chrono::Utc::now()); let updated = existing_active.update(db).await.map_err(|e| { - JobError::execution(format!( - "Failed to update content identity: {}", - e - )) + JobError::execution(format!("Failed to update content identity: {}", e)) })?; (updated, false) @@ -977,8 +971,7 @@ impl DBWriter { let mut moved_count = 0; for (entry_id, old_path, new_path, _) in moves { - match Self::simple_move_entry_in_conn(state, *entry_id, old_path, new_path, txn).await - { + match Self::simple_move_entry_in_conn(state, *entry_id, old_path, new_path, txn).await { Ok(()) => { moved_count += 1; } diff --git a/core/src/ops/indexing/persistence.rs b/core/src/ops/indexing/persistence.rs index ac1903759..c0e56b0fe 100644 --- a/core/src/ops/indexing/persistence.rs +++ b/core/src/ops/indexing/persistence.rs @@ -102,8 +102,8 @@ impl PersistenceFactory { ) -> Box { use super::ephemeral::EphemeralWriter; - let event_bus = - event_bus.unwrap_or_else(|| std::sync::Arc::new(crate::infra::event::EventBus::new(1024))); + let event_bus = event_bus + .unwrap_or_else(|| std::sync::Arc::new(crate::infra::event::EventBus::new(1024))); Box::new(EphemeralWriter::new(index, event_bus, root_path)) } diff --git a/core/src/ops/indexing/phases/content.rs b/core/src/ops/indexing/phases/content.rs index 055f4fa82..da1de2ceb 100644 --- a/core/src/ops/indexing/phases/content.rs +++ b/core/src/ops/indexing/phases/content.rs @@ -228,19 +228,19 @@ pub async fn run_content_phase( ) .await { - Ok(()) => { - ctx.log(format!( - "Batch synced {} entries with content IDs", - entries_to_sync.len() - )); - } - Err(e) => { - tracing::warn!( - "Failed to batch sync {} entries: {}", - entries_to_sync.len(), - e - ); - } + Ok(()) => { + ctx.log(format!( + "Batch synced {} entries with content IDs", + entries_to_sync.len() + )); + } + Err(e) => { + tracing::warn!( + "Failed to batch sync {} entries: {}", + entries_to_sync.len(), + e + ); + } } } diff --git a/core/src/ops/indexing/processor.rs b/core/src/ops/indexing/processor.rs index 74eda8cf6..d50c58912 100644 --- a/core/src/ops/indexing/processor.rs +++ b/core/src/ops/indexing/processor.rs @@ -150,8 +150,14 @@ impl ContentHashProcessor { let content_hash = ContentHashGenerator::generate_content_hash(&entry.path).await?; debug!("✓ Generated content hash: {}", content_hash); - DBWriter::link_to_content_identity(db, entry.id, &entry.path, content_hash, self.library_id) - .await?; + DBWriter::link_to_content_identity( + db, + entry.id, + &entry.path, + content_hash, + self.library_id, + ) + .await?; debug!("✓ Linked content identity for entry {}", entry.id); diff --git a/core/src/ops/indexing/progress.rs b/core/src/ops/indexing/progress.rs index 7240e0c49..088c166e4 100644 --- a/core/src/ops/indexing/progress.rs +++ b/core/src/ops/indexing/progress.rs @@ -101,11 +101,7 @@ impl ToGenericProgress for IndexerProgress { let mut progress = GenericProgress::new(percentage, &phase_name, &phase_message) .with_bytes(self.total_found.bytes, self.total_found.bytes) - .with_performance( - self.processing_rate, - self.estimated_remaining, - None, - ) + .with_performance(self.processing_rate, self.estimated_remaining, None) .with_errors(self.total_found.errors, 0) .with_metadata(self); diff --git a/core/src/ops/indexing/verify/action.rs b/core/src/ops/indexing/verify/action.rs index e374f9d85..876dc72a5 100644 --- a/core/src/ops/indexing/verify/action.rs +++ b/core/src/ops/indexing/verify/action.rs @@ -103,10 +103,10 @@ impl IndexVerifyAction { tracing::debug!("Running ephemeral indexer job on {}", path.display()); // Create ephemeral index storage that we'll share with the job - let ephemeral_index = Arc::new(RwLock::new( - EphemeralIndex::new() - .map_err(|e| ActionError::from(std::io::Error::new(std::io::ErrorKind::Other, e)))?, - )); + let ephemeral_index = + Arc::new(RwLock::new(EphemeralIndex::new().map_err(|e| { + ActionError::from(std::io::Error::new(std::io::ErrorKind::Other, e)) + })?)); // Subscribe to job events before dispatching let mut event_subscriber = context.events.subscribe();