feat: centralize index configuration and add hybrid mode

Centralizes index configuration by storing a single `IndexMode` (`Exact`, `Approx`, or `Hybrid`) in `PartitionMeta`, eliminating per-layer metadata files. Introduces a `Hybrid` evidence mode and an `--approx` CLI flag to toggle between exact and probabilistic indexing. Refactors the build and query pipelines to dynamically dispatch based on the configured mode, deferring `.idx` generation to Pass 2 and only requiring it for Exact/Hybrid modes. Updates layer opening to load appropriate data structures, enforces strict parameter validation during merges, and clarifies performance trade-offs in documentation.
This commit is contained in:
Eric Coissac committed 2026-05-26 15:08:29 +02:00
commit 98c14aade9
19 files changed
+420 -441

No files matched your search

+3 -3
View File
@@ -2,7 +2,7 @@ use std::path::PathBuf;
use clap::Args;
use obikindex::{GenomeInfo, IndexConfig, IndexState, KmerIndex};
use obilayeredmap::EvidenceKind;
use obilayeredmap::IndexMode;
fn parse_key_value(s: &str) -> Result<(String, String), String> {
let pos = s.find('=').ok_or_else(|| format!("invalid key=value: no '=' in '{s}'"))?;
@@ -159,9 +159,9 @@ pub fn run(args: IndexArgs) {
let evidence = if args.approx {
let (z, b, fp) = resolve_approx_params(args.findere_z, args.evidence_bits, args.fp);
info!("approximate evidence: b={b}, z={z}, fp={fp:.2e}");
EvidenceKind::Approx { b, z }
IndexMode::Approx { b, z }
} else {
EvidenceKind::Exact
IndexMode::Exact
};
// ── Open or create the index ─────────────────────────────────────────────
+3 -3
View File
@@ -2,7 +2,7 @@ use std::path::PathBuf;
use clap::Args;
use obikindex::KmerIndex;
use obilayeredmap::EvidenceKind;
use obilayeredmap::IndexMode;
use obisys::Reporter;
use tracing::info;
@@ -41,10 +41,10 @@ pub fn run(args: ReindexArgs) {
let target = if args.approx {
let (z, b, fp) = resolve_approx_params(args.findere_z, args.evidence_bits, args.fp);
info!("target: approximate evidence — b={b}, z={z}, fp={fp:.2e}");
EvidenceKind::Approx { b, z }
IndexMode::Approx { b, z }
} else {
info!("target: exact evidence");
EvidenceKind::Exact
IndexMode::Exact
};
let mut idx = KmerIndex::open(&args.index).unwrap_or_else(|e| {