Options.h 2.1 KB
Newer Older
J
jinhai 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you 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
//
//   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.

X
Xu Peng 已提交
18
#pragma once
X
Xu Peng 已提交
19

S
starlord 已提交
20 21
#include "Constants.h"

X
Xu Peng 已提交
22
#include <string>
23
#include <memory>
X
Xu Peng 已提交
24
#include <map>
S
starlord 已提交
25
#include <vector>
X
Xu Peng 已提交
26

X
Xu Peng 已提交
27
namespace zilliz {
J
jinhai 已提交
28
namespace milvus {
X
Xu Peng 已提交
29
namespace engine {
X
Xu Peng 已提交
30

31
class Env;
32

J
jinhai 已提交
33 34
static const char* ARCHIVE_CONF_DISK = "disk";
static const char* ARCHIVE_CONF_DAYS = "days";
G
groot 已提交
35

X
Xu Peng 已提交
36 37 38
struct ArchiveConf {
    using CriteriaT = std::map<std::string, int>;

J
jinhai 已提交
39
    ArchiveConf(const std::string& type, const std::string& criterias = std::string());
X
Xu Peng 已提交
40 41 42 43

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

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

X
Xu Peng 已提交
46 47 48 49 50 51 52 53
private:
    void ParseCritirias(const std::string& type);
    void ParseType(const std::string& criterias);

    std::string type_;
    CriteriaT criterias_;
};

X
Xu Peng 已提交
54
struct DBMetaOptions {
S
starlord 已提交
55 56 57 58
    std::string path_;
    std::vector<std::string> slave_paths_;
    std::string backend_uri_;
    ArchiveConf archive_conf_ = ArchiveConf("delete");
X
Xu Peng 已提交
59 60
}; // DBMetaOptions

S
starlord 已提交
61
struct DBOptions {
Z
update  
zhiru 已提交
62 63 64 65 66 67
    typedef enum {
        SINGLE,
        CLUSTER,
        READ_ONLY
    } MODE;

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

S
starlord 已提交
72
    size_t insert_buffer_size_ = 4 * ONE_GB;
S
starlord 已提交
73
    bool insert_cache_immediately_ = false;
X
Xu Peng 已提交
74 75
}; // Options

X
Xu Peng 已提交
76

X
Xu Peng 已提交
77
} // namespace engine
J
jinhai 已提交
78
} // namespace milvus
X
Xu Peng 已提交
79
} // namespace zilliz