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

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

#include <yaml-cpp/yaml.h>

namespace zilliz {
J
jinhai 已提交
15
namespace milvus {
G
groot 已提交
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
namespace server {

class YamlConfigMgr : public IConfigMgr {
 public:
    virtual ServerError LoadConfigFile(const std::string &filename);
    virtual void Print() const;
    virtual std::string DumpString() const;

    virtual const ConfigNode& GetRootNode() const;
    virtual ConfigNode& GetRootNode();

 private:
    bool SetConfigValue(const YAML::Node& node,
                        const std::string& key,
                        ConfigNode& config);

    bool SetChildConfig(const YAML::Node& node,
                        const std::string &name,
                        ConfigNode &config);

G
groot 已提交
36 37 38 39
//    bool
//    SetSequence(const YAML::Node &node,
//                const std::string &child_name,
//                ConfigNode &config);
G
groot 已提交
40 41 42 43 44 45 46 47 48 49 50 51 52

    void LoadConfigNode(const YAML::Node& node, ConfigNode& config);

 private:
    YAML::Node node_;
    ConfigNode config_;
};

}
}
}