ExecutionEngineImpl.h 1.9 KB
Newer Older
S
starlord 已提交
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

S
starlord 已提交
15 16 17 18 19 20
namespace zilliz {
namespace milvus {
namespace engine {


class ExecutionEngineImpl : public ExecutionEngine {
X
xj.lin 已提交
21
 public:
S
starlord 已提交
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);
S
starlord 已提交
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;
S
starlord 已提交
44

X
xj.lin 已提交
45
    Status Merge(const std::string &location) override;
S
starlord 已提交
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;
S
starlord 已提交
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);
S
starlord 已提交
63

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

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

    size_t nprobe_ = 0;
X
xj.lin 已提交
73
    size_t nlist_ = 0;
X
xj.lin 已提交
74
    int64_t gpu_num = 0;
S
starlord 已提交
75 76 77 78 79 80
};


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