feat(rvf-runtime): expose public vector iterator on RvfStore#557
Open
thesoulpole wants to merge 1 commit into
Open
feat(rvf-runtime): expose public vector iterator on RvfStore#557thesoulpole wants to merge 1 commit into
thesoulpole wants to merge 1 commit into
Conversation
query() returns only (id, distance) (SearchResult), and the (id, vector) reader (VectorData / read_vec_seg_payload) was pub(crate) — so there was no public way to read vectors back out of an opened store. Adds two methods on RvfStore: - iter_vectors() -> impl Iterator<Item = (u64, &[f32])> (lazy, zero-copy) - read_all_vectors() -> Vec<(u64, Vec<f32>)> (owned convenience) Both skip deleted ids, matching query() visibility. No format change and no new IO path — exposes what is already materialized in memory (mirrors the existing walk in query_with_envelope). Unblocks external cache backends (e.g. ruLake's BackendAdapter) priming a quantized index without re-encoding. Test included.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
RvfStore::query()returns only(id, distance)(SearchResult), and the underlying(id, vector)reader (VectorData,read_path::read_vec_seg_payload) ispub(crate). There is no public way to read vectors back out of an opened store.This blocks anything that wants to use an
.rvfas a source of vectors rather than just a query target. Concretely, ruLake'sBackendAdapterneeds to iterate every(id, vector)to prime its RaBitQ cache, and currently can't — documented upstream inruvnet/RuLake→docs/research/rvf-backend-blocker.md(Path A).Change
Two methods on
RvfStore:iter_vectors(&self) -> impl Iterator<Item = (u64, &[f32])>— lazy, zero-copy; borrows the in-memory vector store.read_all_vectors(&self) -> Vec<(u64, Vec<f32>)>— owned convenience over the iterator.Both skip deleted ids, matching
query()visibility semantics. This is just exposing data already materialized in memory — it mirrors the existingids().filter_map(...)walk insidequery_with_envelope. No format change, no new IO path.Test
read_all_vectors_round_trips_and_excludes_deleted— ingests known(id, vector)pairs, asserts both accessors return them, and asserts a deleted id is excluded. Passes undercargo test -p rvf-runtime.