ServerConfig.h 1.9 KB
Newer Older
G
groot 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/*******************************************************************************
 * 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"

#include <yaml-cpp/yaml.h>

namespace zilliz {
namespace vecwise {
namespace server {

static const std::string CONFIG_SERVER = "server_config";
G
groot 已提交
18 19 20 21
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";
static const std::string CONFIG_SERVER_MODE = "server_mode";
G
groot 已提交
22 23 24 25 26 27

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";
static const std::string CONFIG_DB_FLUSH_INTERVAL = "db_flush_interval";
static const std::string CONFIG_DB_IDMAPPER_MAX_FILE = "idmapper_max_open_file";
G
groot 已提交
28

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

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

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

Y
yu yunfeng 已提交
38 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";

G
groot 已提交
42 43
class ServerConfig {
 public:
G
groot 已提交
44
    static ServerConfig &GetInstance();
G
groot 已提交
45 46 47 48

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

G
groot 已提交
49 50
    ConfigNode GetConfig(const std::string& name) const;
    ConfigNode& GetConfig(const std::string& name);
G
groot 已提交
51 52 53 54 55 56
};

}
}
}