cargo fmt

This commit is contained in:
Jamie Pine 2025-12-08 12:32:04 -08:00
parent 93c40bfb7c
commit 2641c335ff
8 changed files with 45 additions and 43 deletions

View File

@ -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?;

View File

@ -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);

View File

@ -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;
}

View File

@ -102,8 +102,8 @@ impl PersistenceFactory {
) -> Box<dyn IndexPersistence + Send + Sync> {
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))
}

View File

@ -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
);
}
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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();