ServerConfig.h 2.3 KB
Newer Older
G
groot 已提交
1 2 3 4 5 6 7 8 9 10
/*******************************************************************************
 * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
 * Unauthorized copying of this file, via any medium is strictly prohibited.
 * Proprietary and confidential.
 ******************************************************************************/
#pragma once

#include "utils/Error.h"
#include "config/ConfigNode.h"

Z
zhiru 已提交
11
#include "yaml-cpp/yaml.h"
G
groot 已提交
12 13

namespace zilliz {
J
jinhai 已提交
14
namespace milvus {
G
groot 已提交
15 16 17
namespace server {

static const std::string CONFIG_SERVER = "server_config";
G
groot 已提交
18 19 20
static const std::string CONFIG_SERVER_ADDRESS = "address";
static const std::string CONFIG_SERVER_PORT = "port";
static const std::string CONFIG_SERVER_PROTOCOL = "transfer_protocol";
Z
update  
zhiru 已提交
21
static const std::string CONFIG_CLUSTER_MODE = "mode";
G
groot 已提交
22 23 24 25

static const std::string CONFIG_DB = "db_config";
static const std::string CONFIG_DB_URL = "db_backend_url";
static const std::string CONFIG_DB_PATH = "db_path";
G
groot 已提交
26
static const std::string CONFIG_DB_INDEX_TRIGGER_SIZE = "index_building_threshold";
G
groot 已提交
27 28
static const std::string CONFIG_DB_ARCHIVE_DISK = "archive_disk_threshold";
static const std::string CONFIG_DB_ARCHIVE_DAYS = "archive_days_threshold";
G
groot 已提交
29

G
groot 已提交
30
static const std::string CONFIG_LOG = "log_config";
G
groot 已提交
31

G
groot 已提交
32
static const std::string CONFIG_CACHE = "cache_config";
G
groot 已提交
33 34
static const std::string CONFIG_CPU_CACHE_CAPACITY = "cpu_cache_capacity";
static const std::string CONFIG_GPU_CACHE_CAPACITY = "gpu_cache_capacity";
G
groot 已提交
35

Y
yangwei.yao 已提交
36 37 38
static const std::string CONFIG_LICENSE = "license_config";
static const std::string CONFIG_LICENSE_PATH = "license_path";

Y
yu yunfeng 已提交
39 40 41
static const std::string CONFIG_METRIC = "metric_config";
static const std::string CONFIG_METRIC_IS_STARTUP = "is_startup";
static const std::string CONFIG_METRIC_COLLECTOR = "collector";
42 43
static const std::string CONFIG_PROMETHEUS = "prometheus_config";
static const std::string CONFIG_METRIC_PROMETHEUS_PORT = "port";
Y
yu yunfeng 已提交
44

Y
yu yunfeng 已提交
45 46 47
static const std::string CONFIG_ENGINE = "engine_config";
static const std::string CONFIG_NPROBE = "nprobe";

G
groot 已提交
48 49
class ServerConfig {
 public:
G
groot 已提交
50
    static ServerConfig &GetInstance();
G
groot 已提交
51 52 53 54

    ServerError LoadConfigFile(const std::string& config_filename);
    void PrintAll() const;

G
groot 已提交
55 56
    ConfigNode GetConfig(const std::string& name) const;
    ConfigNode& GetConfig(const std::string& name);
G
groot 已提交
57 58 59 60 61 62
};

}
}
}