From 16ff16b212d8833d1d5916dc528dce67254b65e0 Mon Sep 17 00:00:00 2001 From: FluorineDog Date: Sat, 16 Jan 2021 10:48:01 +0800 Subject: [PATCH] Renaming and add load index api beta Signed-off-by: FluorineDog --- .../src/common/{LoadIndex.h => LoadInfo.h} | 8 ++++- internal/core/src/segcore/SegmentGrowing.h | 2 +- internal/core/src/segcore/SegmentSealed.h | 29 ++++++++++--------- internal/core/src/segcore/load_index_c.cpp | 2 +- internal/core/src/segcore/segment_c.cpp | 2 +- internal/core/unittest/CMakeLists.txt | 1 + internal/core/unittest/test_c_api.cpp | 2 +- internal/core/unittest/test_load.cpp | 6 ++++ 8 files changed, 34 insertions(+), 18 deletions(-) rename internal/core/src/common/{LoadIndex.h => LoadInfo.h} (85%) create mode 100644 internal/core/unittest/test_load.cpp diff --git a/internal/core/src/common/LoadIndex.h b/internal/core/src/common/LoadInfo.h similarity index 85% rename from internal/core/src/common/LoadIndex.h rename to internal/core/src/common/LoadInfo.h index 377b53308..654691f8d 100644 --- a/internal/core/src/common/LoadIndex.h +++ b/internal/core/src/common/LoadInfo.h @@ -13,7 +13,7 @@ #include #include -#include "../index/knowhere/knowhere/index/vector_index/VecIndex.h" +#include "knowhere/index/vector_index/VecIndex.h" struct LoadIndexInfo { std::string field_name; @@ -21,3 +21,9 @@ struct LoadIndexInfo { std::map index_params; milvus::knowhere::VecIndexPtr index; }; + +struct LoadFieldDataInfo { + int64_t field_id; + void* blob; + int64_t row_count; +}; diff --git a/internal/core/src/segcore/SegmentGrowing.h b/internal/core/src/segcore/SegmentGrowing.h index ffd794ca5..9066f0be9 100644 --- a/internal/core/src/segcore/SegmentGrowing.h +++ b/internal/core/src/segcore/SegmentGrowing.h @@ -18,7 +18,7 @@ #include "query/deprecated/GeneralQuery.h" #include "query/Plan.h" -#include "common/LoadIndex.h" +#include "common/LoadInfo.h" #include "segcore/SegmentInterface.h" namespace milvus { diff --git a/internal/core/src/segcore/SegmentSealed.h b/internal/core/src/segcore/SegmentSealed.h index a784f3f24..fd83f2fa0 100644 --- a/internal/core/src/segcore/SegmentSealed.h +++ b/internal/core/src/segcore/SegmentSealed.h @@ -10,17 +10,20 @@ // or implied. See the License for the specific language governing permissions and limitations under the License #include "SegmentInterface.h" +#include "common/LoadInfo.h" -// class SegmentSealed : public SegmentInternalInterface { -// public: -// const Schema& get_schema() = 0; -// int64_t get_num_chunk() = 0; -// -// explicit SegmentSealed(SchemaPtr schema); -// void set_size(); -// void load_data(FieldId field_id, void* blob, int64_t blob_size); -// -// -// private: -// SchemaPtr schema_; -// } +namespace milvus::segcore { + +class SegmentSealed { + public: + virtual const Schema& + get_schema() = 0; + virtual int64_t + get_row_count() = 0; + virtual void + LoadIndex(const LoadIndexInfo& info) = 0; + virtual void + LoadFieldData(const LoadFieldDataInfo& info) = 0; +}; + +} // namespace milvus::segcore diff --git a/internal/core/src/segcore/load_index_c.cpp b/internal/core/src/segcore/load_index_c.cpp index 9afd0b626..21d5637f1 100644 --- a/internal/core/src/segcore/load_index_c.cpp +++ b/internal/core/src/segcore/load_index_c.cpp @@ -12,7 +12,7 @@ #include "index/knowhere/knowhere/common/BinarySet.h" #include "index/knowhere/knowhere/index/vector_index/VecIndexFactory.h" #include "segcore/load_index_c.h" -#include "common/LoadIndex.h" +#include "common/LoadInfo.h" #include "utils/EasyAssert.h" CStatus diff --git a/internal/core/src/segcore/segment_c.cpp b/internal/core/src/segcore/segment_c.cpp index 523af1842..61b6cf85e 100644 --- a/internal/core/src/segcore/segment_c.cpp +++ b/internal/core/src/segcore/segment_c.cpp @@ -19,7 +19,7 @@ #include #include #include -#include "common/LoadIndex.h" +#include "common/LoadInfo.h" CSegmentBase NewSegment(CCollection collection, uint64_t segment_id) { diff --git a/internal/core/unittest/CMakeLists.txt b/internal/core/unittest/CMakeLists.txt index 2427de4e0..443b3e32f 100644 --- a/internal/core/unittest/CMakeLists.txt +++ b/internal/core/unittest/CMakeLists.txt @@ -18,6 +18,7 @@ set(MILVUS_TEST_FILES test_reduce.cpp test_interface.cpp test_span.cpp + test_load.cpp ) add_executable(all_tests ${MILVUS_TEST_FILES} diff --git a/internal/core/unittest/test_c_api.cpp b/internal/core/unittest/test_c_api.cpp index 7aba224f1..d486812a2 100644 --- a/internal/core/unittest/test_c_api.cpp +++ b/internal/core/unittest/test_c_api.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include "test_utils/DataGen.h" diff --git a/internal/core/unittest/test_load.cpp b/internal/core/unittest/test_load.cpp new file mode 100644 index 000000000..9d6f2b1fd --- /dev/null +++ b/internal/core/unittest/test_load.cpp @@ -0,0 +1,6 @@ +#include +#include "segcore/SegmentSealed.h" + +TEST(Load, Naive) { + +} \ No newline at end of file -- GitLab