Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
707be3a6
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
707be3a6
编写于
7月 17, 2023
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
unify scope for client/system/server configs
上级
b4027827
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
183 addition
and
184 deletion
+183
-184
include/util/tconfig.h
include/util/tconfig.h
+11
-11
source/common/src/tglobal.c
source/common/src/tglobal.c
+152
-153
source/util/src/tconfig.c
source/util/src/tconfig.c
+20
-20
未找到文件。
include/util/tconfig.h
浏览文件 @
707be3a6
...
...
@@ -59,8 +59,8 @@ typedef enum {
typedef
struct
SConfigItem
{
ECfgSrcType
stype
;
ECfgDataType
dtype
;
bool
tsc
;
char
*
name
;
int8_t
scope
;
char
*
name
;
union
{
bool
bval
;
float
fval
;
...
...
@@ -98,15 +98,15 @@ int32_t cfgGetSize(SConfig *pCfg);
SConfigItem
*
cfgGetItem
(
SConfig
*
pCfg
,
const
char
*
name
);
int32_t
cfgSetItem
(
SConfig
*
pCfg
,
const
char
*
name
,
const
char
*
value
,
ECfgSrcType
stype
);
int32_t
cfgAddBool
(
SConfig
*
pCfg
,
const
char
*
name
,
bool
defaultVal
,
bool
tsc
);
int32_t
cfgAddInt32
(
SConfig
*
pCfg
,
const
char
*
name
,
int32_t
defaultVal
,
int64_t
minval
,
int64_t
maxval
,
bool
tsc
);
int32_t
cfgAddInt64
(
SConfig
*
pCfg
,
const
char
*
name
,
int64_t
defaultVal
,
int64_t
minval
,
int64_t
maxval
,
bool
tsc
);
int32_t
cfgAddFloat
(
SConfig
*
pCfg
,
const
char
*
name
,
float
defaultVal
,
double
minval
,
double
maxval
,
bool
tsc
);
int32_t
cfgAddString
(
SConfig
*
pCfg
,
const
char
*
name
,
const
char
*
defaultVal
,
bool
tsc
);
int32_t
cfgAddDir
(
SConfig
*
pCfg
,
const
char
*
name
,
const
char
*
defaultVal
,
bool
tsc
);
int32_t
cfgAddLocale
(
SConfig
*
pCfg
,
const
char
*
name
,
const
char
*
defaultVal
);
int32_t
cfgAddCharset
(
SConfig
*
pCfg
,
const
char
*
name
,
const
char
*
defaultVal
);
int32_t
cfgAddTimezone
(
SConfig
*
pCfg
,
const
char
*
name
,
const
char
*
defaultVal
);
int32_t
cfgAddBool
(
SConfig
*
pCfg
,
const
char
*
name
,
bool
defaultVal
,
int8_t
scope
);
int32_t
cfgAddInt32
(
SConfig
*
pCfg
,
const
char
*
name
,
int32_t
defaultVal
,
int64_t
minval
,
int64_t
maxval
,
int8_t
scope
);
int32_t
cfgAddInt64
(
SConfig
*
pCfg
,
const
char
*
name
,
int64_t
defaultVal
,
int64_t
minval
,
int64_t
maxval
,
int8_t
scope
);
int32_t
cfgAddFloat
(
SConfig
*
pCfg
,
const
char
*
name
,
float
defaultVal
,
double
minval
,
double
maxval
,
int8_t
scope
);
int32_t
cfgAddString
(
SConfig
*
pCfg
,
const
char
*
name
,
const
char
*
defaultVal
,
int8_t
scope
);
int32_t
cfgAddDir
(
SConfig
*
pCfg
,
const
char
*
name
,
const
char
*
defaultVal
,
int8_t
scope
);
int32_t
cfgAddLocale
(
SConfig
*
pCfg
,
const
char
*
name
,
const
char
*
defaultVal
,
int8_t
scope
);
int32_t
cfgAddCharset
(
SConfig
*
pCfg
,
const
char
*
name
,
const
char
*
defaultVal
,
int8_t
scope
);
int32_t
cfgAddTimezone
(
SConfig
*
pCfg
,
const
char
*
name
,
const
char
*
defaultVal
,
int8_t
scope
);
const
char
*
cfgStypeStr
(
ECfgSrcType
type
);
const
char
*
cfgDtypeStr
(
ECfgDataType
type
);
...
...
source/common/src/tglobal.c
浏览文件 @
707be3a6
此差异已折叠。
点击以展开。
source/util/src/tconfig.c
浏览文件 @
707be3a6
...
...
@@ -380,43 +380,43 @@ static int32_t cfgAddItem(SConfig *pCfg, SConfigItem *pItem, const char *name) {
return
0
;
}
int32_t
cfgAddBool
(
SConfig
*
pCfg
,
const
char
*
name
,
bool
defaultVal
,
bool
tsc
)
{
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_BOOL
,
.
bval
=
defaultVal
,
.
tsc
=
tsc
};
int32_t
cfgAddBool
(
SConfig
*
pCfg
,
const
char
*
name
,
bool
defaultVal
,
int8_t
scope
)
{
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_BOOL
,
.
bval
=
defaultVal
,
.
scope
=
scope
};
return
cfgAddItem
(
pCfg
,
&
item
,
name
);
}
int32_t
cfgAddInt32
(
SConfig
*
pCfg
,
const
char
*
name
,
int32_t
defaultVal
,
int64_t
minval
,
int64_t
maxval
,
bool
tsc
)
{
int32_t
cfgAddInt32
(
SConfig
*
pCfg
,
const
char
*
name
,
int32_t
defaultVal
,
int64_t
minval
,
int64_t
maxval
,
int8_t
scope
)
{
if
(
defaultVal
<
minval
||
defaultVal
>
maxval
)
{
terrno
=
TSDB_CODE_OUT_OF_RANGE
;
return
-
1
;
}
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_INT32
,
.
i32
=
defaultVal
,
.
imin
=
minval
,
.
imax
=
maxval
,
.
tsc
=
tsc
};
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_INT32
,
.
i32
=
defaultVal
,
.
imin
=
minval
,
.
imax
=
maxval
,
.
scope
=
scope
};
return
cfgAddItem
(
pCfg
,
&
item
,
name
);
}
int32_t
cfgAddInt64
(
SConfig
*
pCfg
,
const
char
*
name
,
int64_t
defaultVal
,
int64_t
minval
,
int64_t
maxval
,
bool
tsc
)
{
int32_t
cfgAddInt64
(
SConfig
*
pCfg
,
const
char
*
name
,
int64_t
defaultVal
,
int64_t
minval
,
int64_t
maxval
,
int8_t
scope
)
{
if
(
defaultVal
<
minval
||
defaultVal
>
maxval
)
{
terrno
=
TSDB_CODE_OUT_OF_RANGE
;
return
-
1
;
}
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_INT64
,
.
i64
=
defaultVal
,
.
imin
=
minval
,
.
imax
=
maxval
,
.
tsc
=
tsc
};
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_INT64
,
.
i64
=
defaultVal
,
.
imin
=
minval
,
.
imax
=
maxval
,
.
scope
=
scope
};
return
cfgAddItem
(
pCfg
,
&
item
,
name
);
}
int32_t
cfgAddFloat
(
SConfig
*
pCfg
,
const
char
*
name
,
float
defaultVal
,
double
minval
,
double
maxval
,
bool
tsc
)
{
int32_t
cfgAddFloat
(
SConfig
*
pCfg
,
const
char
*
name
,
float
defaultVal
,
double
minval
,
double
maxval
,
int8_t
scope
)
{
if
(
defaultVal
<
minval
||
defaultVal
>
maxval
)
{
terrno
=
TSDB_CODE_OUT_OF_RANGE
;
return
-
1
;
}
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_FLOAT
,
.
fval
=
defaultVal
,
.
fmin
=
minval
,
.
fmax
=
maxval
,
.
tsc
=
tsc
};
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_FLOAT
,
.
fval
=
defaultVal
,
.
fmin
=
minval
,
.
fmax
=
maxval
,
.
scope
=
scope
};
return
cfgAddItem
(
pCfg
,
&
item
,
name
);
}
int32_t
cfgAddString
(
SConfig
*
pCfg
,
const
char
*
name
,
const
char
*
defaultVal
,
bool
tsc
)
{
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_STRING
,
.
tsc
=
tsc
};
int32_t
cfgAddString
(
SConfig
*
pCfg
,
const
char
*
name
,
const
char
*
defaultVal
,
int8_t
scope
)
{
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_STRING
,
.
scope
=
scope
};
item
.
str
=
taosStrdup
(
defaultVal
);
if
(
item
.
str
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -425,8 +425,8 @@ int32_t cfgAddString(SConfig *pCfg, const char *name, const char *defaultVal, bo
return
cfgAddItem
(
pCfg
,
&
item
,
name
);
}
int32_t
cfgAddDir
(
SConfig
*
pCfg
,
const
char
*
name
,
const
char
*
defaultVal
,
bool
tsc
)
{
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_DIR
,
.
tsc
=
tsc
};
int32_t
cfgAddDir
(
SConfig
*
pCfg
,
const
char
*
name
,
const
char
*
defaultVal
,
int8_t
scope
)
{
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_DIR
,
.
scope
=
scope
};
if
(
cfgCheckAndSetDir
(
&
item
,
defaultVal
)
!=
0
)
{
return
-
1
;
}
...
...
@@ -434,8 +434,8 @@ int32_t cfgAddDir(SConfig *pCfg, const char *name, const char *defaultVal, bool
return
cfgAddItem
(
pCfg
,
&
item
,
name
);
}
int32_t
cfgAddLocale
(
SConfig
*
pCfg
,
const
char
*
name
,
const
char
*
defaultVal
)
{
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_LOCALE
,
.
tsc
=
1
};
int32_t
cfgAddLocale
(
SConfig
*
pCfg
,
const
char
*
name
,
const
char
*
defaultVal
,
int8_t
scope
)
{
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_LOCALE
,
.
scope
=
scope
};
if
(
cfgCheckAndSetLocale
(
&
item
,
defaultVal
)
!=
0
)
{
return
-
1
;
}
...
...
@@ -443,8 +443,8 @@ int32_t cfgAddLocale(SConfig *pCfg, const char *name, const char *defaultVal) {
return
cfgAddItem
(
pCfg
,
&
item
,
name
);
}
int32_t
cfgAddCharset
(
SConfig
*
pCfg
,
const
char
*
name
,
const
char
*
defaultVal
)
{
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_CHARSET
,
.
tsc
=
1
};
int32_t
cfgAddCharset
(
SConfig
*
pCfg
,
const
char
*
name
,
const
char
*
defaultVal
,
int8_t
scope
)
{
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_CHARSET
,
.
scope
=
scope
};
if
(
cfgCheckAndSetCharset
(
&
item
,
defaultVal
)
!=
0
)
{
return
-
1
;
}
...
...
@@ -452,8 +452,8 @@ int32_t cfgAddCharset(SConfig *pCfg, const char *name, const char *defaultVal) {
return
cfgAddItem
(
pCfg
,
&
item
,
name
);
}
int32_t
cfgAddTimezone
(
SConfig
*
pCfg
,
const
char
*
name
,
const
char
*
defaultVal
)
{
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_TIMEZONE
,
.
tsc
=
1
};
int32_t
cfgAddTimezone
(
SConfig
*
pCfg
,
const
char
*
name
,
const
char
*
defaultVal
,
int8_t
scope
)
{
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_TIMEZONE
,
.
scope
=
scope
};
if
(
cfgCheckAndSetTimezone
(
&
item
,
defaultVal
)
!=
0
)
{
return
-
1
;
}
...
...
@@ -545,7 +545,7 @@ void cfgDumpItemValue(SConfigItem *pItem, char *buf, int32_t bufSize, int32_t *p
void
cfgDumpItemScope
(
SConfigItem
*
pItem
,
char
*
buf
,
int32_t
bufSize
,
int32_t
*
pLen
)
{
int32_t
len
=
0
;
switch
(
(
int8_t
)
pItem
->
tsc
)
{
switch
(
pItem
->
scope
)
{
case
CFG_SCOPE_SERVER
:
len
=
snprintf
(
buf
,
bufSize
,
"server"
);
break
;
...
...
@@ -581,7 +581,7 @@ void cfgDumpCfg(SConfig *pCfg, bool tsc, bool dump) {
int32_t
size
=
taosArrayGetSize
(
pCfg
->
array
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SConfigItem
*
pItem
=
taosArrayGet
(
pCfg
->
array
,
i
);
if
(
tsc
&&
!
pItem
->
tsc
)
continue
;
if
(
tsc
&&
pItem
->
scope
!=
CFG_SCOPE_CLIENT
)
continue
;
if
(
dump
&&
strcmp
(
pItem
->
name
,
"scriptDir"
)
==
0
)
continue
;
if
(
dump
&&
strcmp
(
pItem
->
name
,
"simDebugFlag"
)
==
0
)
continue
;
tstrncpy
(
src
,
cfgStypeStr
(
pItem
->
stype
),
CFG_SRC_PRINT_LEN
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录