提交 f5b0ec50 编写于 作者: X Xu Peng

refactor(db): typedef engine ptr


Former-commit-id: 4629cac435fd484ab949ab112b639a4849e37fca
上级 85707aa3
......@@ -75,7 +75,7 @@ Status FaissExecutionEngine::Merge(const std::string& location) {
return Status::OK();
}
std::shared_ptr<FaissExecutionEngine> FaissExecutionEngine::BuildIndex(const std::string& location) {
FaissExecutionEngine::Ptr FaissExecutionEngine::BuildIndex(const std::string& location) {
auto opd = std::make_shared<Operand>();
opd->d = pIndex_->d;
opd->index_type = BuildIndexType;
......@@ -87,7 +87,7 @@ std::shared_ptr<FaissExecutionEngine> FaissExecutionEngine::BuildIndex(const std
dynamic_cast<faiss::IndexFlat*>(from_index->index)->xb.data(),
from_index->id_map.data());
std::shared_ptr<FaissExecutionEngine> new_ee(new FaissExecutionEngine(index->data(), location));
Ptr new_ee(new FaissExecutionEngine(index->data(), location));
new_ee->Serialize();
return new_ee;
}
......
......@@ -13,9 +13,12 @@ namespace zilliz {
namespace vecwise {
namespace engine {
class FaissExecutionEngine;
class FaissExecutionEngine : public ExecutionEngine<FaissExecutionEngine> {
public:
typedef std::shared_ptr<FaissExecutionEngine> Ptr;
FaissExecutionEngine(uint16_t dimension, const std::string& location);
FaissExecutionEngine(std::shared_ptr<faiss::Index> index, const std::string& location);
......@@ -42,7 +45,7 @@ public:
float *distances,
long *labels) const;
std::shared_ptr<FaissExecutionEngine> BuildIndex(const std::string&);
FaissExecutionEngine::Ptr BuildIndex(const std::string&);
Status Cache();
protected:
......
......@@ -22,6 +22,8 @@ namespace meta {
template <typename EngineT>
class MemVectors {
public:
typedef typename EngineT::Ptr EnginePtr;
explicit MemVectors(const std::shared_ptr<meta::Meta>&,
const meta::GroupFileSchema&, const Options&);
......@@ -46,7 +48,7 @@ private:
Options options_;
meta::GroupFileSchema schema_;
IDGenerator* _pIdGenerator;
std::shared_ptr<EngineT> pEE_;
EnginePtr pEE_;
}; // MemVectors
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册