Repository navigation
C API: add svs_index_load_stream_dynamic_ex - #477
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The FINE_GRAIN stream loader needs a committed round-trip regression test covering _ex synchronization behavior, index operations, and NULL/legacy fallback to NONE.
1 open issue
What changed in this PR
Adds svs_index_load_stream_dynamic_ex so C API callers can restore a concurrent dynamic index from a stream, matching the existing directory-loading capability.
Changes:
- Adds a parameterized stream-loading API accepting block settings and synchronization kind.
- Routes FINE_GRAIN loads through the concurrent Vamana dispatcher while preserving the legacy loader’s NONE behavior.
- Documents the new API and its stream-handling contract.
| File | Description |
|---|---|
bindings/c/src/svs_c.cpp |
Implements the new entry point and argument validation. |
bindings/c/src/index_builder.cpp |
Selects concurrent or plain dynamic stream loading. |
bindings/c/src/dispatcher_concurrent_vamana.hpp |
Declares the concurrent stream-loading dispatcher. |
bindings/c/src/dispatcher_concurrent_vamana.cpp |
Adds concurrent stream assembly and dispatch registration. |
bindings/c/include/svs/c/svs_c.h |
Declares and documents the public API. |
bindings/c/docs/C_API_Design.md |
Includes the new function in the API reference. |
Review effort: Balanced
| auto index = builder->impl->load_stream_dynamic( | ||
| std::make_unique<InputStream>(*stream->ops, stream->self), | ||
| dynamic_params.block_params, | ||
| dynamic_params.sync_kind |
There was a problem hiding this comment.
Added: saves to a stream, loads with svs_index_load_stream_dynamic_ex and checks the FINE_GRAIN sync kind and size, and that params = NULL gives NONE.
|
Tested through valkey-search together with #470 (results and setup: #470 (comment)). With |

Adds
svs_index_load_stream_dynamic_ex, the stream counterpart ofsvs_index_load_dynamic_ex.The C API can save the concurrent (FINE_GRAIN) index to a stream, and can load it back as concurrent from a directory, but loading from a stream always returned the non-concurrent index (
SVS_SYNC_KIND_NONE). The new function takessvs_dynamic_index_params_t(block params andsync_kind,NULL= defaults), soSVS_SYNC_KIND_FINE_GRAINloads the concurrent index.Changes
svs_c.h/svs_c.cpp: new function, same validation assvs_index_load_dynamic_exand the stream handling ofsvs_index_load_stream_dynamic.IndexBuilder::load_stream_dynamic: picks the concurrent or plain loader by sync kind, likeload_dynamic.dispatch_concurrent_vamana_index_load_stream, mirroring the directory path.svs_index_load_stream_dynamicis unchanged (stillNONE).Testing
c_api_stream.cpp("Dynamic stream load with sync kind"): save a dynamic index to a stream, load withsvs_index_load_stream_dynamic_ex→ FINE_GRAIN sync kind and correct size;params = NULL→ NONE.Split out of #470 as requested in review.
🤖 Generated with Claude Code