ExecutionEngine.h 1.6 KB
Newer Older
X
Xu Peng 已提交
1 2 3 4 5
/*******************************************************************************
 * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
 * Unauthorized copying of this file, via any medium is strictly prohibited.
 * Proprietary and confidential.
 ******************************************************************************/
X
Xu Peng 已提交
6 7
#pragma once

8 9
#include "Status.h"

X
Xu Peng 已提交
10
#include <vector>
X
Xu Peng 已提交
11
#include <memory>
X
Xu Peng 已提交
12 13

namespace zilliz {
J
jinhai 已提交
14
namespace milvus {
X
Xu Peng 已提交
15 16
namespace engine {

G
groot 已提交
17
enum class EngineType {
G
groot 已提交
18
    INVALID = 0,
G
groot 已提交
19
    FAISS_IDMAP = 1,
S
starlord 已提交
20 21 22
    FAISS_IVFFLAT_GPU,
    FAISS_IVFFLAT_CPU,
    SPTAG_KDT_RNT_CPU,
G
groot 已提交
23 24
};

25
class ExecutionEngine {
26 27
public:

G
groot 已提交
28
    virtual Status AddWithIdArray(const std::vector<float>& vectors, const std::vector<long>& vector_ids);
29

G
groot 已提交
30
    virtual Status AddWithIds(long n, const float *xdata, const long *xids) = 0;
31

G
groot 已提交
32
    virtual size_t Count() const = 0;
33

G
groot 已提交
34
    virtual size_t Size() const = 0;
35

G
groot 已提交
36 37
    virtual size_t Dimension() const = 0;

G
groot 已提交
38
    virtual size_t PhysicalSize() const = 0;
39

G
groot 已提交
40
    virtual Status Serialize() = 0;
41

G
groot 已提交
42
    virtual Status Load() = 0;
43

G
groot 已提交
44
    virtual Status Merge(const std::string& location) = 0;
45

G
groot 已提交
46
    virtual Status Search(long n,
47 48 49
                  const float *data,
                  long k,
                  float *distances,
G
groot 已提交
50
                  long *labels) const = 0;
51

G
groot 已提交
52
    virtual std::shared_ptr<ExecutionEngine> BuildIndex(const std::string&) = 0;
53

G
groot 已提交
54
    virtual Status Cache() = 0;
Y
yu yunfeng 已提交
55 56

    virtual Status Init() = 0;
57 58
};

G
groot 已提交
59 60
using ExecutionEnginePtr = std::shared_ptr<ExecutionEngine>;

X
Xu Peng 已提交
61 62

} // namespace engine
J
jinhai 已提交
63
} // namespace milvus
X
Xu Peng 已提交
64
} // namespace zilliz