// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. #pragma once #include "utils/Status.h" #include "config/ConfigNode.h" #include "yaml-cpp/yaml.h" namespace zilliz { namespace milvus { namespace server { static const char* CONFIG_SERVER = "server_config"; static const char* CONFIG_SERVER_ADDRESS = "address"; static const char* CONFIG_SERVER_PORT = "port"; static const char* CONFIG_CLUSTER_MODE = "mode"; static const char* CONFIG_TIME_ZONE = "time_zone"; static const char* CONFIG_DB = "db_config"; static const char* CONFIG_DB_URL = "db_backend_url"; static const char* CONFIG_DB_PATH = "db_path"; static const char* CONFIG_DB_SLAVE_PATH = "db_slave_path"; static const char* CONFIG_DB_ARCHIVE_DISK = "archive_disk_threshold"; static const char* CONFIG_DB_ARCHIVE_DAYS = "archive_days_threshold"; static const char* CONFIG_DB_INSERT_BUFFER_SIZE = "insert_buffer_size"; static const char* CONFIG_DB_PARALLEL_REDUCE = "parallel_reduce"; static const char* CONFIG_DB_BUILD_INDEX_GPU = "build_index_gpu"; static const char* CONFIG_LOG = "log_config"; static const char* CONFIG_CACHE = "cache_config"; static const char* CONFIG_CPU_CACHE_CAPACITY = "cpu_cache_capacity"; static const char* CONFIG_GPU_CACHE_CAPACITY = "gpu_cache_capacity"; static const char* CACHE_FREE_PERCENT = "cpu_cache_free_percent"; static const char* CONFIG_INSERT_CACHE_IMMEDIATELY = "insert_cache_immediately"; static const char *GPU_CACHE_FREE_PERCENT = "gpu_cache_free_percent"; static const char* CONFIG_METRIC = "metric_config"; static const char* CONFIG_METRIC_IS_STARTUP = "is_startup"; static const char* CONFIG_METRIC_COLLECTOR = "collector"; static const char* CONFIG_PROMETHEUS = "prometheus_config"; static const char* CONFIG_METRIC_PROMETHEUS_PORT = "port"; static const char* CONFIG_ENGINE = "engine_config"; static const char* CONFIG_DCBT = "use_blas_threshold"; static const char* CONFIG_OMP_THREAD_NUM = "omp_thread_num"; static const char* CONFIG_RESOURCE = "resource_config"; static const char* CONFIG_RESOURCES = "resources"; static const char* CONFIG_RESOURCE_TYPE = "type"; static const char* CONFIG_RESOURCE_DEVICE_ID = "device_id"; static const char* CONFIG_RESOURCE_ENABLE_EXECUTOR = "enable_executor"; static const char* CONFIG_RESOURCE_NUM = "gpu_resource_num"; static const char* CONFIG_RESOURCE_PIN_MEMORY = "pinned_memory"; static const char* CONFIG_RESOURCE_TEMP_MEMORY = "temp_memory"; static const char* CONFIG_RESOURCE_CONNECTIONS = "connections"; static const char* CONFIG_SPEED_CONNECTIONS = "speed"; static const char* CONFIG_ENDPOINT_CONNECTIONS = "endpoint"; class ServerConfig { public: static ServerConfig &GetInstance(); Status LoadConfigFile(const std::string& config_filename); Status ValidateConfig(); void PrintAll() const; ConfigNode GetConfig(const std::string& name) const; ConfigNode& GetConfig(const std::string& name); private: Status CheckServerConfig(); Status CheckDBConfig(); Status CheckMetricConfig(); Status CheckCacheConfig(); Status CheckEngineConfig(); Status CheckResourceConfig(); }; } } }