Skip to content

native serialization/deserialization for ivf#294

Merged
razdoburdin merged 1 commit intointel:dev/razdoburdin_streamingfrom
razdoburdin:streaming/ivf
Mar 22, 2026
Merged

native serialization/deserialization for ivf#294
razdoburdin merged 1 commit intointel:dev/razdoburdin_streamingfrom
razdoburdin:streaming/ivf

Conversation

@razdoburdin
Copy link
Copy Markdown
Contributor

This PR introduce native serialization for IVF index.

Main changes are:

  1. New overload of svs::index::ivf::load_ivf_index accpting istream is introduced.
  2. Added related tests.
  3. save(std::ostream&) method for DynamicIVF is just a placeholder for now. Real implementation is expected later.

@razdoburdin razdoburdin marked this pull request as draft March 20, 2026 10:44
@razdoburdin razdoburdin marked this pull request as ready for review March 20, 2026 11:13
@razdoburdin razdoburdin requested a review from rfsaliev March 20, 2026 11:14
@razdoburdin razdoburdin merged commit 81c5d82 into intel:dev/razdoburdin_streaming Mar 22, 2026
16 of 19 checks passed
razdoburdin added a commit that referenced this pull request Apr 16, 2026
This PR adds native stream serialization to all SVS index types, as an
alternative to the existing (legacy) directory-based serialization. It
allow to avoid filesystem round-trips of the data. The native
serialization doesn't require from the stream to be seek able, so no
additional restrictions were introduced.

See the following PR for details:
#280,
#281,
#285,
#286,
#289,
#292,
#294,
#296,
#299

Main changes are:
1. A CRTP base `Archiver` extracts binary I/O primitives (`write_size`,
`read_size`, `write_name`, `read_name`, `read_from_istream`) from
`DirectoryArchiver`. `DirectoryArchiver` and new `StreamArchiver` class
inherit from `Archiver`. `StreamArchiver` has its own magic number
("SVS_STRM") to distinguish native streams from directory archives.
2. The monolithic `Writer` is split via CRTP with two derived classes:
`FileWriter` owns an `std::ofstream`, writes a header, flushes on
destructor, `StreamWriter` wraps an external `std::ostream&`, no
header/lifecycle management. This allows `io::save(data, os)` to write
vector data directly to any stream.
3. The `save(stream)` in orchestrator `Impl` classes no longer does
temp-dir->pack. Instead it directly calls `impl().save(stream)`.
4. The dispatching between new (native) and old (legacy) deserialization
is made at the orchestrators. `Deserializer::build(is)` reads the magic
number, exposes `is_native()` to choose path.

---------

Co-authored-by: Dmitry Razdoburdin <drazdobu@intel.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Rafik Saliev <rafik.f.saliev@intel.com>
Co-authored-by: ethanglaser <42726565+ethanglaser@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants