ExecutionEngine.h 1.4 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 14 15 16

namespace zilliz {
namespace vecwise {
namespace engine {

G
groot 已提交
17
enum class EngineType {
G
groot 已提交
18
    INVALID = 0,
G
groot 已提交
19 20 21 22
    FAISS_IDMAP = 1,
    FAISS_IVFFLAT,
};

23
class ExecutionEngine {
24 25
public:

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

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

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

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

G
groot 已提交
35
    virtual size_t PhysicalSize() const = 0;
36

G
groot 已提交
37
    virtual Status Serialize() = 0;
38

G
groot 已提交
39
    virtual Status Load() = 0;
40

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

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

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

G
groot 已提交
51
    virtual Status Cache() = 0;
52 53
};

G
groot 已提交
54 55
using ExecutionEnginePtr = std::shared_ptr<ExecutionEngine>;

X
Xu Peng 已提交
56 57 58 59

} // namespace engine
} // namespace vecwise
} // namespace zilliz