From fbeddc2ad54d2ad7fbe9b29883ad677fa51bffa1 Mon Sep 17 00:00:00 2001 From: Xu Peng Date: Mon, 27 May 2019 19:39:12 +0800 Subject: [PATCH] refactor(db): refactor for execution engine Former-commit-id: 5bf686bae2669ecfe6c4ba722a001c6303bb2f43 --- cpp/src/db/ExecutionEngine.cpp | 3 ++- cpp/src/db/ExecutionEngine.h | 4 ++-- cpp/src/db/FaissExecutionEngine.h | 10 ++++++---- ...issExecutionEngine.cpp => FaissExecutionEngine.inl} | 9 +++------ 4 files changed, 13 insertions(+), 13 deletions(-) rename cpp/src/db/{FaissExecutionEngine.cpp => FaissExecutionEngine.inl} (98%) diff --git a/cpp/src/db/ExecutionEngine.cpp b/cpp/src/db/ExecutionEngine.cpp index b689e6cfed..6eb04bb788 100644 --- a/cpp/src/db/ExecutionEngine.cpp +++ b/cpp/src/db/ExecutionEngine.cpp @@ -3,9 +3,10 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. * Proprietary and confidential. ******************************************************************************/ -#include #include "ExecutionEngine.h" +#include + namespace zilliz { namespace vecwise { namespace engine { diff --git a/cpp/src/db/ExecutionEngine.h b/cpp/src/db/ExecutionEngine.h index 0b7af1b53e..6ad91959e8 100644 --- a/cpp/src/db/ExecutionEngine.h +++ b/cpp/src/db/ExecutionEngine.h @@ -5,11 +5,11 @@ ******************************************************************************/ #pragma once +#include "Status.h" + #include #include -#include "Status.h" - namespace zilliz { namespace vecwise { namespace engine { diff --git a/cpp/src/db/FaissExecutionEngine.h b/cpp/src/db/FaissExecutionEngine.h index 739e09efca..2915acc0eb 100644 --- a/cpp/src/db/FaissExecutionEngine.h +++ b/cpp/src/db/FaissExecutionEngine.h @@ -5,11 +5,11 @@ ******************************************************************************/ #pragma once +#include "ExecutionEngine.h" + #include #include -#include "ExecutionEngine.h" - namespace faiss { class Index; } @@ -22,7 +22,7 @@ namespace engine { template class FaissExecutionEngine : public ExecutionEngine> { public: - typedef std::shared_ptr> Ptr; + using Ptr = std::shared_ptr>; FaissExecutionEngine(uint16_t dimension, const std::string& location); FaissExecutionEngine(std::shared_ptr index, const std::string& location); @@ -53,7 +53,9 @@ public: Ptr BuildIndex(const std::string&); Status Cache(); + protected: + std::shared_ptr pIndex_; std::string location_; }; @@ -63,4 +65,4 @@ protected: } // namespace vecwise } // namespace zilliz -#include "FaissExecutionEngine.cpp" +#include "FaissExecutionEngine.inl" diff --git a/cpp/src/db/FaissExecutionEngine.cpp b/cpp/src/db/FaissExecutionEngine.inl similarity index 98% rename from cpp/src/db/FaissExecutionEngine.cpp rename to cpp/src/db/FaissExecutionEngine.inl index c2165c948d..961090f893 100644 --- a/cpp/src/db/FaissExecutionEngine.cpp +++ b/cpp/src/db/FaissExecutionEngine.inl @@ -3,8 +3,9 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. * Proprietary and confidential. ******************************************************************************/ -#ifndef FAISSEXECUTIONENGINE_CPP__ -#define FAISSEXECUTIONENGINE_CPP__ +#pragma once + +#include "FaissExecutionEngine.h" #include #include @@ -15,8 +16,6 @@ #include #include -#include "FaissExecutionEngine.h" - namespace zilliz { namespace vecwise { namespace engine { @@ -135,5 +134,3 @@ Status FaissExecutionEngine::Cache() { } // namespace engine } // namespace vecwise } // namespace zilliz - -#endif