Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bb63a149
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看板
提交
bb63a149
编写于
4月 22, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more refact meta
上级
b09091ce
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
82 addition
and
78 deletion
+82
-78
include/common/tmsg.h
include/common/tmsg.h
+22
-3
include/util/tencode.h
include/util/tencode.h
+3
-1
source/common/src/tmsg.c
source/common/src/tmsg.c
+57
-74
未找到文件。
include/common/tmsg.h
浏览文件 @
bb63a149
...
...
@@ -1552,9 +1552,6 @@ typedef struct SVCreateTbReq {
};
}
SVCreateTbReq
,
SVUpdateTbReq
;
int
tEncodeSVCreateTbReq
(
SCoder
*
pCoder
,
const
SVCreateTbReq
*
pReq
);
int
tDecodeSVCreateTbReq
(
SCoder
*
pCoder
,
SVCreateTbReq
*
pReq
);
typedef
struct
{
int32_t
code
;
}
SVCreateTbRsp
,
SVUpdateTbRsp
;
...
...
@@ -1562,6 +1559,28 @@ typedef struct {
int32_t
tSerializeSVCreateTbReq
(
void
**
buf
,
SVCreateTbReq
*
pReq
);
void
*
tDeserializeSVCreateTbReq
(
void
*
buf
,
SVCreateTbReq
*
pReq
);
typedef
struct
SVCreateTbReq2
{
tb_uid_t
uid
;
int64_t
ctime
;
const
char
*
name
;
int32_t
ttl
;
int8_t
type
;
union
{
struct
{
tb_uid_t
suid
;
const
void
*
pTag
;
}
ctb
;
struct
{
int16_t
nCols
;
int16_t
sver
;
SSchema
*
pSchema
;
}
ntb
;
};
}
SVCreateTbReq2
;
int
tEncodeSVCreateTbReq2
(
SCoder
*
pCoder
,
const
SVCreateTbReq2
*
pReq
);
int
tDecodeSVCreateTbReq2
(
SCoder
*
pCoder
,
SVCreateTbReq2
*
pReq
);
typedef
struct
{
int64_t
ver
;
// use a general definition
SArray
*
pArray
;
...
...
include/util/tencode.h
浏览文件 @
bb63a149
...
...
@@ -406,7 +406,9 @@ static FORCE_INLINE int32_t tDecodeBinary(SCoder* pDecoder, const void** val, ui
if
(
tDecodeU64v
(
pDecoder
,
len
)
<
0
)
return
-
1
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
pDecoder
,
*
len
))
return
-
1
;
*
val
=
(
void
*
)
TD_CODER_CURRENT
(
pDecoder
);
if
(
val
)
{
*
val
=
(
void
*
)
TD_CODER_CURRENT
(
pDecoder
);
}
TD_CODER_MOVE_POS
(
pDecoder
,
*
len
);
return
0
;
...
...
source/common/src/tmsg.c
浏览文件 @
bb63a149
...
...
@@ -398,80 +398,6 @@ int32_t tDeserializeSClientHbBatchRsp(void *buf, int32_t bufLen, SClientHbBatchR
return
0
;
}
int
tEncodeSVCreateTbReq
(
SCoder
*
pCoder
,
const
SVCreateTbReq
*
pReq
)
{
#if 0
if (tStartEncode(pCoder) < 0) return -1;
if (tEncodeCStr(pCoder, pReq->name) < 0) return -1;
if (tEncodeU32v(pCoder, pReq->ttl) < 0) return -1;
if (tEncodeU32v(pCoder, pReq->keep) < 0) return -1;
if (tEncodeI8(pCoder, pReq->type) < 0) return -1;
if (pReq->type == TSDB_SUPER_TABLE) {
if (tEncodeI64(pCoder, pReq->stbCfg.suid) < 0) return -1;
if (tEncodeI16v(pCoder, pReq->stbCfg.nCols) < 0) return -1;
for (int i = 0; i < pReq->stbCfg.nCols; i++) {
if (tEncodeSSchema(pCoder, pReq->stbCfg.pSchema + i) < 0) return -1;
}
if (tEncodeI16v(pCoder, pReq->stbCfg.nTagCols) < 0) return -1;
for (int i = 0; i < pReq->stbCfg.nTagCols; i++) {
if (tEncodeSSchema(pCoder, pReq->stbCfg.pTagSchema + i) < 0) return -1;
}
} else if (pReq->type == TSDB_CHILD_TABLE) {
if (tEncodeI64(pCoder, pReq->ctbCfg.suid) < 0) return -1;
// TODO: encode SKVRow
} else if (pReq->type == TSDB_NORMAL_TABLE) {
if (tEncodeI16v(pCoder, pReq->ntbCfg.nCols) < 0) return -1;
for (int i = 0; i < pReq->ntbCfg.nCols; i++) {
if (tEncodeSSchema(pCoder, pReq->stbCfg.pSchema + i) < 0) return -1;
}
} else {
ASSERT(0);
}
tEndEncode(pCoder);
#endif
return
0
;
}
int
tDecodeSVCreateTbReq
(
SCoder
*
pCoder
,
SVCreateTbReq
*
pReq
)
{
#if 0
if (tStartDecode(pCoder) < 0) return -1;
if (tDecodeCStr(pCoder, &pReq->name) < 0) return -1;
if (tDecodeU32v(pCoder, &pReq->ttl) < 0) return -1;
if (tDecodeU32v(pCoder, &pReq->keep) < 0) return -1;
if (tDecodeI8(pCoder, &pReq->type) < 0) return -1;
if (pReq->type == TSDB_SUPER_TABLE) {
if (tDecodeI64(pCoder, &pReq->stbCfg.suid) < 0) return -1;
if (tDecodeI16v(pCoder, &pReq->stbCfg.nCols) < 0) return -1;
for (int i = 0; i < pReq->stbCfg.nCols; i++) {
if (tDecodeSSchema(pCoder, &pReq->stbCfg.pSchema + i) < 0) return -1;
}
if (tDecodeI16v(pCoder, pReq->stbCfg.nTagCols) < 0) return -1;
for (int i = 0; i < pReq->stbCfg.nTagCols; i++) {
if (tDecodeSSchema(pCoder, pReq->stbCfg.pTagSchema + i) < 0) return -1;
}
} else if (pReq->type == TSDB_CHILD_TABLE) {
if (tDecodeI64(pCoder, pReq->ctbCfg.suid) < 0) return -1;
// TODO: decode SKVRow
} else if (pReq->type == TSDB_NORMAL_TABLE) {
if (tDecodeI16v(pCoder, pReq->ntbCfg.nCols) < 0) return -1;
for (int i = 0; i < pReq->ntbCfg.nCols; i++) {
if (tDecodeSSchema(pCoder, pReq->stbCfg.pSchema + i) < 0) return -1;
}
} else {
ASSERT(0);
}
tEndDecode(pCoder);
#endif
return
0
;
}
int32_t
tSerializeSVCreateTbReq
(
void
**
buf
,
SVCreateTbReq
*
pReq
)
{
int32_t
tlen
=
0
;
...
...
@@ -3838,3 +3764,60 @@ STSchema *tdGetSTSChemaFromSSChema(SSchema **pSchema, int32_t nCols) {
tdDestroyTSchemaBuilder
(
&
schemaBuilder
);
return
pNSchema
;
}
int
tEncodeSVCreateTbReq2
(
SCoder
*
pCoder
,
const
SVCreateTbReq2
*
pReq
)
{
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pCoder
,
pReq
->
uid
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pCoder
,
pReq
->
ctime
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pCoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pCoder
,
pReq
->
ttl
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pCoder
,
pReq
->
type
)
<
0
)
return
-
1
;
if
(
pReq
->
type
==
TSDB_CHILD_TABLE
)
{
if
(
tEncodeI64
(
pCoder
,
pReq
->
ctb
.
suid
)
<
0
)
return
-
1
;
if
(
tEncodeBinary
(
pCoder
,
pReq
->
ctb
.
pTag
,
kvRowLen
(
pReq
->
ctb
.
pTag
))
<
0
)
return
-
1
;
}
else
if
(
pReq
->
type
==
TSDB_NORMAL_TABLE
)
{
if
(
tEncodeI16v
(
pCoder
,
pReq
->
ntb
.
nCols
)
<
0
)
return
-
1
;
if
(
tEncodeI16v
(
pCoder
,
pReq
->
ntb
.
sver
)
<
0
)
return
-
1
;
for
(
int
iCol
=
0
;
iCol
<
pReq
->
ntb
.
nCols
;
iCol
++
)
{
if
(
tEncodeSSchema
(
pCoder
,
pReq
->
ntb
.
pSchema
+
iCol
)
<
0
)
return
-
1
;
}
}
else
{
ASSERT
(
0
);
}
tEndEncode
(
pCoder
);
return
0
;
}
int
tDecodeSVCreateTbReq2
(
SCoder
*
pCoder
,
SVCreateTbReq2
*
pReq
)
{
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pReq
->
uid
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pReq
->
ctime
)
<
0
)
return
-
1
;
if
(
tDecodeCStr
(
pCoder
,
&
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pCoder
,
&
pReq
->
ttl
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pCoder
,
&
pReq
->
type
)
<
0
)
return
-
1
;
if
(
pReq
->
type
==
TSDB_CHILD_TABLE
)
{
if
(
tDecodeI64
(
pCoder
,
&
pReq
->
ctb
.
suid
)
<
0
)
return
-
1
;
if
(
tDecodeBinary
(
pCoder
,
&
pReq
->
ctb
.
pTag
,
NULL
)
<
0
)
return
-
1
;
}
else
if
(
pReq
->
type
==
TSDB_NORMAL_TABLE
)
{
if
(
tDecodeI16v
(
pCoder
,
&
pReq
->
ntb
.
nCols
)
<
0
)
return
-
1
;
if
(
tDecodeI16v
(
pCoder
,
&
pReq
->
ntb
.
sver
)
<
0
)
return
-
1
;
pReq
->
ntb
.
pSchema
=
(
SSchema
*
)
TCODER_MALLOC
(
pCoder
,
sizeof
(
SSchema
)
*
pReq
->
ntb
.
nCols
);
if
(
pReq
->
ntb
.
pSchema
==
NULL
)
return
-
1
;
for
(
int
iCol
=
0
;
iCol
<
pReq
->
ntb
.
nCols
;
iCol
++
)
{
if
(
tDecodeSSchema
(
pCoder
,
pReq
->
ntb
.
pSchema
+
iCol
)
<
0
)
return
-
1
;
}
}
else
{
ASSERT
(
0
);
}
tEndDecode
(
pCoder
);
return
0
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录