diff --git a/cpp/src/cache/CpuCacheMgr.cpp b/cpp/src/cache/CpuCacheMgr.cpp index 7141394fa1..9a69bf599f 100644 --- a/cpp/src/cache/CpuCacheMgr.cpp +++ b/cpp/src/cache/CpuCacheMgr.cpp @@ -17,7 +17,7 @@ #include "CpuCacheMgr.h" -#include "server/ServerConfig.h" +#include "server/Config.h" #include "utils/Log.h" namespace zilliz { @@ -29,7 +29,7 @@ namespace { } CpuCacheMgr::CpuCacheMgr() { - server::ServerConfig& config = server::ServerConfig::GetInstance(); + server::Config& config = server::Config::GetInstance(); int64_t cap = config.GetCacheConfigCpuMemCapacity() * unit; cache_ = std::make_shared>(cap, 1UL<<32); diff --git a/cpp/src/cache/GpuCacheMgr.cpp b/cpp/src/cache/GpuCacheMgr.cpp index ba5665f5f2..bc6c3e13db 100644 --- a/cpp/src/cache/GpuCacheMgr.cpp +++ b/cpp/src/cache/GpuCacheMgr.cpp @@ -19,7 +19,7 @@ #include #include "utils/Log.h" #include "GpuCacheMgr.h" -#include "server/ServerConfig.h" +#include "server/Config.h" namespace zilliz { namespace milvus { @@ -33,7 +33,7 @@ namespace { } GpuCacheMgr::GpuCacheMgr() { - server::ServerConfig& config = server::ServerConfig::GetInstance(); + server::Config& config = server::Config::GetInstance(); int32_t cap = config.GetCacheConfigGpuMemCapacity() * G_BYTE; cache_ = std::make_shared>(cap, 1UL<<32); diff --git a/cpp/src/db/engine/ExecutionEngineImpl.cpp b/cpp/src/db/engine/ExecutionEngineImpl.cpp index 960f3baa89..742d21a0be 100644 --- a/cpp/src/db/engine/ExecutionEngineImpl.cpp +++ b/cpp/src/db/engine/ExecutionEngineImpl.cpp @@ -26,6 +26,7 @@ #include "src/wrapper/vec_index.h" #include "src/wrapper/vec_impl.h" #include "knowhere/common/Exception.h" +#include "server/Config.h" #include @@ -334,7 +335,7 @@ Status ExecutionEngineImpl::GpuCache(uint64_t gpu_id) { // TODO(linxj): remove. Status ExecutionEngineImpl::Init() { using namespace zilliz::milvus::server; - ServerConfig &config = ServerConfig::GetInstance(); + server::Config &config = server::Config::GetInstance(); gpu_num_ = config.GetDBConfigBuildIndexGPU(); return Status::OK(); diff --git a/cpp/src/metrics/MetricBase.h b/cpp/src/metrics/MetricBase.h index aa181fb3f3..8a3f11d7df 100644 --- a/cpp/src/metrics/MetricBase.h +++ b/cpp/src/metrics/MetricBase.h @@ -19,7 +19,6 @@ #pragma once #include "utils/Error.h" -#include "server/ServerConfig.h" #include "SystemInfo.h" namespace zilliz { @@ -83,11 +82,6 @@ class MetricsBase{ virtual void CPUTemperature() {}; }; - - - - - } } } \ No newline at end of file diff --git a/cpp/src/metrics/Metrics.cpp b/cpp/src/metrics/Metrics.cpp index 59eaea6355..6c6df56b17 100644 --- a/cpp/src/metrics/Metrics.cpp +++ b/cpp/src/metrics/Metrics.cpp @@ -16,7 +16,7 @@ // under the License. #include "Metrics.h" -#include "server/ServerConfig.h" +#include "server/Config.h" #include "PrometheusMetrics.h" @@ -32,7 +32,7 @@ Metrics::GetInstance() { MetricsBase & Metrics::CreateMetricsCollector() { - ServerConfig &config = ServerConfig::GetInstance(); + Config &config = Config::GetInstance(); std::string collector_type_str = config.GetMetricConfigCollector(); if (collector_type_str == "prometheus") { diff --git a/cpp/src/metrics/PrometheusMetrics.cpp b/cpp/src/metrics/PrometheusMetrics.cpp index b07e91ea32..14d2de6732 100644 --- a/cpp/src/metrics/PrometheusMetrics.cpp +++ b/cpp/src/metrics/PrometheusMetrics.cpp @@ -16,8 +16,9 @@ // under the License. -#include +#include "cache/GpuCacheMgr.h" #include "PrometheusMetrics.h" +#include "server/Config.h" #include "utils/Log.h" #include "SystemInfo.h" @@ -29,7 +30,7 @@ namespace server { ErrorCode PrometheusMetrics::Init() { try { - ServerConfig &config = ServerConfig::GetInstance(); + Config &config = Config::GetInstance(); startup_ = config.GetMetricConfigAutoBootup(); if (!startup_) return SERVER_SUCCESS; diff --git a/cpp/src/metrics/PrometheusMetrics.h b/cpp/src/metrics/PrometheusMetrics.h index 5a3379305a..4ee6699b77 100644 --- a/cpp/src/metrics/PrometheusMetrics.h +++ b/cpp/src/metrics/PrometheusMetrics.h @@ -17,15 +17,13 @@ #pragma once -#include "utils/Error.h" #include #include - - #include #include #include -#include "server/ServerConfig.h" + +#include "utils/Error.h" #include "MetricBase.h" @@ -38,10 +36,6 @@ namespace zilliz { namespace milvus { namespace server { - - - - class PrometheusMetrics: public MetricsBase { public: @@ -107,11 +101,6 @@ class PrometheusMetrics: public MetricsBase { void GPUTemperature() override; void CPUTemperature() override; - - - - - std::shared_ptr &exposer_ptr() {return exposer_ptr_; } // prometheus::Exposer& exposer() { return exposer_;} std::shared_ptr ®istry_ptr() {return registry_; } @@ -125,8 +114,6 @@ class PrometheusMetrics: public MetricsBase { // .Register(*registry_); // prometheus::Counter &connection_total_ = connect_request_.Add({}); - - ////all from DBImpl.cpp using BucketBoundaries = std::vector; //record add_group request @@ -472,10 +459,8 @@ class PrometheusMetrics: public MetricsBase { .Name("CPU_temperature") .Help("CPU temperature") .Register(*registry_); - }; - } } } diff --git a/cpp/src/scheduler/SchedInst.cpp b/cpp/src/scheduler/SchedInst.cpp index 54b870100a..5c4ec522da 100644 --- a/cpp/src/scheduler/SchedInst.cpp +++ b/cpp/src/scheduler/SchedInst.cpp @@ -17,7 +17,7 @@ #include "SchedInst.h" -#include "server/ServerConfig.h" +#include "server/Config.h" #include "ResourceFactory.h" #include "knowhere/index/vector_index/IndexGPUIVF.h" #include "Utils.h" @@ -38,7 +38,7 @@ std::mutex JobMgrInst::mutex_; void load_simple_config() { - server::ServerConfig &config = server::ServerConfig::GetInstance(); + server::Config &config = server::Config::GetInstance(); auto mode = config.GetResourceConfigMode(); auto pool = config.GetResourceConfigPool(); bool cpu = false; @@ -81,7 +81,7 @@ load_simple_config() { void load_advance_config() { // try { -// server::ConfigNode &config = server::ServerConfig::GetInstance().GetConfig(server::CONFIG_RESOURCE); +// server::ConfigNode &config = server::Config::GetInstance().GetConfig(server::CONFIG_RESOURCE); // // if (config.GetChildren().empty()) throw "resource_config null exception"; // diff --git a/cpp/src/server/ServerConfig.cpp b/cpp/src/server/Config.cpp similarity index 94% rename from cpp/src/server/ServerConfig.cpp rename to cpp/src/server/Config.cpp index 35012192e8..9f4f456452 100644 --- a/cpp/src/server/ServerConfig.cpp +++ b/cpp/src/server/Config.cpp @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "ServerConfig.h" +#include "Config.h" #include #include @@ -35,14 +35,14 @@ namespace server { constexpr uint64_t MB = 1024 * 1024; constexpr uint64_t GB = MB * 1024; -ServerConfig & -ServerConfig::GetInstance() { - static ServerConfig config; - return config; +Config & +Config::GetInstance() { + static Config config_inst; + return config_inst; } Status -ServerConfig::LoadConfigFile(const std::string &filename) { +Config::LoadConfigFile(const std::string &filename) { if (filename.empty()) { std::cerr << "ERROR: need specify config file" << std::endl; exit(1); @@ -71,7 +71,7 @@ ServerConfig::LoadConfigFile(const std::string &filename) { } Status -ServerConfig::ValidateConfig() { +Config::ValidateConfig() { if (!CheckServerConfig().ok()) { return Status(SERVER_INVALID_ARGUMENT, "Server config validation check fail"); } @@ -94,7 +94,7 @@ ServerConfig::ValidateConfig() { } Status -ServerConfig::CheckServerConfig() { +Config::CheckServerConfig() { /* server_config: address: 0.0.0.0 # milvus server ip address (IPv4) @@ -154,7 +154,7 @@ ServerConfig::CheckServerConfig() { } Status -ServerConfig::CheckDBConfig() { +Config::CheckDBConfig() { /* db_config: db_path: @MILVUS_DB_PATH@ # milvus data storage path @@ -230,7 +230,7 @@ ServerConfig::CheckDBConfig() { } Status -ServerConfig::CheckMetricConfig() { +Config::CheckMetricConfig() { /* metric_config: is_startup: off # if monitoring start: on, off @@ -260,7 +260,7 @@ ServerConfig::CheckMetricConfig() { } Status -ServerConfig::CheckCacheConfig() { +Config::CheckCacheConfig() { /* cache_config: cpu_cache_capacity: 16 # how many memory are used as cache, unit: GB, range: 0 ~ less than total memory @@ -361,7 +361,7 @@ ServerConfig::CheckCacheConfig() { } Status -ServerConfig::CheckEngineConfig() { +Config::CheckEngineConfig() { /* engine_config: use_blas_threshold: 20 @@ -396,7 +396,7 @@ ServerConfig::CheckEngineConfig() { } Status -ServerConfig::CheckResourceConfig() { +Config::CheckResourceConfig() { /* resource_config: mode: simple @@ -406,7 +406,7 @@ ServerConfig::CheckResourceConfig() { - gpu100 */ bool okay = true; - server::ConfigNode &config = server::ServerConfig::GetInstance().GetConfig(server::CONFIG_RESOURCE); + server::ConfigNode &config = GetConfig(server::CONFIG_RESOURCE); auto mode = config.GetValue(CONFIG_RESOURCE_MODE, CONFIG_RESOURCE_MODE_DEFAULT); if (mode != "simple") { std::cerr << "ERROR: invalid resource config: mode is " << mode << std::endl; @@ -422,7 +422,7 @@ ServerConfig::CheckResourceConfig() { } //Status -//ServerConfig::CheckResourceConfig() { +//Config::CheckResourceConfig() { /* resource_config: # resource list, length: 0~N @@ -604,7 +604,7 @@ ServerConfig::CheckResourceConfig() { //} void -ServerConfig::PrintAll() const { +Config::PrintAll() const { if (const ConfigMgr *mgr = ConfigMgr::GetInstance()) { std::string str = mgr->DumpString(); // SERVER_LOG_INFO << "\n" << str; @@ -613,14 +613,14 @@ ServerConfig::PrintAll() const { } ConfigNode -ServerConfig::GetConfig(const std::string &name) const { +Config::GetConfig(const std::string &name) const { const ConfigMgr *mgr = ConfigMgr::GetInstance(); const ConfigNode &root_node = mgr->GetRootNode(); return root_node.GetChild(name); } ConfigNode & -ServerConfig::GetConfig(const std::string &name) { +Config::GetConfig(const std::string &name) { ConfigMgr *mgr = ConfigMgr::GetInstance(); ConfigNode &root_node = mgr->GetRootNode(); return root_node.GetChild(name); @@ -628,28 +628,28 @@ ServerConfig::GetConfig(const std::string &name) { /* server config */ std::string -ServerConfig::GetServerConfigAddress() { +Config::GetServerConfigAddress() { ConfigNode server_config = GetConfig(CONFIG_SERVER); return server_config.GetValue(CONFIG_SERVER_ADDRESS, CONFIG_SERVER_ADDRESS_DEFAULT); } std::string -ServerConfig::GetServerConfigPort() { +Config::GetServerConfigPort() { ConfigNode server_config = GetConfig(CONFIG_SERVER); return server_config.GetValue(CONFIG_SERVER_PORT, CONFIG_SERVER_PORT_DEFAULT); } std::string -ServerConfig::GetServerConfigMode() { +Config::GetServerConfigMode() { ConfigNode server_config = GetConfig(CONFIG_SERVER); return server_config.GetValue(CONFIG_SERVER_MODE, CONFIG_SERVER_MODE_DEFAULT); } std::string -ServerConfig::GetServerConfigTimeZone() { +Config::GetServerConfigTimeZone() { ConfigNode server_config = GetConfig(CONFIG_SERVER); return server_config.GetValue(CONFIG_SERVER_TIME_ZONE, CONFIG_SERVER_TIME_ZONE_DEFAULT); @@ -657,49 +657,49 @@ ServerConfig::GetServerConfigTimeZone() { /* db config */ std::string -ServerConfig::GetDBConfigPath() { +Config::GetDBConfigPath() { ConfigNode db_config = GetConfig(CONFIG_DB); return db_config.GetValue(CONFIG_DB_PATH, CONFIG_DB_PATH_DEFAULT); } std::string -ServerConfig::GetDBConfigSlavePath() { +Config::GetDBConfigSlavePath() { ConfigNode db_config = GetConfig(CONFIG_DB); return db_config.GetValue(CONFIG_DB_SLAVE_PATH, CONFIG_DB_SLAVE_PATH_DEFAULT); } std::string -ServerConfig::GetDBConfigBackendUrl() { +Config::GetDBConfigBackendUrl() { ConfigNode db_config = GetConfig(CONFIG_DB); return db_config.GetValue(CONFIG_DB_BACKEND_URL, CONFIG_DB_BACKEND_URL_DEFAULT); } int32_t -ServerConfig::GetDBConfigArchiveDiskThreshold() { +Config::GetDBConfigArchiveDiskThreshold() { ConfigNode db_config = GetConfig(CONFIG_DB); return db_config.GetInt32Value(CONFIG_DB_ARCHIVE_DISK_THRESHOLD, std::stoi(CONFIG_DB_ARCHIVE_DISK_THRESHOLD_DEFAULT)); } int32_t -ServerConfig::GetDBConfigArchiveDaysThreshold() { +Config::GetDBConfigArchiveDaysThreshold() { ConfigNode db_config = GetConfig(CONFIG_DB); return db_config.GetInt32Value(CONFIG_DB_ARCHIVE_DAYS_THRESHOLD, std::stoi(CONFIG_DB_ARCHIVE_DAYS_THRESHOLD_DEFAULT)); } int32_t -ServerConfig::GetDBConfigBufferSize() { +Config::GetDBConfigBufferSize() { ConfigNode db_config = GetConfig(CONFIG_DB); return db_config.GetInt32Value(CONFIG_DB_BUFFER_SIZE, std::stoi(CONFIG_DB_BUFFER_SIZE_DEFAULT)); } int32_t -ServerConfig::GetDBConfigBuildIndexGPU() { +Config::GetDBConfigBuildIndexGPU() { ConfigNode db_config = GetConfig(CONFIG_DB); return db_config.GetInt32Value(CONFIG_DB_BUILD_INDEX_GPU, std::stoi(CONFIG_DB_BUILD_INDEX_GPU_DEFAULT)); @@ -707,21 +707,21 @@ ServerConfig::GetDBConfigBuildIndexGPU() { /* metric config */ bool -ServerConfig::GetMetricConfigAutoBootup() { +Config::GetMetricConfigAutoBootup() { ConfigNode metric_config = GetConfig(CONFIG_METRIC); return metric_config.GetBoolValue(CONFIG_METRIC_AUTO_BOOTUP, std::stoi(CONFIG_METRIC_AUTO_BOOTUP_DEFAULT)); } std::string -ServerConfig::GetMetricConfigCollector() { +Config::GetMetricConfigCollector() { ConfigNode metric_config = GetConfig(CONFIG_METRIC); return metric_config.GetValue(CONFIG_METRIC_COLLECTOR, CONFIG_METRIC_COLLECTOR_DEFAULT); } std::string -ServerConfig::GetMetricConfigPrometheusPort() { +Config::GetMetricConfigPrometheusPort() { ConfigNode metric_config = GetConfig(CONFIG_METRIC); return metric_config.GetValue(CONFIG_METRIC_PROMETHEUS_PORT, CONFIG_METRIC_PROMETHEUS_PORT_DEFAULT); @@ -729,35 +729,35 @@ ServerConfig::GetMetricConfigPrometheusPort() { /* cache config */ int32_t -ServerConfig::GetCacheConfigCpuMemCapacity() { +Config::GetCacheConfigCpuMemCapacity() { ConfigNode cache_config = GetConfig(CONFIG_CACHE); return cache_config.GetInt32Value(CONFIG_CACHE_CPU_MEM_CAPACITY, std::stoi(CONFIG_CACHE_CPU_MEM_CAPACITY_DEFAULT)); } float -ServerConfig::GetCacheConfigCpuMemThreshold() { +Config::GetCacheConfigCpuMemThreshold() { ConfigNode cache_config = GetConfig(CONFIG_CACHE); return cache_config.GetFloatValue(CONFIG_CACHE_CPU_MEM_THRESHOLD, std::stof(CONFIG_CACHE_CPU_MEM_THRESHOLD_DEFAULT)); } int32_t -ServerConfig::GetCacheConfigGpuMemCapacity() { +Config::GetCacheConfigGpuMemCapacity() { ConfigNode cache_config = GetConfig(CONFIG_CACHE); return cache_config.GetInt32Value(CONFIG_CACHE_GPU_MEM_CAPACITY, std::stoi(CONFIG_CACHE_GPU_MEM_CAPACITY_DEFAULT)); } float -ServerConfig::GetCacheConfigGpuMemThreshold() { +Config::GetCacheConfigGpuMemThreshold() { ConfigNode cache_config = GetConfig(CONFIG_CACHE); return cache_config.GetFloatValue(CONFIG_CACHE_GPU_MEM_THRESHOLD, std::stof(CONFIG_CACHE_GPU_MEM_THRESHOLD_DEFAULT)); } bool -ServerConfig::GetCacheConfigCacheInsertData() { +Config::GetCacheConfigCacheInsertData() { ConfigNode cache_config = GetConfig(CONFIG_CACHE); return cache_config.GetBoolValue(CONFIG_CACHE_CACHE_INSERT_DATA, std::stoi(CONFIG_CACHE_CACHE_INSERT_DATA_DEFAULT)); @@ -765,14 +765,14 @@ ServerConfig::GetCacheConfigCacheInsertData() { /* engine config */ int32_t -ServerConfig::GetEngineConfigBlasThreshold() { +Config::GetEngineConfigBlasThreshold() { ConfigNode engine_config = GetConfig(CONFIG_ENGINE); return engine_config.GetInt32Value(CONFIG_ENGINE_BLAS_THRESHOLD, std::stoi(CONFIG_ENGINE_BLAS_THRESHOLD_DEFAULT)); } int32_t -ServerConfig::GetEngineConfigOmpThreadNum() { +Config::GetEngineConfigOmpThreadNum() { ConfigNode engine_config = GetConfig(CONFIG_ENGINE); return engine_config.GetInt32Value(CONFIG_ENGINE_OMP_THREAD_NUM, std::stoi(CONFIG_ENGINE_OMP_THREAD_NUM_DEFAULT)); @@ -780,14 +780,14 @@ ServerConfig::GetEngineConfigOmpThreadNum() { /* resource config */ std::string -ServerConfig::GetResourceConfigMode() { +Config::GetResourceConfigMode() { ConfigNode resource_config = GetConfig(CONFIG_RESOURCE); return resource_config.GetValue(CONFIG_RESOURCE_MODE, CONFIG_RESOURCE_MODE_DEFAULT); } std::vector -ServerConfig::GetResourceConfigPool() { +Config::GetResourceConfigPool() { ConfigNode resource_config = GetConfig(CONFIG_RESOURCE); return resource_config.GetSequence(CONFIG_RESOURCE_POOL); } diff --git a/cpp/src/server/ServerConfig.h b/cpp/src/server/Config.h similarity index 98% rename from cpp/src/server/ServerConfig.h rename to cpp/src/server/Config.h index 1453adde49..2ad4c382cc 100644 --- a/cpp/src/server/ServerConfig.h +++ b/cpp/src/server/Config.h @@ -91,9 +91,9 @@ static const char* CONFIG_RESOURCE_MODE_DEFAULT = "simple"; static const char* CONFIG_RESOURCE_POOL = "pool"; -class ServerConfig { +class Config { public: - static ServerConfig &GetInstance(); + static Config &GetInstance(); Status LoadConfigFile(const std::string& filename); Status ValidateConfig(); diff --git a/cpp/src/server/DBWrapper.cpp b/cpp/src/server/DBWrapper.cpp index 3d958b15a4..bc0b080625 100644 --- a/cpp/src/server/DBWrapper.cpp +++ b/cpp/src/server/DBWrapper.cpp @@ -17,7 +17,7 @@ #include "DBWrapper.h" -#include "ServerConfig.h" +#include "Config.h" #include "db/DBFactory.h" #include "utils/CommonUtil.h" #include "utils/Log.h" @@ -35,7 +35,7 @@ DBWrapper::DBWrapper() { } Status DBWrapper::StartService() { - ServerConfig& config = ServerConfig::GetInstance(); + Config& config = Config::GetInstance(); //db config engine::DBOptions opt; diff --git a/cpp/src/server/Server.cpp b/cpp/src/server/Server.cpp index d8924e9d7d..7ca0b2a7c9 100644 --- a/cpp/src/server/Server.cpp +++ b/cpp/src/server/Server.cpp @@ -16,14 +16,6 @@ // under the License. #include -#include "Server.h" -#include "server/grpc_impl/GrpcServer.h" -#include "utils/Log.h" -#include "utils/LogUtil.h" -#include "utils/SignalUtil.h" -#include "utils/TimeRecorder.h" -#include "metrics/Metrics.h" - #include #include #include @@ -31,10 +23,17 @@ //#include #include #include -#include -#include "src/wrapper/KnowhereResource.h" +#include "Server.h" +#include "server/grpc_impl/GrpcServer.h" +#include "server/Config.h" +#include "utils/Log.h" +#include "utils/LogUtil.h" +#include "utils/SignalUtil.h" +#include "utils/TimeRecorder.h" #include "metrics/Metrics.h" +#include "scheduler/SchedInst.h" +#include "wrapper/KnowhereResource.h" #include "DBWrapper.h" @@ -161,7 +160,7 @@ Server::Start() { } /* log path is defined in Config file, so InitLog must be called after LoadConfig */ - ServerConfig &config = ServerConfig::GetInstance(); + Config &config = Config::GetInstance(); std::string time_zone = config.GetServerConfigTimeZone(); if (time_zone.length() == 3) { time_zone = "CUT"; @@ -230,7 +229,7 @@ Server::Stop() { ErrorCode Server::LoadConfig() { - ServerConfig& server_config = ServerConfig::GetInstance(); + Config& server_config = Config::GetInstance(); server_config.LoadConfigFile(config_filename_); auto status = server_config.ValidateConfig(); if (!status.ok()) { diff --git a/cpp/src/server/grpc_impl/GrpcRequestTask.cpp b/cpp/src/server/grpc_impl/GrpcRequestTask.cpp index ad0abd713d..e699dd04b7 100644 --- a/cpp/src/server/grpc_impl/GrpcRequestTask.cpp +++ b/cpp/src/server/grpc_impl/GrpcRequestTask.cpp @@ -15,8 +15,9 @@ // specific language governing permissions and limitations // under the License. +#include + #include "GrpcRequestTask.h" -#include "../ServerConfig.h" #include "utils/CommonUtil.h" #include "utils/Log.h" #include "utils/TimeRecorder.h" @@ -28,9 +29,8 @@ #include "scheduler/SchedInst.h" //#include -#include "src/server/Server.h" +#include "server/Server.h" -#include namespace zilliz { namespace milvus { diff --git a/cpp/src/server/grpc_impl/GrpcServer.cpp b/cpp/src/server/grpc_impl/GrpcServer.cpp index e330f5483c..c10d7b5379 100644 --- a/cpp/src/server/grpc_impl/GrpcServer.cpp +++ b/cpp/src/server/grpc_impl/GrpcServer.cpp @@ -17,7 +17,7 @@ #include "milvus.grpc.pb.h" #include "GrpcServer.h" -#include "server/ServerConfig.h" +#include "server/Config.h" #include "server/DBWrapper.h" #include "utils/Log.h" #include "GrpcRequestHandler.h" @@ -73,7 +73,7 @@ GrpcServer::Stop() { Status GrpcServer::StartService() { - ServerConfig &config = ServerConfig::GetInstance(); + Config &config = Config::GetInstance(); std::string address = config.GetServerConfigAddress(); std::string port = config.GetServerConfigPort(); diff --git a/cpp/src/utils/LogUtil.cpp b/cpp/src/utils/LogUtil.cpp index cfdbbdc768..3a3fe0c7e2 100644 --- a/cpp/src/utils/LogUtil.cpp +++ b/cpp/src/utils/LogUtil.cpp @@ -15,13 +15,11 @@ // specific language governing permissions and limitations // under the License. -#include "LogUtil.h" -#include "server/ServerConfig.h" - #include #include #include +#include "LogUtil.h" namespace zilliz { namespace milvus { diff --git a/cpp/src/wrapper/KnowhereResource.cpp b/cpp/src/wrapper/KnowhereResource.cpp index dfd75df253..1e4248f6e1 100644 --- a/cpp/src/wrapper/KnowhereResource.cpp +++ b/cpp/src/wrapper/KnowhereResource.cpp @@ -18,7 +18,7 @@ #include "KnowhereResource.h" #include "knowhere/index/vector_index/helpers/FaissGpuResourceMgr.h" -#include "server/ServerConfig.h" +#include "server/Config.h" #include @@ -38,7 +38,7 @@ ErrorCode KnowhereResource::Initialize() { GpuResourcesArray gpu_resources; //get build index gpu resource - server::ServerConfig& config = server::ServerConfig::GetInstance(); + server::Config& config = server::Config::GetInstance(); int32_t build_index_gpu = config.GetDBConfigBuildIndexGPU(); gpu_resources.insert(std::make_pair(build_index_gpu, GpuResourceSetting())); diff --git a/cpp/unittest/db/engine_test.cpp b/cpp/unittest/db/engine_test.cpp index e06e9038c8..f55d8d9e27 100644 --- a/cpp/unittest/db/engine_test.cpp +++ b/cpp/unittest/db/engine_test.cpp @@ -21,7 +21,6 @@ #include "db/engine/EngineFactory.h" #include "db/engine/ExecutionEngineImpl.h" -#include "server/ServerConfig.h" #include "utils.h" using namespace zilliz::milvus; diff --git a/cpp/unittest/db/search_test.cpp b/cpp/unittest/db/search_test.cpp index 295650f2d2..d492256534 100644 --- a/cpp/unittest/db/search_test.cpp +++ b/cpp/unittest/db/search_test.cpp @@ -15,13 +15,12 @@ // specific language governing permissions and limitations // under the License. -#include "server/ServerConfig.h" -#include "utils/TimeRecorder.h" - #include #include #include -#include + +#include "scheduler/task/SearchTask.h" +#include "utils/TimeRecorder.h" using namespace zilliz::milvus; diff --git a/cpp/unittest/main.cpp b/cpp/unittest/main.cpp index 33a860945d..7a28bbf45f 100644 --- a/cpp/unittest/main.cpp +++ b/cpp/unittest/main.cpp @@ -15,13 +15,12 @@ // specific language governing permissions and limitations // under the License. -#include "utils/easylogging++.h" -#include "server/ServerConfig.h" -#include "utils/CommonUtil.h" - #include #include +#include "utils/easylogging++.h" +#include "utils/CommonUtil.h" + INITIALIZE_EASYLOGGINGPP using namespace zilliz::milvus; diff --git a/cpp/unittest/scheduler/schedinst_test.cpp b/cpp/unittest/scheduler/schedinst_test.cpp index 27b6a17bbb..cb56264525 100644 --- a/cpp/unittest/scheduler/schedinst_test.cpp +++ b/cpp/unittest/scheduler/schedinst_test.cpp @@ -15,12 +15,10 @@ // specific language governing permissions and limitations // under the License. - -#include "scheduler/SchedInst.h" -#include "server/ServerConfig.h" #include #include +#include "scheduler/SchedInst.h" namespace zilliz { namespace milvus { diff --git a/cpp/unittest/scheduler/scheduler_test.cpp b/cpp/unittest/scheduler/scheduler_test.cpp index 1cfbda1e14..b8899ebdc2 100644 --- a/cpp/unittest/scheduler/scheduler_test.cpp +++ b/cpp/unittest/scheduler/scheduler_test.cpp @@ -15,17 +15,16 @@ // specific language governing permissions and limitations // under the License. -#include "scheduler/Scheduler.h" #include -#include -#include +#include "scheduler/tasklabel/DefaultLabel.h" #include "cache/DataObj.h" #include "cache/GpuCacheMgr.h" +#include "scheduler/Scheduler.h" #include "scheduler/task/TestTask.h" #include "scheduler/ResourceFactory.h" #include "scheduler/resource/Resource.h" #include "utils/Error.h" -#include "src/wrapper/vec_index.h" +#include "wrapper/vec_index.h" #include "scheduler/tasklabel/SpecResLabel.h" diff --git a/cpp/unittest/server/cache_test.cpp b/cpp/unittest/server/cache_test.cpp index bf9b6edf7d..94eae5dbf0 100644 --- a/cpp/unittest/server/cache_test.cpp +++ b/cpp/unittest/server/cache_test.cpp @@ -18,10 +18,8 @@ #include #include "cache/CpuCacheMgr.h" #include "cache/GpuCacheMgr.h" -#include "server/ServerConfig.h" - #include "utils/Error.h" -#include "src/wrapper/vec_index.h" +#include "wrapper/vec_index.h" using namespace zilliz::milvus; diff --git a/cpp/unittest/server/config_test.cpp b/cpp/unittest/server/config_test.cpp index 13089e914b..65ce562722 100644 --- a/cpp/unittest/server/config_test.cpp +++ b/cpp/unittest/server/config_test.cpp @@ -19,7 +19,6 @@ #include #include "config/ConfigMgr.h" -#include "server/ServerConfig.h" #include "utils/CommonUtil.h" #include "utils/ValidationUtil.h" diff --git a/cpp/unittest/server/rpc_test.cpp b/cpp/unittest/server/rpc_test.cpp index 5ad6005a36..c196c082e5 100644 --- a/cpp/unittest/server/rpc_test.cpp +++ b/cpp/unittest/server/rpc_test.cpp @@ -29,7 +29,6 @@ #include "grpc/gen-status/status.pb.h" #include "server/DBWrapper.h" -#include "server/ServerConfig.h" #include "scheduler/SchedInst.h" #include "scheduler/ResourceFactory.h" #include "utils/CommonUtil.h"