Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
47b2b164
milvus
项目概览
BaiXuePrincess
/
milvus
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
47b2b164
编写于
10月 09, 2019
作者:
S
starlord
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine code
Former-commit-id: 96432d46a2797134363ae17529d86c5ad6bf148d
上级
588481d6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
40 addition
and
327 deletion
+40
-327
cpp/src/server/Config.cpp
cpp/src/server/Config.cpp
+39
-270
cpp/src/server/Config.h
cpp/src/server/Config.h
+1
-57
未找到文件。
cpp/src/server/Config.cpp
浏览文件 @
47b2b164
...
@@ -655,304 +655,62 @@ Config::SetConfigValueInMem(const std::string& parent_key, const std::string& ch
...
@@ -655,304 +655,62 @@ Config::SetConfigValueInMem(const std::string& parent_key, const std::string& ch
}
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/* server config */
std
::
string
Config
::
GetServerConfigStrAddress
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_SERVER
,
CONFIG_SERVER_ADDRESS
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_SERVER
).
GetValue
(
CONFIG_SERVER_ADDRESS
,
CONFIG_SERVER_ADDRESS_DEFAULT
);
SetConfigValueInMem
(
CONFIG_SERVER
,
CONFIG_SERVER_ADDRESS
,
value
);
}
return
value
;
}
std
::
string
Config
::
GetServerConfigStrPort
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_SERVER
,
CONFIG_SERVER_PORT
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_SERVER
).
GetValue
(
CONFIG_SERVER_PORT
,
CONFIG_SERVER_PORT_DEFAULT
);
SetConfigValueInMem
(
CONFIG_SERVER
,
CONFIG_SERVER_PORT
,
value
);
}
return
value
;
}
std
::
string
Config
::
GetServerConfigStrDeployMode
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_SERVER
,
CONFIG_SERVER_DEPLOY_MODE
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_SERVER
).
GetValue
(
CONFIG_SERVER_DEPLOY_MODE
,
CONFIG_SERVER_DEPLOY_MODE_DEFAULT
);
SetConfigValueInMem
(
CONFIG_SERVER
,
CONFIG_SERVER_DEPLOY_MODE
,
value
);
}
return
value
;
}
std
::
string
Config
::
GetServerConfigStrTimeZone
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_SERVER
,
CONFIG_SERVER_TIME_ZONE
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_SERVER
).
GetValue
(
CONFIG_SERVER_TIME_ZONE
,
CONFIG_SERVER_TIME_ZONE_DEFAULT
);
SetConfigValueInMem
(
CONFIG_SERVER
,
CONFIG_SERVER_TIME_ZONE
,
value
);
}
return
value
;
}
////////////////////////////////////////////////////////////////////////////////
/* db config */
std
::
string
Config
::
GetDBConfigStrPrimaryPath
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_DB
,
CONFIG_DB_PRIMARY_PATH
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_DB
).
GetValue
(
CONFIG_DB_PRIMARY_PATH
,
CONFIG_DB_PRIMARY_PATH_DEFAULT
);
SetConfigValueInMem
(
CONFIG_DB
,
CONFIG_DB_PRIMARY_PATH
,
value
);
}
return
value
;
}
std
::
string
Config
::
GetDBConfigStrSecondaryPath
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_DB
,
CONFIG_DB_SECONDARY_PATH
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_DB
).
GetValue
(
CONFIG_DB_SECONDARY_PATH
,
CONFIG_DB_SECONDARY_PATH_DEFAULT
);
SetConfigValueInMem
(
CONFIG_DB
,
CONFIG_DB_SECONDARY_PATH
,
value
);
}
return
value
;
}
std
::
string
Config
::
GetDBConfigStrBackendUrl
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_DB
,
CONFIG_DB_BACKEND_URL
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_DB
).
GetValue
(
CONFIG_DB_BACKEND_URL
,
CONFIG_DB_BACKEND_URL_DEFAULT
);
SetConfigValueInMem
(
CONFIG_DB
,
CONFIG_DB_BACKEND_URL
,
value
);
}
return
value
;
}
std
::
string
Config
::
GetDBConfigStrArchiveDiskThreshold
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_DB
,
CONFIG_DB_ARCHIVE_DISK_THRESHOLD
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_DB
).
GetValue
(
CONFIG_DB_ARCHIVE_DISK_THRESHOLD
,
CONFIG_DB_ARCHIVE_DISK_THRESHOLD_DEFAULT
);
SetConfigValueInMem
(
CONFIG_DB
,
CONFIG_DB_ARCHIVE_DISK_THRESHOLD
,
value
);
}
return
value
;
}
std
::
string
Config
::
GetDBConfigStrArchiveDaysThreshold
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_DB
,
CONFIG_DB_ARCHIVE_DAYS_THRESHOLD
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_DB
).
GetValue
(
CONFIG_DB_ARCHIVE_DAYS_THRESHOLD
,
CONFIG_DB_ARCHIVE_DAYS_THRESHOLD_DEFAULT
);
SetConfigValueInMem
(
CONFIG_DB
,
CONFIG_DB_ARCHIVE_DAYS_THRESHOLD
,
value
);
}
return
value
;
}
std
::
string
Config
::
GetDBConfigStrInsertBufferSize
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_DB
,
CONFIG_DB_INSERT_BUFFER_SIZE
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_DB
).
GetValue
(
CONFIG_DB_INSERT_BUFFER_SIZE
,
CONFIG_DB_INSERT_BUFFER_SIZE_DEFAULT
);
SetConfigValueInMem
(
CONFIG_DB
,
CONFIG_DB_INSERT_BUFFER_SIZE
,
value
);
}
return
value
;
}
std
::
string
Config
::
GetDBConfigStrBuildIndexGPU
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_DB
,
CONFIG_DB_BUILD_INDEX_GPU
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_DB
).
GetValue
(
CONFIG_DB_BUILD_INDEX_GPU
,
CONFIG_DB_BUILD_INDEX_GPU_DEFAULT
);
SetConfigValueInMem
(
CONFIG_DB
,
CONFIG_DB_BUILD_INDEX_GPU
,
value
);
}
return
value
;
}
std
::
string
Config
::
GetDBConfigStrPreloadTable
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_DB
,
CONFIG_DB_PRELOAD_TABLE
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_DB
).
GetValue
(
CONFIG_DB_PRELOAD_TABLE
);
SetConfigValueInMem
(
CONFIG_DB
,
CONFIG_DB_PRELOAD_TABLE
,
value
);
}
return
value
;
}
////////////////////////////////////////////////////////////////////////////////
/* metric config */
std
::
string
Config
::
GetMetricConfigStrEnableMonitor
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_METRIC
,
CONFIG_METRIC_ENABLE_MONITOR
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_METRIC
).
GetValue
(
CONFIG_METRIC_ENABLE_MONITOR
,
CONFIG_METRIC_ENABLE_MONITOR_DEFAULT
);
SetConfigValueInMem
(
CONFIG_METRIC
,
CONFIG_METRIC_ENABLE_MONITOR
,
value
);
}
return
value
;
}
std
::
string
Config
::
GetMetricConfigStrCollector
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_METRIC
,
CONFIG_METRIC_COLLECTOR
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_METRIC
).
GetValue
(
CONFIG_METRIC_COLLECTOR
,
CONFIG_METRIC_COLLECTOR_DEFAULT
);
SetConfigValueInMem
(
CONFIG_METRIC
,
CONFIG_METRIC_COLLECTOR
,
value
);
}
return
value
;
}
std
::
string
Config
::
GetMetricConfigStrPrometheusPort
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_METRIC
,
CONFIG_METRIC_PROMETHEUS_PORT
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_METRIC
).
GetValue
(
CONFIG_METRIC_PROMETHEUS_PORT
,
CONFIG_METRIC_PROMETHEUS_PORT_DEFAULT
);
SetConfigValueInMem
(
CONFIG_METRIC
,
CONFIG_METRIC_PROMETHEUS_PORT
,
value
);
}
return
value
;
}
////////////////////////////////////////////////////////////////////////////////
/* cache config */
std
::
string
Config
::
GetCacheConfigStrCpuCacheCapacity
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_CACHE
,
CONFIG_CACHE_CPU_CACHE_CAPACITY
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_CACHE
)
.
GetValue
(
CONFIG_CACHE_CPU_CACHE_CAPACITY
,
CONFIG_CACHE_CPU_CACHE_CAPACITY_DEFAULT
);
SetConfigValueInMem
(
CONFIG_CACHE
,
CONFIG_CACHE_CPU_CACHE_CAPACITY
,
value
);
}
return
value
;
}
std
::
string
Config
::
GetCacheConfigStrCpuCacheThreshold
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_CACHE
,
CONFIG_CACHE_CPU_CACHE_THRESHOLD
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_CACHE
)
.
GetValue
(
CONFIG_CACHE_CPU_CACHE_THRESHOLD
,
CONFIG_CACHE_CPU_CACHE_THRESHOLD_DEFAULT
);
SetConfigValueInMem
(
CONFIG_CACHE
,
CONFIG_CACHE_CPU_CACHE_THRESHOLD
,
value
);
}
return
value
;
}
std
::
string
Config
::
GetCacheConfigStrGpuCacheCapacity
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_CACHE
,
CONFIG_CACHE_GPU_CACHE_CAPACITY
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_CACHE
)
.
GetValue
(
CONFIG_CACHE_GPU_CACHE_CAPACITY
,
CONFIG_CACHE_GPU_CACHE_CAPACITY_DEFAULT
);
SetConfigValueInMem
(
CONFIG_CACHE
,
CONFIG_CACHE_GPU_CACHE_CAPACITY
,
value
);
}
return
value
;
}
std
::
string
Config
::
GetCacheConfigStrGpuCacheThreshold
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_CACHE
,
CONFIG_CACHE_GPU_CACHE_THRESHOLD
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_CACHE
)
.
GetValue
(
CONFIG_CACHE_GPU_CACHE_THRESHOLD
,
CONFIG_CACHE_GPU_CACHE_THRESHOLD_DEFAULT
);
SetConfigValueInMem
(
CONFIG_CACHE
,
CONFIG_CACHE_GPU_CACHE_THRESHOLD
,
value
);
}
return
value
;
}
std
::
string
Config
::
GetCacheConfigStrCacheInsertData
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_CACHE
,
CONFIG_CACHE_CACHE_INSERT_DATA
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_CACHE
)
.
GetValue
(
CONFIG_CACHE_CACHE_INSERT_DATA
,
CONFIG_CACHE_CACHE_INSERT_DATA_DEFAULT
);
SetConfigValueInMem
(
CONFIG_CACHE
,
CONFIG_CACHE_CACHE_INSERT_DATA
,
value
);
}
return
value
;
}
////////////////////////////////////////////////////////////////////////////////
/* engine config */
std
::
string
Config
::
GetEngineConfigStrUseBlasThreshold
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_ENGINE
,
CONFIG_ENGINE_USE_BLAS_THRESHOLD
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_ENGINE
)
.
GetValue
(
CONFIG_ENGINE_USE_BLAS_THRESHOLD
,
CONFIG_ENGINE_USE_BLAS_THRESHOLD_DEFAULT
);
SetConfigValueInMem
(
CONFIG_ENGINE
,
CONFIG_ENGINE_USE_BLAS_THRESHOLD
,
value
);
}
return
value
;
}
std
::
string
std
::
string
Config
::
Get
EngineConfigStrOmpThreadNum
(
)
{
Config
::
Get
ConfigStr
(
const
std
::
string
&
parent_key
,
const
std
::
string
&
child_key
,
const
std
::
string
&
default_value
)
{
std
::
string
value
;
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_ENGINE
,
CONFIG_ENGINE_OMP_THREAD_NUM
,
value
).
ok
())
{
if
(
!
GetConfigValueInMem
(
parent_key
,
child_key
,
value
).
ok
())
{
value
=
value
=
GetConfigNode
(
parent_key
).
GetValue
(
child_key
,
default_value
);
GetConfigNode
(
CONFIG_ENGINE
).
GetValue
(
CONFIG_ENGINE_OMP_THREAD_NUM
,
CONFIG_ENGINE_OMP_THREAD_NUM_DEFAULT
);
SetConfigValueInMem
(
parent_key
,
child_key
,
value
);
SetConfigValueInMem
(
CONFIG_ENGINE
,
CONFIG_ENGINE_OMP_THREAD_NUM
,
value
);
}
}
return
value
;
return
value
;
}
}
////////////////////////////////////////////////////////////////////////////////
/* resource config */
std
::
string
Config
::
GetResourceConfigStrMode
()
{
std
::
string
value
;
if
(
!
GetConfigValueInMem
(
CONFIG_RESOURCE
,
CONFIG_RESOURCE_MODE
,
value
).
ok
())
{
value
=
GetConfigNode
(
CONFIG_RESOURCE
).
GetValue
(
CONFIG_RESOURCE_MODE
,
CONFIG_RESOURCE_MODE_DEFAULT
);
SetConfigValueInMem
(
CONFIG_RESOURCE
,
CONFIG_RESOURCE_MODE
,
value
);
}
return
value
;
}
////////////////////////////////////////////////////////////////////////////////
Status
Status
Config
::
GetServerConfigAddress
(
std
::
string
&
value
)
{
Config
::
GetServerConfigAddress
(
std
::
string
&
value
)
{
value
=
Get
ServerConfigStrAddress
(
);
value
=
Get
ConfigStr
(
CONFIG_SERVER
,
CONFIG_SERVER_ADDRESS
,
CONFIG_SERVER_ADDRESS_DEFAULT
);
return
CheckServerConfigAddress
(
value
);
return
CheckServerConfigAddress
(
value
);
}
}
Status
Status
Config
::
GetServerConfigPort
(
std
::
string
&
value
)
{
Config
::
GetServerConfigPort
(
std
::
string
&
value
)
{
value
=
Get
ServerConfigStrPort
(
);
value
=
Get
ConfigStr
(
CONFIG_SERVER
,
CONFIG_SERVER_PORT
,
CONFIG_SERVER_PORT_DEFAULT
);
return
CheckServerConfigPort
(
value
);
return
CheckServerConfigPort
(
value
);
}
}
Status
Status
Config
::
GetServerConfigDeployMode
(
std
::
string
&
value
)
{
Config
::
GetServerConfigDeployMode
(
std
::
string
&
value
)
{
value
=
Get
ServerConfigStrDeployMode
(
);
value
=
Get
ConfigStr
(
CONFIG_SERVER
,
CONFIG_SERVER_DEPLOY_MODE
,
CONFIG_SERVER_DEPLOY_MODE_DEFAULT
);
return
CheckServerConfigDeployMode
(
value
);
return
CheckServerConfigDeployMode
(
value
);
}
}
Status
Status
Config
::
GetServerConfigTimeZone
(
std
::
string
&
value
)
{
Config
::
GetServerConfigTimeZone
(
std
::
string
&
value
)
{
value
=
Get
ServerConfigStrTimeZone
(
);
value
=
Get
ConfigStr
(
CONFIG_SERVER
,
CONFIG_SERVER_TIME_ZONE
,
CONFIG_SERVER_TIME_ZONE_DEFAULT
);
return
CheckServerConfigTimeZone
(
value
);
return
CheckServerConfigTimeZone
(
value
);
}
}
Status
Status
Config
::
GetDBConfigPrimaryPath
(
std
::
string
&
value
)
{
Config
::
GetDBConfigPrimaryPath
(
std
::
string
&
value
)
{
value
=
Get
DBConfigStrPrimaryPath
(
);
value
=
Get
ConfigStr
(
CONFIG_DB
,
CONFIG_DB_PRIMARY_PATH
,
CONFIG_DB_PRIMARY_PATH_DEFAULT
);
return
CheckDBConfigPrimaryPath
(
value
);
return
CheckDBConfigPrimaryPath
(
value
);
}
}
Status
Status
Config
::
GetDBConfigSecondaryPath
(
std
::
string
&
value
)
{
Config
::
GetDBConfigSecondaryPath
(
std
::
string
&
value
)
{
value
=
Get
DBConfigStrSecondaryPath
(
);
value
=
Get
ConfigStr
(
CONFIG_DB
,
CONFIG_DB_SECONDARY_PATH
,
CONFIG_DB_SECONDARY_PATH_DEFAULT
);
return
Status
::
OK
();
return
Status
::
OK
();
}
}
Status
Status
Config
::
GetDBConfigBackendUrl
(
std
::
string
&
value
)
{
Config
::
GetDBConfigBackendUrl
(
std
::
string
&
value
)
{
value
=
Get
DBConfigStrBackendUrl
(
);
value
=
Get
ConfigStr
(
CONFIG_DB
,
CONFIG_DB_BACKEND_URL
,
CONFIG_DB_BACKEND_URL_DEFAULT
);
return
CheckDBConfigBackendUrl
(
value
);
return
CheckDBConfigBackendUrl
(
value
);
}
}
Status
Status
Config
::
GetDBConfigArchiveDiskThreshold
(
int32_t
&
value
)
{
Config
::
GetDBConfigArchiveDiskThreshold
(
int32_t
&
value
)
{
std
::
string
str
=
GetDBConfigStrArchiveDiskThreshold
();
std
::
string
str
=
GetConfigStr
(
CONFIG_DB
,
CONFIG_DB_ARCHIVE_DISK_THRESHOLD
,
CONFIG_DB_ARCHIVE_DISK_THRESHOLD_DEFAULT
);
Status
s
=
CheckDBConfigArchiveDiskThreshold
(
str
);
Status
s
=
CheckDBConfigArchiveDiskThreshold
(
str
);
if
(
!
s
.
ok
())
{
if
(
!
s
.
ok
())
{
return
s
;
return
s
;
...
@@ -964,7 +722,8 @@ Config::GetDBConfigArchiveDiskThreshold(int32_t& value) {
...
@@ -964,7 +722,8 @@ Config::GetDBConfigArchiveDiskThreshold(int32_t& value) {
Status
Status
Config
::
GetDBConfigArchiveDaysThreshold
(
int32_t
&
value
)
{
Config
::
GetDBConfigArchiveDaysThreshold
(
int32_t
&
value
)
{
std
::
string
str
=
GetDBConfigStrArchiveDaysThreshold
();
std
::
string
str
=
GetConfigStr
(
CONFIG_DB
,
CONFIG_DB_ARCHIVE_DAYS_THRESHOLD
,
CONFIG_DB_ARCHIVE_DAYS_THRESHOLD_DEFAULT
);
Status
s
=
CheckDBConfigArchiveDaysThreshold
(
str
);
Status
s
=
CheckDBConfigArchiveDaysThreshold
(
str
);
if
(
!
s
.
ok
())
{
if
(
!
s
.
ok
())
{
return
s
;
return
s
;
...
@@ -976,7 +735,8 @@ Config::GetDBConfigArchiveDaysThreshold(int32_t& value) {
...
@@ -976,7 +735,8 @@ Config::GetDBConfigArchiveDaysThreshold(int32_t& value) {
Status
Status
Config
::
GetDBConfigInsertBufferSize
(
int32_t
&
value
)
{
Config
::
GetDBConfigInsertBufferSize
(
int32_t
&
value
)
{
std
::
string
str
=
GetDBConfigStrInsertBufferSize
();
std
::
string
str
=
GetConfigStr
(
CONFIG_DB
,
CONFIG_DB_INSERT_BUFFER_SIZE
,
CONFIG_DB_INSERT_BUFFER_SIZE_DEFAULT
);
Status
s
=
CheckDBConfigInsertBufferSize
(
str
);
Status
s
=
CheckDBConfigInsertBufferSize
(
str
);
if
(
!
s
.
ok
())
{
if
(
!
s
.
ok
())
{
return
s
;
return
s
;
...
@@ -988,7 +748,8 @@ Config::GetDBConfigInsertBufferSize(int32_t& value) {
...
@@ -988,7 +748,8 @@ Config::GetDBConfigInsertBufferSize(int32_t& value) {
Status
Status
Config
::
GetDBConfigBuildIndexGPU
(
int32_t
&
value
)
{
Config
::
GetDBConfigBuildIndexGPU
(
int32_t
&
value
)
{
std
::
string
str
=
GetDBConfigStrBuildIndexGPU
();
std
::
string
str
=
GetConfigStr
(
CONFIG_DB
,
CONFIG_DB_BUILD_INDEX_GPU
,
CONFIG_DB_BUILD_INDEX_GPU_DEFAULT
);
Status
s
=
CheckDBConfigBuildIndexGPU
(
str
);
Status
s
=
CheckDBConfigBuildIndexGPU
(
str
);
if
(
!
s
.
ok
())
{
if
(
!
s
.
ok
())
{
return
s
;
return
s
;
...
@@ -1000,13 +761,14 @@ Config::GetDBConfigBuildIndexGPU(int32_t& value) {
...
@@ -1000,13 +761,14 @@ Config::GetDBConfigBuildIndexGPU(int32_t& value) {
Status
Status
Config
::
GetDBConfigPreloadTable
(
std
::
string
&
value
)
{
Config
::
GetDBConfigPreloadTable
(
std
::
string
&
value
)
{
value
=
Get
DBConfigStrPreloadTable
(
);
value
=
Get
ConfigStr
(
CONFIG_DB
,
CONFIG_DB_PRELOAD_TABLE
);
return
Status
::
OK
();
return
Status
::
OK
();
}
}
Status
Status
Config
::
GetMetricConfigEnableMonitor
(
bool
&
value
)
{
Config
::
GetMetricConfigEnableMonitor
(
bool
&
value
)
{
std
::
string
str
=
GetMetricConfigStrEnableMonitor
();
std
::
string
str
=
GetConfigStr
(
CONFIG_METRIC
,
CONFIG_METRIC_ENABLE_MONITOR
,
CONFIG_METRIC_ENABLE_MONITOR_DEFAULT
);
Status
s
=
CheckMetricConfigEnableMonitor
(
str
);
Status
s
=
CheckMetricConfigEnableMonitor
(
str
);
if
(
!
s
.
ok
())
{
if
(
!
s
.
ok
())
{
return
s
;
return
s
;
...
@@ -1019,19 +781,20 @@ Config::GetMetricConfigEnableMonitor(bool& value) {
...
@@ -1019,19 +781,20 @@ Config::GetMetricConfigEnableMonitor(bool& value) {
Status
Status
Config
::
GetMetricConfigCollector
(
std
::
string
&
value
)
{
Config
::
GetMetricConfigCollector
(
std
::
string
&
value
)
{
value
=
Get
MetricConfigStrCollector
(
);
value
=
Get
ConfigStr
(
CONFIG_METRIC
,
CONFIG_METRIC_COLLECTOR
,
CONFIG_METRIC_COLLECTOR_DEFAULT
);
return
Status
::
OK
();
return
Status
::
OK
();
}
}
Status
Status
Config
::
GetMetricConfigPrometheusPort
(
std
::
string
&
value
)
{
Config
::
GetMetricConfigPrometheusPort
(
std
::
string
&
value
)
{
value
=
Get
MetricConfigStrPrometheusPort
(
);
value
=
Get
ConfigStr
(
CONFIG_METRIC
,
CONFIG_METRIC_PROMETHEUS_PORT
,
CONFIG_METRIC_PROMETHEUS_PORT_DEFAULT
);
return
CheckMetricConfigPrometheusPort
(
value
);
return
CheckMetricConfigPrometheusPort
(
value
);
}
}
Status
Status
Config
::
GetCacheConfigCpuCacheCapacity
(
int32_t
&
value
)
{
Config
::
GetCacheConfigCpuCacheCapacity
(
int32_t
&
value
)
{
std
::
string
str
=
GetCacheConfigStrCpuCacheCapacity
();
std
::
string
str
=
GetConfigStr
(
CONFIG_CACHE
,
CONFIG_CACHE_CPU_CACHE_CAPACITY
,
CONFIG_CACHE_CPU_CACHE_CAPACITY_DEFAULT
);
Status
s
=
CheckCacheConfigCpuCacheCapacity
(
str
);
Status
s
=
CheckCacheConfigCpuCacheCapacity
(
str
);
if
(
!
s
.
ok
())
{
if
(
!
s
.
ok
())
{
return
s
;
return
s
;
...
@@ -1043,7 +806,8 @@ Config::GetCacheConfigCpuCacheCapacity(int32_t& value) {
...
@@ -1043,7 +806,8 @@ Config::GetCacheConfigCpuCacheCapacity(int32_t& value) {
Status
Status
Config
::
GetCacheConfigCpuCacheThreshold
(
float
&
value
)
{
Config
::
GetCacheConfigCpuCacheThreshold
(
float
&
value
)
{
std
::
string
str
=
GetCacheConfigStrCpuCacheThreshold
();
std
::
string
str
=
GetConfigStr
(
CONFIG_CACHE
,
CONFIG_CACHE_CPU_CACHE_THRESHOLD
,
CONFIG_CACHE_CPU_CACHE_THRESHOLD_DEFAULT
);
Status
s
=
CheckCacheConfigCpuCacheThreshold
(
str
);
Status
s
=
CheckCacheConfigCpuCacheThreshold
(
str
);
if
(
!
s
.
ok
())
{
if
(
!
s
.
ok
())
{
return
s
;
return
s
;
...
@@ -1055,7 +819,8 @@ Config::GetCacheConfigCpuCacheThreshold(float& value) {
...
@@ -1055,7 +819,8 @@ Config::GetCacheConfigCpuCacheThreshold(float& value) {
Status
Status
Config
::
GetCacheConfigGpuCacheCapacity
(
int32_t
&
value
)
{
Config
::
GetCacheConfigGpuCacheCapacity
(
int32_t
&
value
)
{
std
::
string
str
=
GetCacheConfigStrGpuCacheCapacity
();
std
::
string
str
=
GetConfigStr
(
CONFIG_CACHE
,
CONFIG_CACHE_GPU_CACHE_CAPACITY
,
CONFIG_CACHE_GPU_CACHE_CAPACITY_DEFAULT
);
Status
s
=
CheckCacheConfigGpuCacheCapacity
(
str
);
Status
s
=
CheckCacheConfigGpuCacheCapacity
(
str
);
if
(
!
s
.
ok
())
{
if
(
!
s
.
ok
())
{
return
s
;
return
s
;
...
@@ -1067,7 +832,8 @@ Config::GetCacheConfigGpuCacheCapacity(int32_t& value) {
...
@@ -1067,7 +832,8 @@ Config::GetCacheConfigGpuCacheCapacity(int32_t& value) {
Status
Status
Config
::
GetCacheConfigGpuCacheThreshold
(
float
&
value
)
{
Config
::
GetCacheConfigGpuCacheThreshold
(
float
&
value
)
{
std
::
string
str
=
GetCacheConfigStrGpuCacheThreshold
();
std
::
string
str
=
GetConfigStr
(
CONFIG_CACHE
,
CONFIG_CACHE_GPU_CACHE_THRESHOLD
,
CONFIG_CACHE_GPU_CACHE_THRESHOLD_DEFAULT
);
Status
s
=
CheckCacheConfigGpuCacheThreshold
(
str
);
Status
s
=
CheckCacheConfigGpuCacheThreshold
(
str
);
if
(
!
s
.
ok
())
{
if
(
!
s
.
ok
())
{
return
s
;
return
s
;
...
@@ -1079,7 +845,8 @@ Config::GetCacheConfigGpuCacheThreshold(float& value) {
...
@@ -1079,7 +845,8 @@ Config::GetCacheConfigGpuCacheThreshold(float& value) {
Status
Status
Config
::
GetCacheConfigCacheInsertData
(
bool
&
value
)
{
Config
::
GetCacheConfigCacheInsertData
(
bool
&
value
)
{
std
::
string
str
=
GetCacheConfigStrCacheInsertData
();
std
::
string
str
=
GetConfigStr
(
CONFIG_CACHE
,
CONFIG_CACHE_CACHE_INSERT_DATA
,
CONFIG_CACHE_CACHE_INSERT_DATA_DEFAULT
);
Status
s
=
CheckCacheConfigCacheInsertData
(
str
);
Status
s
=
CheckCacheConfigCacheInsertData
(
str
);
if
(
!
s
.
ok
())
{
if
(
!
s
.
ok
())
{
return
s
;
return
s
;
...
@@ -1092,7 +859,8 @@ Config::GetCacheConfigCacheInsertData(bool& value) {
...
@@ -1092,7 +859,8 @@ Config::GetCacheConfigCacheInsertData(bool& value) {
Status
Status
Config
::
GetEngineConfigUseBlasThreshold
(
int32_t
&
value
)
{
Config
::
GetEngineConfigUseBlasThreshold
(
int32_t
&
value
)
{
std
::
string
str
=
GetEngineConfigStrUseBlasThreshold
();
std
::
string
str
=
GetConfigStr
(
CONFIG_ENGINE
,
CONFIG_ENGINE_USE_BLAS_THRESHOLD
,
CONFIG_ENGINE_USE_BLAS_THRESHOLD_DEFAULT
);
Status
s
=
CheckEngineConfigUseBlasThreshold
(
str
);
Status
s
=
CheckEngineConfigUseBlasThreshold
(
str
);
if
(
!
s
.
ok
())
{
if
(
!
s
.
ok
())
{
return
s
;
return
s
;
...
@@ -1104,7 +872,8 @@ Config::GetEngineConfigUseBlasThreshold(int32_t& value) {
...
@@ -1104,7 +872,8 @@ Config::GetEngineConfigUseBlasThreshold(int32_t& value) {
Status
Status
Config
::
GetEngineConfigOmpThreadNum
(
int32_t
&
value
)
{
Config
::
GetEngineConfigOmpThreadNum
(
int32_t
&
value
)
{
std
::
string
str
=
GetEngineConfigStrOmpThreadNum
();
std
::
string
str
=
GetConfigStr
(
CONFIG_ENGINE
,
CONFIG_ENGINE_OMP_THREAD_NUM
,
CONFIG_ENGINE_OMP_THREAD_NUM_DEFAULT
);
Status
s
=
CheckEngineConfigOmpThreadNum
(
str
);
Status
s
=
CheckEngineConfigOmpThreadNum
(
str
);
if
(
!
s
.
ok
())
{
if
(
!
s
.
ok
())
{
return
s
;
return
s
;
...
@@ -1116,7 +885,7 @@ Config::GetEngineConfigOmpThreadNum(int32_t& value) {
...
@@ -1116,7 +885,7 @@ Config::GetEngineConfigOmpThreadNum(int32_t& value) {
Status
Status
Config
::
GetResourceConfigMode
(
std
::
string
&
value
)
{
Config
::
GetResourceConfigMode
(
std
::
string
&
value
)
{
value
=
Get
ResourceConfigStrMode
(
);
value
=
Get
ConfigStr
(
CONFIG_RESOURCE
,
CONFIG_RESOURCE_MODE
,
CONFIG_RESOURCE_MODE_DEFAULT
);
return
CheckResourceConfigMode
(
value
);
return
CheckResourceConfigMode
(
value
);
}
}
...
...
cpp/src/server/Config.h
浏览文件 @
47b2b164
...
@@ -179,64 +179,8 @@ class Config {
...
@@ -179,64 +179,8 @@ class Config {
Status
Status
CheckResourceConfigPool
(
const
std
::
vector
<
std
::
string
>&
value
);
CheckResourceConfigPool
(
const
std
::
vector
<
std
::
string
>&
value
);
///////////////////////////////////////////////////////////////////////////
/* server config */
std
::
string
GetServerConfigStrAddress
();
std
::
string
GetServerConfigStrPort
();
std
::
string
GetServerConfigStrDeployMode
();
std
::
string
GetServerConfigStrTimeZone
();
/* db config */
std
::
string
GetDBConfigStrPrimaryPath
();
std
::
string
GetDBConfigStrSecondaryPath
();
std
::
string
GetDBConfigStrBackendUrl
();
std
::
string
GetDBConfigStrArchiveDiskThreshold
();
std
::
string
GetDBConfigStrArchiveDaysThreshold
();
std
::
string
GetDBConfigStrInsertBufferSize
();
std
::
string
GetDBConfigStrBuildIndexGPU
();
std
::
string
GetDBConfigStrPreloadTable
();
/* metric config */
std
::
string
GetMetricConfigStrEnableMonitor
();
std
::
string
GetMetricConfigStrCollector
();
std
::
string
GetMetricConfigStrPrometheusPort
();
/* cache config */
std
::
string
GetCacheConfigStrCpuCacheCapacity
();
std
::
string
GetCacheConfigStrCpuCacheThreshold
();
std
::
string
GetCacheConfigStrGpuCacheCapacity
();
std
::
string
GetCacheConfigStrGpuCacheThreshold
();
std
::
string
GetCacheConfigStrCacheInsertData
();
/* engine config */
std
::
string
GetEngineConfigStrUseBlasThreshold
();
std
::
string
GetEngineConfigStrOmpThreadNum
();
/* resource config */
std
::
string
std
::
string
Get
ResourceConfigStrMode
(
);
Get
ConfigStr
(
const
std
::
string
&
parent_key
,
const
std
::
string
&
child_key
,
const
std
::
string
&
default_value
=
""
);
public:
public:
/* server config */
/* server config */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录