Options.h 2.2 KB
Newer Older
1
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
J
jinhai 已提交
2
//
3 4
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
J
jinhai 已提交
5
//
6 7 8 9 10
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing permissions and limitations under the License.
J
jinhai 已提交
11

X
Xu Peng 已提交
12
#pragma once
X
Xu Peng 已提交
13

S
starlord 已提交
14 15
#include "Constants.h"

X
Xu Peng 已提交
16
#include <map>
S
starlord 已提交
17 18
#include <memory>
#include <string>
S
starlord 已提交
19
#include <vector>
X
Xu Peng 已提交
20

J
jinhai 已提交
21
namespace milvus {
X
Xu Peng 已提交
22
namespace engine {
X
Xu Peng 已提交
23

24
class Env;
25

C
Cai Yudong 已提交
26 27 28
extern const char* ARCHIVE_CONF_DISK;
extern const char* ARCHIVE_CONF_DAYS;
extern const char* DEFAULT_PARTITON_TAG;
G
groot 已提交
29

X
Xu Peng 已提交
30
struct ArchiveConf {
Y
yudong.cai 已提交
31
    using CriteriaT = std::map<std::string, int64_t>;
X
Xu Peng 已提交
32

S
starlord 已提交
33
    explicit ArchiveConf(const std::string& type, const std::string& criterias = std::string());
X
Xu Peng 已提交
34

S
starlord 已提交
35 36
    const std::string&
    GetType() const {
S
starlord 已提交
37 38
        return type_;
    }
X
Xu Peng 已提交
39

S
starlord 已提交
40 41
    const CriteriaT
    GetCriterias() const {
S
starlord 已提交
42 43
        return criterias_;
    }
G
groot 已提交
44

S
starlord 已提交
45 46
    void
    SetCriterias(const ArchiveConf::CriteriaT& criterial);
S
starlord 已提交
47 48

 private:
S
starlord 已提交
49
    void
S
starlord 已提交
50
    ParseCritirias(const std::string& criterias);
S
starlord 已提交
51
    void
S
starlord 已提交
52
    ParseType(const std::string& type);
X
Xu Peng 已提交
53 54 55 56 57

    std::string type_;
    CriteriaT criterias_;
};

X
Xu Peng 已提交
58
struct DBMetaOptions {
S
starlord 已提交
59 60 61
    std::string path_;
    std::string backend_uri_;
    ArchiveConf archive_conf_ = ArchiveConf("delete");
S
starlord 已提交
62
};  // DBMetaOptions
X
Xu Peng 已提交
63

S
starlord 已提交
64
struct DBOptions {
S
starlord 已提交
65
    typedef enum { SINGLE = 0, CLUSTER_READONLY, CLUSTER_WRITABLE } MODE;
Z
update  
zhiru 已提交
66

S
starlord 已提交
67
    uint16_t merge_trigger_number_ = 2;
S
starlord 已提交
68 69
    DBMetaOptions meta_;
    int mode_ = MODE::SINGLE;
S
starlord 已提交
70

B
bigbraver 已提交
71
    size_t insert_buffer_size_ = 4 * GB;
S
starlord 已提交
72
    bool insert_cache_immediately_ = false;
73

74
    int64_t auto_flush_interval_ = 1;
G
groot 已提交
75
    int64_t file_cleanup_timeout_ = 10;
76

G
groot 已提交
77 78
    bool metric_enable_ = false;

79 80 81
    // wal relative configurations
    bool wal_enable_ = true;
    bool recovery_error_ignore_ = true;
C
Cai Yudong 已提交
82
    int64_t buffer_size_ = 256;
83
    std::string mxlog_path_ = "/tmp/milvus/wal/";
S
starlord 已提交
84
};  // Options
X
Xu Peng 已提交
85

S
starlord 已提交
86 87
}  // namespace engine
}  // namespace milvus