mirror of https://github.com/milvus-io/milvus.git
Optimize segcore API arrangement (#12135)
Signed-off-by: yudong.cai <yudong.cai@zilliz.com>pull/12138/head
parent
51b353b52c
commit
3aca73969f
|
@ -14,7 +14,6 @@ set(SEGCORE_FILES
|
|||
Collection.cpp
|
||||
collection_c.cpp
|
||||
segment_c.cpp
|
||||
SegmentGrowing.cpp
|
||||
SegmentGrowingImpl.cpp
|
||||
SegmentSealedImpl.cpp
|
||||
FieldIndexing.cpp
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software distributed under the License
|
||||
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
// or implied. See the License for the specific language governing permissions and limitations under the License
|
||||
|
||||
#include "segcore/SegmentGrowing.h"
|
||||
#include "segcore/SegmentGrowingImpl.h"
|
||||
|
||||
namespace milvus::segcore {
|
||||
|
||||
int
|
||||
TestABI() {
|
||||
return 42;
|
||||
}
|
||||
|
||||
std::unique_ptr<SegmentGrowing>
|
||||
CreateGrowingSegment(SchemaPtr schema, const SegcoreConfig& segcore_config) {
|
||||
auto segment = std::make_unique<SegmentGrowingImpl>(schema, segcore_config);
|
||||
return segment;
|
||||
}
|
||||
|
||||
} // namespace milvus::segcore
|
|
@ -35,9 +35,6 @@ struct ColumnBasedRawData {
|
|||
int64_t count;
|
||||
};
|
||||
|
||||
int
|
||||
TestABI();
|
||||
|
||||
class SegmentGrowing : public SegmentInternalInterface {
|
||||
public:
|
||||
virtual void
|
||||
|
@ -73,13 +70,4 @@ class SegmentGrowing : public SegmentInternalInterface {
|
|||
|
||||
using SegmentGrowingPtr = std::unique_ptr<SegmentGrowing>;
|
||||
|
||||
SegmentGrowingPtr
|
||||
CreateGrowingSegment(SchemaPtr schema, const SegcoreConfig& segcore_config);
|
||||
|
||||
inline SegmentGrowingPtr
|
||||
CreateGrowingSegment(SchemaPtr schema) {
|
||||
auto seg_conf = SegcoreConfig::default_config();
|
||||
return CreateGrowingSegment(schema, seg_conf);
|
||||
}
|
||||
|
||||
} // namespace milvus::segcore
|
||||
|
|
|
@ -229,4 +229,9 @@ class SegmentGrowingImpl : public SegmentGrowing {
|
|||
bool enable_small_index_ = true;
|
||||
};
|
||||
|
||||
inline SegmentGrowingPtr
|
||||
CreateGrowingSegment(SchemaPtr schema, const SegcoreConfig& conf = SegcoreConfig::default_config()) {
|
||||
return std::make_unique<SegmentGrowingImpl>(schema, conf);
|
||||
}
|
||||
|
||||
} // namespace milvus::segcore
|
||||
|
|
|
@ -40,7 +40,4 @@ class SegmentSealed : public SegmentInternalInterface {
|
|||
|
||||
using SegmentSealedPtr = std::unique_ptr<SegmentSealed>;
|
||||
|
||||
SegmentSealedPtr
|
||||
CreateSealedSegment(SchemaPtr schema);
|
||||
|
||||
} // namespace milvus::segcore
|
||||
|
|
|
@ -639,9 +639,4 @@ SegmentSealedImpl::mask_with_timestamps(boost::dynamic_bitset<>& bitset_chunk, T
|
|||
bitset_chunk &= mask;
|
||||
}
|
||||
|
||||
SegmentSealedPtr
|
||||
CreateSealedSegment(SchemaPtr schema) {
|
||||
return std::make_unique<SegmentSealedImpl>(schema);
|
||||
}
|
||||
|
||||
} // namespace milvus::segcore
|
||||
|
|
|
@ -187,4 +187,10 @@ class SegmentSealedImpl : public SegmentSealed {
|
|||
TimestampIndex timestamp_index_;
|
||||
SchemaPtr schema_;
|
||||
};
|
||||
|
||||
inline SegmentSealedPtr
|
||||
CreateSealedSegment(SchemaPtr schema) {
|
||||
return std::make_unique<SegmentSealedImpl>(schema);
|
||||
}
|
||||
|
||||
} // namespace milvus::segcore
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#include "knowhere/index/vector_index/adapter/VectorAdapter.h"
|
||||
#include "log/Log.h"
|
||||
#include "segcore/Collection.h"
|
||||
#include "segcore/SegmentGrowing.h"
|
||||
#include "segcore/SegmentSealed.h"
|
||||
#include "segcore/SegmentGrowingImpl.h"
|
||||
#include "segcore/SegmentSealedImpl.h"
|
||||
#include "segcore/segment_c.h"
|
||||
#include "segcore/SimilarityCorelation.h"
|
||||
|
||||
|
|
|
@ -23,11 +23,6 @@ using namespace milvus::engine;
|
|||
using namespace milvus::segcore;
|
||||
using std::vector;
|
||||
|
||||
TEST(ConcurrentVector, TestABI) {
|
||||
ASSERT_EQ(TestABI(), 42);
|
||||
assert(true);
|
||||
}
|
||||
|
||||
TEST(ConcurrentVector, TestSingle) {
|
||||
auto dim = 8;
|
||||
ConcurrentVectorImpl<int, false> c_vec(dim, 32);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <random>
|
||||
#include <string>
|
||||
|
||||
#include "segcore/SegmentGrowing.h"
|
||||
#include "segcore/SegmentGrowingImpl.h"
|
||||
|
||||
using namespace milvus;
|
||||
|
||||
|
@ -43,13 +43,6 @@ generate_data(int N) {
|
|||
}
|
||||
} // namespace
|
||||
|
||||
TEST(SegmentCoreTest, TestABI) {
|
||||
using namespace milvus::engine;
|
||||
using namespace milvus::segcore;
|
||||
ASSERT_EQ(TestABI(), 42);
|
||||
assert(true);
|
||||
}
|
||||
|
||||
TEST(SegmentCoreTest, NormalDistributionTest) {
|
||||
using namespace milvus::segcore;
|
||||
using namespace milvus::engine;
|
||||
|
|
|
@ -10,21 +10,22 @@
|
|||
// or implied. See the License for the specific language governing permissions and limitations under the License
|
||||
|
||||
#pragma once
|
||||
#include "common/Schema.h"
|
||||
#include <random>
|
||||
#include <memory>
|
||||
#include <cstring>
|
||||
#include "segcore/SegmentGrowing.h"
|
||||
#include "segcore/SegmentSealed.h"
|
||||
#include "Constants.h"
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include "segcore/SegmentSealed.h"
|
||||
|
||||
#include <knowhere/index/vector_index/VecIndex.h>
|
||||
#include <knowhere/index/vector_index/adapter/VectorAdapter.h>
|
||||
#include <knowhere/index/vector_index/VecIndexFactory.h>
|
||||
#include <knowhere/index/vector_index/IndexIVF.h>
|
||||
#include <query/SearchOnIndex.h>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <random>
|
||||
|
||||
#include "Constants.h"
|
||||
#include "common/Schema.h"
|
||||
#include "knowhere/index/vector_index/VecIndex.h"
|
||||
#include "knowhere/index/vector_index/adapter/VectorAdapter.h"
|
||||
#include "knowhere/index/vector_index/VecIndexFactory.h"
|
||||
#include "knowhere/index/vector_index/IndexIVF.h"
|
||||
#include "query/SearchOnIndex.h"
|
||||
#include "segcore/SegmentGrowingImpl.h"
|
||||
#include "segcore/SegmentSealedImpl.h"
|
||||
|
||||
using boost::algorithm::starts_with;
|
||||
|
||||
namespace milvus::segcore {
|
||||
|
|
Loading…
Reference in New Issue