Make pack::repack pub for storage-backed consumers (persist packed codes, rebuild blocked at load)
Feature request: make pack::repack pub (it is pub(crate) today).
Context: a consumer that persists only the row-major packed_codes (to halve on-disk footprint) and rebuilds the SIMD-blocked layout at open-time needs to call repack itself. That is exactly what pg_turbovec does — it stores packed codes in PostgreSQL's relation fork and reconstructs blocked per backend rather than persisting it. Today that requires a one-line fork delta (pub(crate) fn repack → pub fn repack), which I'd like to retire.
Why this is general, not just my need: the "persist packed codes, rebuild blocked at load" pattern is the right call for any storage-backed consumer where the blocked layout is derivable and doubles the footprint if persisted. Exposing repack (alongside the parts API in the sibling request) is what makes that pattern possible without a fork.
Diff: trivial — flip the visibility on the existing function, signature unchanged. repack already has a clear contract (2 <= bits <= 4, dim % 8 == 0, packed_codes.len() == n_vectors * (dim/8) * bits); the doc comment can state that raw callers should construct through from_parts which validates those, exactly as it does today.
API-stability note: this is a permanent public commitment on a function whose current callers are all in-crate, so it's worth a moment's thought about whether the signature is the one you'd want frozen. I think it is — (packed_codes, n_vectors, bits, dim) -> (Vec<u8>, usize) is minimal and stable.
Relationship to the parallel-repack request (#545): independent but complementary. #545 makes repack fast; this makes it callable out-of-tree. If you'd rather keep repack private and expose a blocked_codes() accessor off from_parts instead, that would force the blocked layout resident in memory and defeat the persist-packed-only win — which is why the public repack (not a resident accessor) is the ask. Happy to discuss the shape.
Per CONTRIBUTING, raising as an issue first. Would pair naturally with #545 in review (same file, same consumer). Can I get contributor access to open both?
Source: RyanCodrai/turbovec