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>
X
Xu Peng 已提交
11

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

16
class Env;
17

G
refine  
groot 已提交
18 19 20 21
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 已提交
22 23 24 25
static const std::string ARCHIVE_CONF_DISK = "disk";
static const std::string ARCHIVE_CONF_DAYS = "days";
static const std::string ARCHIVE_CONF_DEFAULT = ARCHIVE_CONF_DISK + ":512";

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

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

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

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

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

    std::string type_;
    CriteriaT criterias_;
};

X
Xu Peng 已提交
44 45
struct DBMetaOptions {
    std::string path;
X
Xu Peng 已提交
46
    std::string backend_uri;
X
Xu Peng 已提交
47
    ArchiveConf archive_conf = ArchiveConf("delete");
X
Xu Peng 已提交
48 49
}; // DBMetaOptions

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

    typedef enum {
        SINGLE,
        CLUSTER,
        READ_ONLY
    } MODE;

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

X
Xu Peng 已提交
66

X
Xu Peng 已提交
67
} // namespace engine
J
jinhai 已提交
68
} // namespace milvus
X
Xu Peng 已提交
69
} // namespace zilliz