You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[C-API] Add getter and setter for index threadpool size (#305)
Adds `svs_index_get_num_threads` / `svs_index_set_num_threads` to the C
API, enabling dynamic inspection and resizing of the search threadpool
after index construction.
### ThreadPoolBuilder
- Added `get_threads_num()` — delegates to the custom pool's `size()` op
when `kind == CUSTOM`, otherwise returns the stored count
- Added `resize(n)` — updates stored thread count; throws
`std::invalid_argument` for `n == 0`, `SINGLE_THREAD`, or `CUSTOM` kinds
(surfaced as `SVS_ERROR_INVALID_ARGUMENT` through `wrap_exceptions`)
### Index wrappers (`index.hpp`)
- `Index` stores a `ThreadPoolBuilder`; `get_num_threads()` is
pure-virtual — implemented in `IndexVamana` and `DynamicIndexVamana` by
delegating to the wrapped `svs::Vamana` / `svs::DynamicVamana` instance,
so the value reflects actual runtime state
- `set_num_threads(n)` calls `pool_builder.resize(n)` then rebuilds and
installs the threadpool via `set_threadpool()`
### C API (`svs_c.cpp` / `svs_c.h`)
- Both entry points validate `index->impl` non-null before dereferencing
(consistent with existing handle-check pattern)
- Public header documents supported kinds and expected error codes for
unsupported configurations
0 commit comments