Skip to content

Commit dab086d

Browse files
authored
Refactor bindings parallel flow tests (#326)
1 parent 32ebe98 commit dab086d

File tree

12 files changed

+915
-223
lines changed

12 files changed

+915
-223
lines changed

src/VecSim/algorithms/brute_force/brute_force.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,18 @@ class BruteForceIndex : public VecSimIndexAbstract<DistType> {
5757

5858
inline vecsim_stl::vector<VectorBlock *> getVectorBlocks() const { return vectorBlocks; }
5959
virtual ~BruteForceIndex();
60+
#ifdef BUILD_TESTS
61+
/**
62+
* @brief Used for testing - store vector(s) data associated with a given label. This function
63+
* copies the vector(s)' data buffer(s) and place it in the output vector
64+
*
65+
* @param label
66+
* @param vectors_output empty vector to be modified, should store the blob(s) associated with
67+
* the label.
68+
*/
69+
virtual void getDataByLabel(labelType label,
70+
std::vector<std::vector<DataType>> &vectors_output) const = 0;
71+
#endif
6072

6173
protected:
6274
// Private internal function that implements generic single vector insertion.

src/VecSim/algorithms/brute_force/brute_force_multi.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ class BruteForceIndex_Multi : public BruteForceIndex<DataType, DistType> {
3333
new (this->allocator) vecsim_stl::unique_results_container(cap, this->allocator));
3434
}
3535
#ifdef BUILD_TESTS
36-
void GetDataByLabel(labelType label, std::vector<std::vector<DataType>> &vectors_output) {
36+
void getDataByLabel(labelType label,
37+
std::vector<std::vector<DataType>> &vectors_output) const override {
3738

3839
auto ids = labelToIdsLookup.find(label);
3940

src/VecSim/algorithms/brute_force/brute_force_single.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ class BruteForceIndex_Single : public BruteForceIndex<DataType, DistType> {
3232

3333
inline size_t indexLabelCount() const override { return this->count; }
3434
#ifdef BUILD_TESTS
35-
void GetDataByLabel(labelType label, std::vector<std::vector<DataType>> &vectors_output) {
35+
void getDataByLabel(labelType label,
36+
std::vector<std::vector<DataType>> &vectors_output) const override {
3637

3738
auto id = labelToIdLookup.at(label);
3839

src/VecSim/algorithms/hnsw/hnsw.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,19 @@ class HNSWIndex : public VecSimIndexAbstract<DistType>,
235235
// inline priority queue getter that need to be implemented by derived class
236236
virtual inline candidatesLabelsMaxHeap<DistType> *getNewMaxPriorityQueue() const = 0;
237237

238+
#ifdef BUILD_TESTS
239+
/**
240+
* @brief Used for testing - store vector(s) data associated with a given label. This function
241+
* copies the vector(s)' data buffer(s) and place it in the output vector
242+
*
243+
* @param label
244+
* @param vectors_output empty vector to be modified, should store the blob(s) associated with
245+
* the label.
246+
*/
247+
virtual void getDataByLabel(labelType label,
248+
std::vector<std::vector<DataType>> &vectors_output) const = 0;
249+
#endif
250+
238251
protected:
239252
// inline label to id setters that need to be implemented by derived class
240253
virtual inline std::unique_ptr<vecsim_stl::abstract_results_container>

src/VecSim/algorithms/hnsw/hnsw_multi.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ class HNSWIndex_Multi : public HNSWIndex<DataType, DistType> {
4242
: HNSWIndex<DataType, DistType>(input, params, allocator, version),
4343
label_lookup_(this->max_elements_, allocator) {}
4444

45-
void GetDataByLabel(labelType label, std::vector<std::vector<DataType>> &vectors_output) {
45+
void getDataByLabel(labelType label,
46+
std::vector<std::vector<DataType>> &vectors_output) const override {
4647

4748
auto ids = label_lookup_.find(label);
4849

src/VecSim/algorithms/hnsw/hnsw_single.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ class HNSWIndex_Single : public HNSWIndex<DataType, DistType> {
3535
: HNSWIndex<DataType, DistType>(input, params, allocator, version),
3636
label_lookup_(this->max_elements_, allocator) {}
3737

38-
void GetDataByLabel(labelType label, std::vector<std::vector<DataType>> &vectors_output) {
38+
void getDataByLabel(labelType label,
39+
std::vector<std::vector<DataType>> &vectors_output) const override {
3940

4041
auto id = label_lookup_.at(label);
4142

src/python_bindings/Mybytearray.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)