Options.h 1.9 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
#pragma once
X
Xu Peng 已提交
7

X
Xu Peng 已提交
8
#include <string>
9
#include <memory>
X
Xu Peng 已提交
10
#include <map>
S
starlord 已提交
11
#include <vector>
X
Xu Peng 已提交
12

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

17
class Env;
18

G
refine  
groot 已提交
19 20 21 22
static constexpr uint64_t ONE_KB = 1024;
static constexpr uint64_t ONE_MB = ONE_KB*ONE_KB;
static constexpr uint64_t ONE_GB = ONE_KB*ONE_MB;

G
groot 已提交
23 24
static const std::string ARCHIVE_CONF_DISK = "disk";
static const std::string ARCHIVE_CONF_DAYS = "days";
S
starlord 已提交
25
static const std::string ARCHIVE_CONF_DEFAULT = "";
G
groot 已提交
26

X
Xu Peng 已提交
27 28 29
struct ArchiveConf {
    using CriteriaT = std::map<std::string, int>;

G
groot 已提交
30
    ArchiveConf(const std::string& type, const std::string& criterias = ARCHIVE_CONF_DEFAULT);
X
Xu Peng 已提交
31 32 33 34

    const std::string& GetType() const { return type_; }
    const CriteriaT GetCriterias() const { return criterias_; }

G
groot 已提交
35 36
    void SetCriterias(const ArchiveConf::CriteriaT& criterial);

X
Xu Peng 已提交
37 38 39 40 41 42 43 44
private:
    void ParseCritirias(const std::string& type);
    void ParseType(const std::string& criterias);

    std::string type_;
    CriteriaT criterias_;
};

X
Xu Peng 已提交
45 46
struct DBMetaOptions {
    std::string path;
S
starlord 已提交
47
    std::vector<std::string> slave_paths;
X
Xu Peng 已提交
48
    std::string backend_uri;
X
Xu Peng 已提交
49
    ArchiveConf archive_conf = ArchiveConf("delete");
X
Xu Peng 已提交
50 51
}; // DBMetaOptions

X
Xu Peng 已提交
52
struct Options {
Z
update  
zhiru 已提交
53 54 55 56 57 58 59

    typedef enum {
        SINGLE,
        CLUSTER,
        READ_ONLY
    } MODE;

X
Xu Peng 已提交
60
    Options();
G
groot 已提交
61
    uint16_t  memory_sync_interval = 1;             //unit: second
62
    uint16_t  merge_trigger_number = 2;
G
refine  
groot 已提交
63
    size_t  index_trigger_size = ONE_GB;            //unit: byte
X
Xu Peng 已提交
64
    DBMetaOptions meta;
Z
update  
zhiru 已提交
65
    int mode = MODE::SINGLE;
66
    size_t insert_buffer_size = 4 * ONE_GB;
X
Xu Peng 已提交
67 68
}; // Options

X
Xu Peng 已提交
69

X
Xu Peng 已提交
70
} // namespace engine
J
jinhai 已提交
71
} // namespace milvus
X
Xu Peng 已提交
72
} // namespace zilliz