Loading cpp/src/config/ConfigMgr.cpp +6 −5 Original line number Diff line number Diff line Loading @@ -15,18 +15,19 @@ // specific language governing permissions and limitations // under the License. #include "ConfigMgr.h" #include "config/ConfigMgr.h" #include "YamlConfigMgr.h" namespace zilliz { namespace milvus { namespace server { ConfigMgr * ConfigMgr::GetInstance() { ConfigMgr * ConfigMgr::GetInstance() { static YamlConfigMgr mgr; return &mgr; } } } } } // namespace server } // namespace milvus } // namespace zilliz cpp/src/config/ConfigMgr.h +8 −6 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ #include "utils/Error.h" #include "ConfigNode.h" #include <string> namespace zilliz { namespace milvus { namespace server { Loading Loading @@ -50,6 +52,6 @@ class ConfigMgr { virtual ConfigNode &GetRootNode() = 0; }; } } } } // namespace server } // namespace milvus } // namespace zilliz cpp/src/config/ConfigNode.cpp +42 −38 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. #include "ConfigNode.h" #include "config/ConfigNode.h" #include "utils/Error.h" #include "utils/Log.h" Loading @@ -27,7 +27,8 @@ namespace zilliz { namespace milvus { namespace server { void ConfigNode::Combine(const ConfigNode& target) { void ConfigNode::Combine(const ConfigNode &target) { const std::map<std::string, std::string> &kv = target.GetConfig(); for (auto itr = kv.begin(); itr != kv.end(); ++itr) { config_[itr->first] = itr->second; Loading Loading @@ -115,9 +116,10 @@ ConfigNode::GetDoubleValue(const std::string ¶m_key, double default_val) con const std::map<std::string, std::string> & ConfigNode::GetConfig() const { return config_; }; } void ConfigNode::ClearConfig() { void ConfigNode::ClearConfig() { config_.clear(); } Loading Loading @@ -156,7 +158,8 @@ ConfigNode::GetChildren() const { return children_; } void ConfigNode::ClearChildren() { void ConfigNode::ClearChildren() { children_.clear(); } Loading @@ -182,7 +185,8 @@ ConfigNode::GetSequences() const { return sequences_; } void ConfigNode::ClearSequences() { void ConfigNode::ClearSequences() { sequences_.clear(); } Loading Loading @@ -228,6 +232,6 @@ ConfigNode::DumpString(const std::string &prefix) const { return str_buffer.str(); } } } } } // namespace server } // namespace milvus } // namespace zilliz cpp/src/config/ConfigNode.h +8 −8 Original line number Diff line number Diff line Loading @@ -70,6 +70,6 @@ class ConfigNode { std::map<std::string, std::vector<std::string> > sequences_; }; } } } } // namespace server } // namespace milvus } // namespace zilliz cpp/src/config/YamlConfigMgr.cpp +31 −26 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. #include "YamlConfigMgr.h" #include "config/YamlConfigMgr.h" #include "utils/Log.h" #include <sys/stat.h> Loading @@ -24,7 +24,8 @@ namespace zilliz { namespace milvus { namespace server { ErrorCode YamlConfigMgr::LoadConfigFile(const std::string &filename) { ErrorCode YamlConfigMgr::LoadConfigFile(const std::string &filename) { struct stat directoryStat; int statOK = stat(filename.c_str(), &directoryStat); if (statOK != 0) { Loading @@ -44,20 +45,24 @@ ErrorCode YamlConfigMgr::LoadConfigFile(const std::string &filename) { return SERVER_SUCCESS; } void YamlConfigMgr::Print() const { void YamlConfigMgr::Print() const { SERVER_LOG_INFO << "System config content:"; config_.PrintAll(); } std::string YamlConfigMgr::DumpString() const { std::string YamlConfigMgr::DumpString() const { return config_.DumpString(""); } const ConfigNode& YamlConfigMgr::GetRootNode() const { const ConfigNode & YamlConfigMgr::GetRootNode() const { return config_; } ConfigNode& YamlConfigMgr::GetRootNode() { ConfigNode & YamlConfigMgr::GetRootNode() { return config_; } Loading Loading @@ -116,6 +121,6 @@ YamlConfigMgr::LoadConfigNode(const YAML::Node& node, ConfigNode& config) { } } } } } } // namespace server } // namespace milvus } // namespace zilliz Loading
cpp/src/config/ConfigMgr.cpp +6 −5 Original line number Diff line number Diff line Loading @@ -15,18 +15,19 @@ // specific language governing permissions and limitations // under the License. #include "ConfigMgr.h" #include "config/ConfigMgr.h" #include "YamlConfigMgr.h" namespace zilliz { namespace milvus { namespace server { ConfigMgr * ConfigMgr::GetInstance() { ConfigMgr * ConfigMgr::GetInstance() { static YamlConfigMgr mgr; return &mgr; } } } } } // namespace server } // namespace milvus } // namespace zilliz
cpp/src/config/ConfigMgr.h +8 −6 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ #include "utils/Error.h" #include "ConfigNode.h" #include <string> namespace zilliz { namespace milvus { namespace server { Loading Loading @@ -50,6 +52,6 @@ class ConfigMgr { virtual ConfigNode &GetRootNode() = 0; }; } } } } // namespace server } // namespace milvus } // namespace zilliz
cpp/src/config/ConfigNode.cpp +42 −38 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. #include "ConfigNode.h" #include "config/ConfigNode.h" #include "utils/Error.h" #include "utils/Log.h" Loading @@ -27,7 +27,8 @@ namespace zilliz { namespace milvus { namespace server { void ConfigNode::Combine(const ConfigNode& target) { void ConfigNode::Combine(const ConfigNode &target) { const std::map<std::string, std::string> &kv = target.GetConfig(); for (auto itr = kv.begin(); itr != kv.end(); ++itr) { config_[itr->first] = itr->second; Loading Loading @@ -115,9 +116,10 @@ ConfigNode::GetDoubleValue(const std::string ¶m_key, double default_val) con const std::map<std::string, std::string> & ConfigNode::GetConfig() const { return config_; }; } void ConfigNode::ClearConfig() { void ConfigNode::ClearConfig() { config_.clear(); } Loading Loading @@ -156,7 +158,8 @@ ConfigNode::GetChildren() const { return children_; } void ConfigNode::ClearChildren() { void ConfigNode::ClearChildren() { children_.clear(); } Loading @@ -182,7 +185,8 @@ ConfigNode::GetSequences() const { return sequences_; } void ConfigNode::ClearSequences() { void ConfigNode::ClearSequences() { sequences_.clear(); } Loading Loading @@ -228,6 +232,6 @@ ConfigNode::DumpString(const std::string &prefix) const { return str_buffer.str(); } } } } } // namespace server } // namespace milvus } // namespace zilliz
cpp/src/config/ConfigNode.h +8 −8 Original line number Diff line number Diff line Loading @@ -70,6 +70,6 @@ class ConfigNode { std::map<std::string, std::vector<std::string> > sequences_; }; } } } } // namespace server } // namespace milvus } // namespace zilliz
cpp/src/config/YamlConfigMgr.cpp +31 −26 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. #include "YamlConfigMgr.h" #include "config/YamlConfigMgr.h" #include "utils/Log.h" #include <sys/stat.h> Loading @@ -24,7 +24,8 @@ namespace zilliz { namespace milvus { namespace server { ErrorCode YamlConfigMgr::LoadConfigFile(const std::string &filename) { ErrorCode YamlConfigMgr::LoadConfigFile(const std::string &filename) { struct stat directoryStat; int statOK = stat(filename.c_str(), &directoryStat); if (statOK != 0) { Loading @@ -44,20 +45,24 @@ ErrorCode YamlConfigMgr::LoadConfigFile(const std::string &filename) { return SERVER_SUCCESS; } void YamlConfigMgr::Print() const { void YamlConfigMgr::Print() const { SERVER_LOG_INFO << "System config content:"; config_.PrintAll(); } std::string YamlConfigMgr::DumpString() const { std::string YamlConfigMgr::DumpString() const { return config_.DumpString(""); } const ConfigNode& YamlConfigMgr::GetRootNode() const { const ConfigNode & YamlConfigMgr::GetRootNode() const { return config_; } ConfigNode& YamlConfigMgr::GetRootNode() { ConfigNode & YamlConfigMgr::GetRootNode() { return config_; } Loading Loading @@ -116,6 +121,6 @@ YamlConfigMgr::LoadConfigNode(const YAML::Node& node, ConfigNode& config) { } } } } } } // namespace server } // namespace milvus } // namespace zilliz