Refactor indexing pipeline and partition path resolution

Invert dependencies by moving partition path primitives to a dedicated module and updating the index crate accordingly. Reshape the partition router to accept a mutable index reference, enabling chainable configuration and resolving lifetime issues with explicit drops. Shift orchestration logic from the index crate to the CLI, replacing monolithic scatter calls with discrete dereplication and counting steps. Introduce a generic progress callback API to decouple rate calculation from UI rendering, and correct file I/O paths to route layer-0 artifacts under the partition index directory.
This commit is contained in:
Eric Coissac committed 2026-08-20 22:15:13 +02:00
1 parent 164e879585
commit 616cb76af3
19 files changed
+535 -405

No files matched your search

+1 -1
View File
@@ -9,6 +9,6 @@ mod stage;
pub use budget::MemoryBudget;
pub use lock::DirLock;
pub use progress::{TracedBar, progress_bar, spinner};
pub use progress::{Progress, TracedBar, progress_bar, spinner};
pub use resources::{CpuSample, IoSample, available_memory_bytes, effective_parallelism, peak_rss_bytes};
pub use stage::{Reporter, Stage, StageStats};
+21
View File
@@ -5,6 +5,27 @@ use std::time::{Duration, Instant};
use indicatif::{ProgressBar, ProgressStyle};
use tracing::{debug, info};
// ── Generic progress reporting ──────────────────────────────────────────────
/// One tick of progress from a long-running algorithm, passed to a
/// caller-supplied callback — the standard shape every algo crate's `run()`
/// should use, so a CLI command only has to learn to read this once
/// regardless of which algorithm is reporting.
///
/// `total: None` means the algorithm doesn't know its total work up front
/// (e.g. bases scattered from input files of unknown size until read) — the
/// caller should render a spinner. `total: Some(n)` means it does — the
/// caller can render an actual progress bar. The algorithm itself never
/// decides which; it only reports what it knows, `position` and `total`,
/// and stays unaware of how — or whether — the caller displays it.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Progress {
pub position: u64,
pub total: Option<u64>,
}
// ── Terminal progress bar/spinner ────────────────────────────────────────────
const BRAILLE: &[&str] = &["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
const ETA_REFRESH_MS: u64 = 500;
const ETA_MIN_ELAPSED_MS: u64 = 1000;