Rename Layer<D> to TypedLayer and introduce heterogeneous Layer enum

Renames `Layer<D>` to `TypedLayer<D>` to establish a distinct typed abstraction. Introduces a new heterogeneous `Layer` enum that unifies count and presence storage with runtime dispatch, delegating operations to the underlying typed variants. Updates cache, index, and phylo consumers to align with the renamed type and new extension traits, preserving full test suite stability while preparing the foundation for multi-partition caching.
This commit is contained in:
Eric Coissac
2026-08-20 20:35:29 +02:00
parent 6c860f120f
commit 1c54e60c9a
15 changed files with 259 additions and 197 deletions
@@ -133,14 +133,35 @@ needed — `obikindex → obikpartitionner` stays the same direction as before.
Full workspace test suite green (0 failed) after, including all 27
`obikphylo::siblings` tests.
Still open: (1)/(2) themselves — `AnyLayer` (or whatever it ends up named;
`AnyLayer` was rejected as a placeholder, no replacement chosen yet) and
`KmerPartition` (singular, one partition's open layers) are not built yet.
`obikphylo::siblings::cache::{Mat, PartitionCache}` and
`obikpartitionner::query_layer` (now `obikindex::query_layer`)'s
`QueryLayer` still each independently bundle MPHF+matrix — unchanged by
this restructuring, which was purely about *where* code lives, not about
building the heterogeneous-layer cache itself.
## (1) done (2026-08-20): `Layer` is now the heterogeneous handle, `Mat` is gone
Resolved the naming question left open above. `Layer<D>` (the old
generic/monomorphic type) renamed to `TypedLayer<D>` throughout
(`obilayeredmap`, `obikindex`, `obikphylo` — 12 files, mechanical) to free
`Layer` for the type that's actually meant to be everyone's default
handle. `obilayeredmap::content_layer::Layer` (re-exported at the crate
root) is that type — `Count(TypedLayer<PersistentCompactIntMatrix>)`/
`Presence(TypedLayer<PersistentBitMatrix>)`, `Layer::open` doing the same
disk probe `Mat::open` used to, `find_slot`/`index_batch`/`n_cols`/
`fill_sub_matrix_carries` dispatching per variant exactly as `Mat` did.
`obikphylo::siblings::cache::Mat` deleted outright — `PartitionCache` now
holds `Vec<Vec<obilayeredmap::Layer>>` directly. The one sibling-specific
method `Mat` carried (`iter_minorants_batch`) is not on `obilayeredmap::
Layer` (phylo concepts don't belong in `obilayeredmap`) — it's an
`impl SiblingLayerExt for obilayeredmap::Layer` in `iter.rs`, dispatching
to each variant's existing `impl<D: LayerData> SiblingLayerExt for
TypedLayer<D>`.
Full workspace suite green (0 failed) after, including all 27
`obikphylo::siblings` tests.
Still not built: (2) — `KmerPartition` (singular, one partition's open
`Vec<Layer>`) and a multi-partition cache in `obikpartitionner` to replace
`obikphylo::siblings::cache::PartitionCache` and `obikindex::query_layer`'s
still-separate `QueryLayer` (which still independently bundles MPHF+matrix,
2-way not using `Layer` at all). Both remaining consumers now sit one
`Layer::open` call away from unifying onto (2) once it exists.
## The problem