ExecutionEngineImpl.h 1.9 KB
Newer Older
G
groot 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13
/*******************************************************************************
 * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
 * Unauthorized copying of this file, via any medium is strictly prohibited.
 * Proprietary and confidential.
 ******************************************************************************/
#pragma once

#include "ExecutionEngine.h"
#include "wrapper/knowhere/vec_index.h"

#include <memory>
#include <string>

X
xj.lin 已提交
14

G
groot 已提交
15 16 17 18 19 20
namespace zilliz {
namespace milvus {
namespace engine {


class ExecutionEngineImpl : public ExecutionEngine {
X
xj.lin 已提交
21
 public:
G
groot 已提交
22 23

    ExecutionEngineImpl(uint16_t dimension,
X
xj.lin 已提交
24 25 26 27 28 29
                        const std::string &location,
                        EngineType type);

    ExecutionEngineImpl(VecIndexPtr index,
                        const std::string &location,
                        EngineType type);
G
groot 已提交
30 31 32 33 34 35 36 37 38 39 40 41 42

    Status AddWithIds(long n, const float *xdata, const long *xids) override;

    size_t Count() const override;

    size_t Size() const override;

    size_t Dimension() const override;

    size_t PhysicalSize() const override;

    Status Serialize() override;

J
jinhai 已提交
43
    Status Load(bool to_cache) override;
G
groot 已提交
44

X
xj.lin 已提交
45
    Status Merge(const std::string &location) override;
G
groot 已提交
46 47 48 49 50 51 52

    Status Search(long n,
                  const float *data,
                  long k,
                  float *distances,
                  long *labels) const override;

X
xj.lin 已提交
53
    ExecutionEnginePtr BuildIndex(const std::string &) override;
G
groot 已提交
54 55 56 57 58

    Status Cache() override;

    Status Init() override;

X
xj.lin 已提交
59 60 61 62
 private:
    VecIndexPtr CreatetVecIndex(EngineType type);

    VecIndexPtr Load(const std::string &location);
G
groot 已提交
63

X
xj.lin 已提交
64 65 66
 protected:
    VecIndexPtr index_ = nullptr;
    EngineType build_type;
X
xj.lin 已提交
67
    EngineType current_type;
G
groot 已提交
68

X
xj.lin 已提交
69
    int64_t dim;
G
groot 已提交
70 71 72
    std::string location_;

    size_t nprobe_ = 0;
X
xj.lin 已提交
73
    int64_t gpu_num = 0;
G
groot 已提交
74 75 76 77 78 79
};


} // namespace engine
} // namespace milvus
} // namespace zilliz