Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a06bf6e5
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
未验证
提交
a06bf6e5
编写于
5月 07, 2022
作者:
H
Hongze Cheng
提交者:
GitHub
5月 07, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #12206 from taosdata/feature/vnode_refact1
refact: vnode
上级
6ce36a08
20854de4
变更
31
显示空白变更内容
内联
并排
Showing
31 changed file
with
1101 addition
and
1940 deletion
+1101
-1940
include/common/tmsg.h
include/common/tmsg.h
+45
-45
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+2
-2
include/util/tencode.h
include/util/tencode.h
+203
-216
source/client/src/tmq.c
source/client/src/tmq.c
+6
-6
source/common/src/tmsg.c
source/common/src/tmsg.c
+467
-467
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+2
-2
source/dnode/mnode/impl/src/mndDef.c
source/dnode/mnode/impl/src/mndDef.c
+2
-2
source/dnode/mnode/impl/src/mndOffset.c
source/dnode/mnode/impl/src/mndOffset.c
+2
-2
source/dnode/mnode/impl/src/mndScheduler.c
source/dnode/mnode/impl/src/mndScheduler.c
+5
-5
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+8
-8
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+9
-9
source/dnode/snode/src/snode.c
source/dnode/snode/src/snode.c
+3
-3
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+14
-14
source/dnode/vnode/src/inc/meta.h
source/dnode/vnode/src/inc/meta.h
+2
-2
source/dnode/vnode/src/meta/metaEntry.c
source/dnode/vnode/src/meta/metaEntry.c
+3
-3
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+5
-5
source/dnode/vnode/src/meta/metaTDBImpl.c
source/dnode/vnode/src/meta/metaTDBImpl.c
+0
-843
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+9
-10
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+3
-3
source/dnode/vnode/src/tsdb/tsdbMemTable2.c
source/dnode/vnode/src/tsdb/tsdbMemTable2.c
+66
-59
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+29
-26
source/libs/executor/CMakeLists.txt
source/libs/executor/CMakeLists.txt
+2
-2
source/libs/monitor/src/monMsg.c
source/libs/monitor/src/monMsg.c
+58
-58
source/libs/parser/src/parInsertData.c
source/libs/parser/src/parInsertData.c
+3
-3
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+8
-8
source/libs/scheduler/src/scheduler.c
source/libs/scheduler/src/scheduler.c
+8
-8
source/libs/stream/src/tstream.c
source/libs/stream/src/tstream.c
+2
-2
source/libs/sync/src/syncMessage.c
source/libs/sync/src/syncMessage.c
+16
-16
source/util/src/tencode.c
source/util/src/tencode.c
+59
-52
source/util/test/CMakeLists.txt
source/util/test/CMakeLists.txt
+3
-3
source/util/test/encodeTest.cpp
source/util/test/encodeTest.cpp
+57
-56
未找到文件。
include/common/tmsg.h
浏览文件 @
a06bf6e5
...
@@ -338,8 +338,8 @@ typedef struct SEpSet {
...
@@ -338,8 +338,8 @@ typedef struct SEpSet {
SEp
eps
[
TSDB_MAX_REPLICA
];
SEp
eps
[
TSDB_MAX_REPLICA
];
}
SEpSet
;
}
SEpSet
;
int32_t
tEncodeSEpSet
(
S
C
oder
*
pEncoder
,
const
SEpSet
*
pEp
);
int32_t
tEncodeSEpSet
(
S
Enc
oder
*
pEncoder
,
const
SEpSet
*
pEp
);
int32_t
tDecodeSEpSet
(
S
C
oder
*
pDecoder
,
SEpSet
*
pEp
);
int32_t
tDecodeSEpSet
(
S
Dec
oder
*
pDecoder
,
SEpSet
*
pEp
);
int32_t
taosEncodeSEpSet
(
void
**
buf
,
const
SEpSet
*
pEp
);
int32_t
taosEncodeSEpSet
(
void
**
buf
,
const
SEpSet
*
pEp
);
void
*
taosDecodeSEpSet
(
const
void
*
buf
,
SEpSet
*
pEp
);
void
*
taosDecodeSEpSet
(
const
void
*
buf
,
SEpSet
*
pEp
);
...
@@ -611,8 +611,8 @@ typedef struct {
...
@@ -611,8 +611,8 @@ typedef struct {
int32_t
tSerializeSUseDbRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SUseDbRsp
*
pRsp
);
int32_t
tSerializeSUseDbRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SUseDbRsp
*
pRsp
);
int32_t
tDeserializeSUseDbRsp
(
void
*
buf
,
int32_t
bufLen
,
SUseDbRsp
*
pRsp
);
int32_t
tDeserializeSUseDbRsp
(
void
*
buf
,
int32_t
bufLen
,
SUseDbRsp
*
pRsp
);
int32_t
tSerializeSUseDbRspImp
(
S
C
oder
*
pEncoder
,
const
SUseDbRsp
*
pRsp
);
int32_t
tSerializeSUseDbRspImp
(
S
Enc
oder
*
pEncoder
,
const
SUseDbRsp
*
pRsp
);
int32_t
tDeserializeSUseDbRspImp
(
S
C
oder
*
pDecoder
,
SUseDbRsp
*
pRsp
);
int32_t
tDeserializeSUseDbRspImp
(
S
Dec
oder
*
pDecoder
,
SUseDbRsp
*
pRsp
);
void
tFreeSUsedbRsp
(
SUseDbRsp
*
pRsp
);
void
tFreeSUsedbRsp
(
SUseDbRsp
*
pRsp
);
typedef
struct
{
typedef
struct
{
...
@@ -1527,8 +1527,8 @@ typedef struct {
...
@@ -1527,8 +1527,8 @@ typedef struct {
char
*
qmsg2
;
// pAst2:qmsg2:SRetention2 => trigger aggr task2
char
*
qmsg2
;
// pAst2:qmsg2:SRetention2 => trigger aggr task2
}
SRSmaParam
;
}
SRSmaParam
;
int32_t
tEncodeSRSmaParam
(
S
C
oder
*
pCoder
,
const
SRSmaParam
*
pRSmaParam
);
int32_t
tEncodeSRSmaParam
(
S
Enc
oder
*
pCoder
,
const
SRSmaParam
*
pRSmaParam
);
int32_t
tDecodeSRSmaParam
(
S
C
oder
*
pCoder
,
SRSmaParam
*
pRSmaParam
);
int32_t
tDecodeSRSmaParam
(
S
Dec
oder
*
pCoder
,
SRSmaParam
*
pRSmaParam
);
// TDMT_VND_CREATE_STB ==============
// TDMT_VND_CREATE_STB ==============
typedef
struct
SVCreateStbReq
{
typedef
struct
SVCreateStbReq
{
...
@@ -1540,8 +1540,8 @@ typedef struct SVCreateStbReq {
...
@@ -1540,8 +1540,8 @@ typedef struct SVCreateStbReq {
SRSmaParam
pRSmaParam
;
SRSmaParam
pRSmaParam
;
}
SVCreateStbReq
;
}
SVCreateStbReq
;
int
tEncodeSVCreateStbReq
(
S
C
oder
*
pCoder
,
const
SVCreateStbReq
*
pReq
);
int
tEncodeSVCreateStbReq
(
S
Enc
oder
*
pCoder
,
const
SVCreateStbReq
*
pReq
);
int
tDecodeSVCreateStbReq
(
S
C
oder
*
pCoder
,
SVCreateStbReq
*
pReq
);
int
tDecodeSVCreateStbReq
(
S
Dec
oder
*
pCoder
,
SVCreateStbReq
*
pReq
);
// TDMT_VND_DROP_STB ==============
// TDMT_VND_DROP_STB ==============
typedef
struct
SVDropStbReq
{
typedef
struct
SVDropStbReq
{
...
@@ -1549,8 +1549,8 @@ typedef struct SVDropStbReq {
...
@@ -1549,8 +1549,8 @@ typedef struct SVDropStbReq {
tb_uid_t
suid
;
tb_uid_t
suid
;
}
SVDropStbReq
;
}
SVDropStbReq
;
int32_t
tEncodeSVDropStbReq
(
S
C
oder
*
pCoder
,
const
SVDropStbReq
*
pReq
);
int32_t
tEncodeSVDropStbReq
(
S
Enc
oder
*
pCoder
,
const
SVDropStbReq
*
pReq
);
int32_t
tDecodeSVDropStbReq
(
S
C
oder
*
pCoder
,
SVDropStbReq
*
pReq
);
int32_t
tDecodeSVDropStbReq
(
S
Dec
oder
*
pCoder
,
SVDropStbReq
*
pReq
);
#define TD_CREATE_IF_NOT_EXISTS 0x1
#define TD_CREATE_IF_NOT_EXISTS 0x1
typedef
struct
SVCreateTbReq
{
typedef
struct
SVCreateTbReq
{
...
@@ -1563,7 +1563,7 @@ typedef struct SVCreateTbReq {
...
@@ -1563,7 +1563,7 @@ typedef struct SVCreateTbReq {
union
{
union
{
struct
{
struct
{
tb_uid_t
suid
;
tb_uid_t
suid
;
const
void
*
pTag
;
const
uint8_t
*
pTag
;
}
ctb
;
}
ctb
;
struct
{
struct
{
SSchemaWrapper
schema
;
SSchemaWrapper
schema
;
...
@@ -1571,8 +1571,8 @@ typedef struct SVCreateTbReq {
...
@@ -1571,8 +1571,8 @@ typedef struct SVCreateTbReq {
};
};
}
SVCreateTbReq
;
}
SVCreateTbReq
;
int
tEncodeSVCreateTbReq
(
S
C
oder
*
pCoder
,
const
SVCreateTbReq
*
pReq
);
int
tEncodeSVCreateTbReq
(
S
Enc
oder
*
pCoder
,
const
SVCreateTbReq
*
pReq
);
int
tDecodeSVCreateTbReq
(
S
C
oder
*
pCoder
,
SVCreateTbReq
*
pReq
);
int
tDecodeSVCreateTbReq
(
S
Dec
oder
*
pCoder
,
SVCreateTbReq
*
pReq
);
typedef
struct
{
typedef
struct
{
int32_t
nReqs
;
int32_t
nReqs
;
...
@@ -1582,15 +1582,15 @@ typedef struct {
...
@@ -1582,15 +1582,15 @@ typedef struct {
};
};
}
SVCreateTbBatchReq
;
}
SVCreateTbBatchReq
;
int
tEncodeSVCreateTbBatchReq
(
S
C
oder
*
pCoder
,
const
SVCreateTbBatchReq
*
pReq
);
int
tEncodeSVCreateTbBatchReq
(
S
Enc
oder
*
pCoder
,
const
SVCreateTbBatchReq
*
pReq
);
int
tDecodeSVCreateTbBatchReq
(
S
C
oder
*
pCoder
,
SVCreateTbBatchReq
*
pReq
);
int
tDecodeSVCreateTbBatchReq
(
S
Dec
oder
*
pCoder
,
SVCreateTbBatchReq
*
pReq
);
typedef
struct
{
typedef
struct
{
int32_t
code
;
int32_t
code
;
}
SVCreateTbRsp
,
SVUpdateTbRsp
;
}
SVCreateTbRsp
,
SVUpdateTbRsp
;
int
tEncodeSVCreateTbRsp
(
S
C
oder
*
pCoder
,
const
SVCreateTbRsp
*
pRsp
);
int
tEncodeSVCreateTbRsp
(
S
Enc
oder
*
pCoder
,
const
SVCreateTbRsp
*
pRsp
);
int
tDecodeSVCreateTbRsp
(
S
C
oder
*
pCoder
,
SVCreateTbRsp
*
pRsp
);
int
tDecodeSVCreateTbRsp
(
S
Dec
oder
*
pCoder
,
SVCreateTbRsp
*
pRsp
);
int32_t
tSerializeSVCreateTbReq
(
void
**
buf
,
SVCreateTbReq
*
pReq
);
int32_t
tSerializeSVCreateTbReq
(
void
**
buf
,
SVCreateTbReq
*
pReq
);
void
*
tDeserializeSVCreateTbReq
(
void
*
buf
,
SVCreateTbReq
*
pReq
);
void
*
tDeserializeSVCreateTbReq
(
void
*
buf
,
SVCreateTbReq
*
pReq
);
...
@@ -1603,8 +1603,8 @@ typedef struct {
...
@@ -1603,8 +1603,8 @@ typedef struct {
};
};
}
SVCreateTbBatchRsp
;
}
SVCreateTbBatchRsp
;
int
tEncodeSVCreateTbBatchRsp
(
S
C
oder
*
pCoder
,
const
SVCreateTbBatchRsp
*
pRsp
);
int
tEncodeSVCreateTbBatchRsp
(
S
Enc
oder
*
pCoder
,
const
SVCreateTbBatchRsp
*
pRsp
);
int
tDecodeSVCreateTbBatchRsp
(
S
C
oder
*
pCoder
,
SVCreateTbBatchRsp
*
pRsp
);
int
tDecodeSVCreateTbBatchRsp
(
S
Dec
oder
*
pCoder
,
SVCreateTbBatchRsp
*
pRsp
);
int32_t
tSerializeSVCreateTbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SVCreateTbBatchRsp
*
pRsp
);
int32_t
tSerializeSVCreateTbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SVCreateTbBatchRsp
*
pRsp
);
int32_t
tDeserializeSVCreateTbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SVCreateTbBatchRsp
*
pRsp
);
int32_t
tDeserializeSVCreateTbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SVCreateTbBatchRsp
*
pRsp
);
...
@@ -1627,8 +1627,8 @@ typedef struct {
...
@@ -1627,8 +1627,8 @@ typedef struct {
};
};
}
SVDropTbBatchReq
;
}
SVDropTbBatchReq
;
int32_t
tEncodeSVDropTbBatchReq
(
S
C
oder
*
pCoder
,
const
SVDropTbBatchReq
*
pReq
);
int32_t
tEncodeSVDropTbBatchReq
(
S
Enc
oder
*
pCoder
,
const
SVDropTbBatchReq
*
pReq
);
int32_t
tDecodeSVDropTbBatchReq
(
S
C
oder
*
pCoder
,
SVDropTbBatchReq
*
pReq
);
int32_t
tDecodeSVDropTbBatchReq
(
S
Dec
oder
*
pCoder
,
SVDropTbBatchReq
*
pReq
);
typedef
struct
{
typedef
struct
{
int32_t
nRsps
;
int32_t
nRsps
;
...
@@ -1638,8 +1638,8 @@ typedef struct {
...
@@ -1638,8 +1638,8 @@ typedef struct {
};
};
}
SVDropTbBatchRsp
;
}
SVDropTbBatchRsp
;
int32_t
tEncodeSVDropTbBatchRsp
(
S
C
oder
*
pCoder
,
const
SVDropTbBatchRsp
*
pRsp
);
int32_t
tEncodeSVDropTbBatchRsp
(
S
Enc
oder
*
pCoder
,
const
SVDropTbBatchRsp
*
pRsp
);
int32_t
tDecodeSVDropTbBatchRsp
(
S
C
oder
*
pCoder
,
SVDropTbBatchRsp
*
pRsp
);
int32_t
tDecodeSVDropTbBatchRsp
(
S
Dec
oder
*
pCoder
,
SVDropTbBatchRsp
*
pRsp
);
typedef
struct
{
typedef
struct
{
SMsgHead
head
;
SMsgHead
head
;
...
@@ -1821,14 +1821,14 @@ static FORCE_INLINE void tFreeClientHbBatchRsp(void* pRsp) {
...
@@ -1821,14 +1821,14 @@ static FORCE_INLINE void tFreeClientHbBatchRsp(void* pRsp) {
int32_t
tSerializeSClientHbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SClientHbBatchRsp
*
pBatchRsp
);
int32_t
tSerializeSClientHbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SClientHbBatchRsp
*
pBatchRsp
);
int32_t
tDeserializeSClientHbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SClientHbBatchRsp
*
pBatchRsp
);
int32_t
tDeserializeSClientHbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SClientHbBatchRsp
*
pBatchRsp
);
static
FORCE_INLINE
int32_t
tEncodeSKv
(
S
C
oder
*
pEncoder
,
const
SKv
*
pKv
)
{
static
FORCE_INLINE
int32_t
tEncodeSKv
(
S
Enc
oder
*
pEncoder
,
const
SKv
*
pKv
)
{
if
(
tEncodeI32
(
pEncoder
,
pKv
->
key
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pKv
->
key
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pKv
->
valueLen
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pKv
->
valueLen
)
<
0
)
return
-
1
;
if
(
tEncodeBinary
(
pEncoder
,
(
const
char
*
)
pKv
->
value
,
pKv
->
valueLen
)
<
0
)
return
-
1
;
if
(
tEncodeBinary
(
pEncoder
,
(
uint8_t
*
)
pKv
->
value
,
pKv
->
valueLen
)
<
0
)
return
-
1
;
return
0
;
return
0
;
}
}
static
FORCE_INLINE
int32_t
tDecodeSKv
(
S
C
oder
*
pDecoder
,
SKv
*
pKv
)
{
static
FORCE_INLINE
int32_t
tDecodeSKv
(
S
Dec
oder
*
pDecoder
,
SKv
*
pKv
)
{
if
(
tDecodeI32
(
pDecoder
,
&
pKv
->
key
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pKv
->
key
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pKv
->
valueLen
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pKv
->
valueLen
)
<
0
)
return
-
1
;
pKv
->
value
=
taosMemoryMalloc
(
pKv
->
valueLen
+
1
);
pKv
->
value
=
taosMemoryMalloc
(
pKv
->
valueLen
+
1
);
...
@@ -1837,13 +1837,13 @@ static FORCE_INLINE int32_t tDecodeSKv(SCoder* pDecoder, SKv* pKv) {
...
@@ -1837,13 +1837,13 @@ static FORCE_INLINE int32_t tDecodeSKv(SCoder* pDecoder, SKv* pKv) {
return
0
;
return
0
;
}
}
static
FORCE_INLINE
int32_t
tEncodeSClientHbKey
(
S
C
oder
*
pEncoder
,
const
SClientHbKey
*
pKey
)
{
static
FORCE_INLINE
int32_t
tEncodeSClientHbKey
(
S
Enc
oder
*
pEncoder
,
const
SClientHbKey
*
pKey
)
{
if
(
tEncodeI64
(
pEncoder
,
pKey
->
tscRid
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pKey
->
tscRid
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pKey
->
connType
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pKey
->
connType
)
<
0
)
return
-
1
;
return
0
;
return
0
;
}
}
static
FORCE_INLINE
int32_t
tDecodeSClientHbKey
(
S
C
oder
*
pDecoder
,
SClientHbKey
*
pKey
)
{
static
FORCE_INLINE
int32_t
tDecodeSClientHbKey
(
S
Dec
oder
*
pDecoder
,
SClientHbKey
*
pKey
)
{
if
(
tDecodeI64
(
pDecoder
,
&
pKey
->
tscRid
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pKey
->
tscRid
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pKey
->
connType
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pKey
->
connType
)
<
0
)
return
-
1
;
return
0
;
return
0
;
...
@@ -2046,10 +2046,10 @@ typedef struct {
...
@@ -2046,10 +2046,10 @@ typedef struct {
int32_t
reserved
;
int32_t
reserved
;
}
SMqCMCommitOffsetRsp
;
}
SMqCMCommitOffsetRsp
;
int32_t
tEncodeSMqOffset
(
S
C
oder
*
encoder
,
const
SMqOffset
*
pOffset
);
int32_t
tEncodeSMqOffset
(
S
Enc
oder
*
encoder
,
const
SMqOffset
*
pOffset
);
int32_t
tDecodeSMqOffset
(
S
C
oder
*
decoder
,
SMqOffset
*
pOffset
);
int32_t
tDecodeSMqOffset
(
S
Dec
oder
*
decoder
,
SMqOffset
*
pOffset
);
int32_t
tEncodeSMqCMCommitOffsetReq
(
S
C
oder
*
encoder
,
const
SMqCMCommitOffsetReq
*
pReq
);
int32_t
tEncodeSMqCMCommitOffsetReq
(
S
Enc
oder
*
encoder
,
const
SMqCMCommitOffsetReq
*
pReq
);
int32_t
tDecodeSMqCMCommitOffsetReq
(
S
C
oder
*
decoder
,
SMqCMCommitOffsetReq
*
pReq
);
int32_t
tDecodeSMqCMCommitOffsetReq
(
S
Dec
oder
*
decoder
,
SMqCMCommitOffsetReq
*
pReq
);
static
FORCE_INLINE
SSchemaWrapper
*
tCloneSSchemaWrapper
(
const
SSchemaWrapper
*
pSchemaWrapper
)
{
static
FORCE_INLINE
SSchemaWrapper
*
tCloneSSchemaWrapper
(
const
SSchemaWrapper
*
pSchemaWrapper
)
{
SSchemaWrapper
*
pSW
=
(
SSchemaWrapper
*
)
taosMemoryMalloc
(
sizeof
(
SSchemaWrapper
));
SSchemaWrapper
*
pSW
=
(
SSchemaWrapper
*
)
taosMemoryMalloc
(
sizeof
(
SSchemaWrapper
));
...
@@ -2089,7 +2089,7 @@ static FORCE_INLINE void* taosDecodeSSchema(const void* buf, SSchema* pSchema) {
...
@@ -2089,7 +2089,7 @@ static FORCE_INLINE void* taosDecodeSSchema(const void* buf, SSchema* pSchema) {
return
(
void
*
)
buf
;
return
(
void
*
)
buf
;
}
}
static
FORCE_INLINE
int32_t
tEncodeSSchema
(
S
C
oder
*
pEncoder
,
const
SSchema
*
pSchema
)
{
static
FORCE_INLINE
int32_t
tEncodeSSchema
(
S
Enc
oder
*
pEncoder
,
const
SSchema
*
pSchema
)
{
if
(
tEncodeI8
(
pEncoder
,
pSchema
->
type
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pSchema
->
type
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pSchema
->
flags
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pSchema
->
flags
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pEncoder
,
pSchema
->
bytes
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pEncoder
,
pSchema
->
bytes
)
<
0
)
return
-
1
;
...
@@ -2098,7 +2098,7 @@ static FORCE_INLINE int32_t tEncodeSSchema(SCoder* pEncoder, const SSchema* pSch
...
@@ -2098,7 +2098,7 @@ static FORCE_INLINE int32_t tEncodeSSchema(SCoder* pEncoder, const SSchema* pSch
return
0
;
return
0
;
}
}
static
FORCE_INLINE
int32_t
tDecodeSSchema
(
S
C
oder
*
pDecoder
,
SSchema
*
pSchema
)
{
static
FORCE_INLINE
int32_t
tDecodeSSchema
(
S
Dec
oder
*
pDecoder
,
SSchema
*
pSchema
)
{
if
(
tDecodeI8
(
pDecoder
,
&
pSchema
->
type
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pSchema
->
type
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pSchema
->
flags
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pSchema
->
flags
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pDecoder
,
&
pSchema
->
bytes
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pDecoder
,
&
pSchema
->
bytes
)
<
0
)
return
-
1
;
...
@@ -2131,7 +2131,7 @@ static FORCE_INLINE void* taosDecodeSSchemaWrapper(const void* buf, SSchemaWrapp
...
@@ -2131,7 +2131,7 @@ static FORCE_INLINE void* taosDecodeSSchemaWrapper(const void* buf, SSchemaWrapp
return
(
void
*
)
buf
;
return
(
void
*
)
buf
;
}
}
static
FORCE_INLINE
int32_t
tEncodeSSchemaWrapper
(
S
C
oder
*
pEncoder
,
const
SSchemaWrapper
*
pSW
)
{
static
FORCE_INLINE
int32_t
tEncodeSSchemaWrapper
(
S
Enc
oder
*
pEncoder
,
const
SSchemaWrapper
*
pSW
)
{
if
(
tEncodeI32v
(
pEncoder
,
pSW
->
nCols
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pEncoder
,
pSW
->
nCols
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pEncoder
,
pSW
->
sver
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pEncoder
,
pSW
->
sver
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
pSW
->
nCols
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
pSW
->
nCols
;
i
++
)
{
...
@@ -2141,7 +2141,7 @@ static FORCE_INLINE int32_t tEncodeSSchemaWrapper(SCoder* pEncoder, const SSchem
...
@@ -2141,7 +2141,7 @@ static FORCE_INLINE int32_t tEncodeSSchemaWrapper(SCoder* pEncoder, const SSchem
return
0
;
return
0
;
}
}
static
FORCE_INLINE
int32_t
tDecodeSSchemaWrapper
(
S
C
oder
*
pDecoder
,
SSchemaWrapper
*
pSW
)
{
static
FORCE_INLINE
int32_t
tDecodeSSchemaWrapper
(
S
Dec
oder
*
pDecoder
,
SSchemaWrapper
*
pSW
)
{
if
(
tDecodeI32v
(
pDecoder
,
&
pSW
->
nCols
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pDecoder
,
&
pSW
->
nCols
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pDecoder
,
&
pSW
->
sver
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pDecoder
,
&
pSW
->
sver
)
<
0
)
return
-
1
;
...
@@ -2596,8 +2596,8 @@ typedef struct {
...
@@ -2596,8 +2596,8 @@ typedef struct {
int64_t
suid
;
int64_t
suid
;
int64_t
uid
;
int64_t
uid
;
int32_t
sver
;
int32_t
sver
;
uint
64_t
nData
;
uint
32_t
nData
;
const
void
*
pData
;
const
uint8_t
*
pData
;
SVCreateTbReq
cTbReq
;
SVCreateTbReq
cTbReq
;
}
SVSubmitBlk
;
}
SVSubmitBlk
;
...
@@ -2610,8 +2610,8 @@ typedef struct {
...
@@ -2610,8 +2610,8 @@ typedef struct {
};
};
}
SVSubmitReq
;
}
SVSubmitReq
;
int32_t
tEncodeSVSubmitReq
(
S
C
oder
*
pCoder
,
const
SVSubmitReq
*
pReq
);
int32_t
tEncodeSVSubmitReq
(
S
Enc
oder
*
pCoder
,
const
SVSubmitReq
*
pReq
);
int32_t
tDecodeSVSubmitReq
(
S
C
oder
*
pCoder
,
SVSubmitReq
*
pReq
);
int32_t
tDecodeSVSubmitReq
(
S
Dec
oder
*
pCoder
,
SVSubmitReq
*
pReq
);
#pragma pack(pop)
#pragma pack(pop)
...
...
include/libs/stream/tstream.h
浏览文件 @
a06bf6e5
...
@@ -154,8 +154,8 @@ typedef struct {
...
@@ -154,8 +154,8 @@ typedef struct {
}
SStreamTask
;
}
SStreamTask
;
SStreamTask
*
tNewSStreamTask
(
int64_t
streamId
);
SStreamTask
*
tNewSStreamTask
(
int64_t
streamId
);
int32_t
tEncodeSStreamTask
(
S
C
oder
*
pEncoder
,
const
SStreamTask
*
pTask
);
int32_t
tEncodeSStreamTask
(
S
Enc
oder
*
pEncoder
,
const
SStreamTask
*
pTask
);
int32_t
tDecodeSStreamTask
(
S
C
oder
*
pDecoder
,
SStreamTask
*
pTask
);
int32_t
tDecodeSStreamTask
(
S
Dec
oder
*
pDecoder
,
SStreamTask
*
pTask
);
void
tFreeSStreamTask
(
SStreamTask
*
pTask
);
void
tFreeSStreamTask
(
SStreamTask
*
pTask
);
typedef
struct
{
typedef
struct
{
...
...
include/util/tencode.h
浏览文件 @
a06bf6e5
...
@@ -24,6 +24,29 @@
...
@@ -24,6 +24,29 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
typedef
struct
SEncoderNode
SEncoderNode
;
typedef
struct
SDecoderNode
SDecoderNode
;
typedef
struct
SCoderMem
{
struct
SCoderMem
*
next
;
}
SCoderMem
;
typedef
struct
{
uint8_t
*
data
;
uint32_t
size
;
uint32_t
pos
;
SCoderMem
*
mList
;
SEncoderNode
*
eStack
;
}
SEncoder
;
typedef
struct
{
const
uint8_t
*
data
;
uint32_t
size
;
uint32_t
pos
;
SCoderMem
*
mList
;
SDecoderNode
*
dStack
;
}
SDecoder
;
#define tPut(TYPE, BUF, VAL) ((TYPE*)(BUF))[0] = (VAL)
#define tPut(TYPE, BUF, VAL) ((TYPE*)(BUF))[0] = (VAL)
#define tGet(TYPE, BUF, VAL) (VAL) = ((TYPE*)(BUF))[0]
#define tGet(TYPE, BUF, VAL) (VAL) = ((TYPE*)(BUF))[0]
...
@@ -51,131 +74,84 @@ extern "C" {
...
@@ -51,131 +74,84 @@ extern "C" {
#define tRGet32 tRPut32
#define tRGet32 tRPut32
#define tRGet64 tRPut64
#define tRGet64 tRPut64
typedef
enum
{
TD_ENCODER
,
TD_DECODER
}
td_coder_t
;
#define CODER_NODE_FIELDS \
uint8_t* data; \
int32_t size; \
int32_t pos;
struct
SCoderNode
{
TD_SLIST_NODE
(
SCoderNode
);
CODER_NODE_FIELDS
};
typedef
struct
SCoderMem
{
struct
SCoderMem
*
next
;
}
SCoderMem
;
typedef
struct
{
td_coder_t
type
;
td_endian_t
endian
;
SCoderMem
*
mList
;
CODER_NODE_FIELDS
TD_SLIST
(
SCoderNode
)
stack
;
}
SCoder
;
#define TD_CODER_POS(CODER) ((CODER)->pos)
#define TD_CODER_POS(CODER) ((CODER)->pos)
#define TD_CODER_CURRENT(CODER) ((CODER)->data + (CODER)->pos)
#define TD_CODER_CURRENT(CODER) ((CODER)->data + (CODER)->pos)
#define TD_CODER_MOVE_POS(CODER, MOVE) ((CODER)->pos += (MOVE))
#define TD_CODER_MOVE_POS(CODER, MOVE) ((CODER)->pos += (MOVE))
#define TD_CODER_CHECK_CAPACITY_FAILED(CODER, EXPSIZE) (((CODER)->size - (CODER)->pos) < (EXPSIZE))
#define TD_CODER_CHECK_CAPACITY_FAILED(CODER, EXPSIZE) (((CODER)->size - (CODER)->pos) < (EXPSIZE))
static
FORCE_INLINE
void
*
tCoderMalloc
(
SCoder
*
pCoder
,
int32_t
size
)
{
void
*
ptr
=
NULL
;
SCoderMem
*
pMem
=
(
SCoderMem
*
)
taosMemoryMalloc
(
sizeof
(
SCoderMem
*
)
+
size
);
if
(
pMem
)
{
pMem
->
next
=
pCoder
->
mList
;
pCoder
->
mList
=
pMem
;
ptr
=
(
void
*
)
&
pMem
[
1
];
}
return
ptr
;
}
#define tEncodeSize(E, S, SIZE, RET) \
#define tEncodeSize(E, S, SIZE, RET) \
do { \
do { \
SCoder coder = {0}; \
SEncoder coder = {0}; \
RET = 0; \
tEncoderInit(&coder, NULL, 0); \
tCoderInit(&coder, TD_LITTLE_ENDIAN, NULL, 0, TD_ENCODER); \
if ((E)(&coder, S) == 0) { \
if ((E)(&coder, S) == 0) { \
SIZE = coder.pos; \
SIZE = coder.pos; \
RET = 0; \
} else { \
} else { \
RET = -1; \
RET = -1; \
} \
} \
t
CoderClear(&coder);
\
t
EncoderClear(&coder);
\
} while (0)
} while (0)
// #define tEncodeSize(E, S, SIZE) \
// ({ \
static
void
*
tEncoderMalloc
(
SEncoder
*
pCoder
,
int32_t
size
);
// SCoder coder = {0}; \
static
void
*
tDecoderMalloc
(
SDecoder
*
pCoder
,
int32_t
size
);
// int ret = 0; \
// tCoderInit(&coder, TD_LITTLE_ENDIAN, NULL, 0, TD_ENCODER); \
// if ((E)(&coder, S) == 0) { \
// SIZE = coder.pos; \
// } else { \
// ret = -1; \
// } \
// tCoderClear(&coder); \
// ret; \
// })
void
tCoderInit
(
SCoder
*
pCoder
,
td_endian_t
endian
,
uint8_t
*
data
,
int32_t
size
,
td_coder_t
type
);
void
tCoderClear
(
SCoder
*
pCoder
);
/* ------------------------ ENCODE ------------------------ */
/* ------------------------ ENCODE ------------------------ */
int32_t
tStartEncode
(
SCoder
*
pEncoder
);
void
tEncoderInit
(
SEncoder
*
pCoder
,
uint8_t
*
data
,
uint32_t
size
);
void
tEndEncode
(
SCoder
*
pEncoder
);
void
tEncoderClear
(
SEncoder
*
pCoder
);
static
int32_t
tEncodeU8
(
SCoder
*
pEncoder
,
uint8_t
val
);
int32_t
tStartEncode
(
SEncoder
*
pCoder
);
static
int32_t
tEncodeI8
(
SCoder
*
pEncoder
,
int8_t
val
);
void
tEndEncode
(
SEncoder
*
pCoder
);
static
int32_t
tEncodeU16
(
SCoder
*
pEncoder
,
uint16_t
val
);
static
int32_t
tEncodeU8
(
SEncoder
*
pCoder
,
uint8_t
val
);
static
int32_t
tEncodeI16
(
SCoder
*
pEncoder
,
int16_t
val
);
static
int32_t
tEncodeI8
(
SEncoder
*
pCoder
,
int8_t
val
);
static
int32_t
tEncodeU32
(
SCoder
*
pEncoder
,
uint32_t
val
);
static
int32_t
tEncodeU16
(
SEncoder
*
pCoder
,
uint16_t
val
);
static
int32_t
tEncodeI32
(
SCoder
*
pEncoder
,
int32_t
val
);
static
int32_t
tEncodeI16
(
SEncoder
*
pCoder
,
int16_t
val
);
static
int32_t
tEncodeU64
(
SCoder
*
pEncoder
,
uint64_t
val
);
static
int32_t
tEncodeU32
(
SEncoder
*
pCoder
,
uint32_t
val
);
static
int32_t
tEncodeI64
(
SCoder
*
pEncoder
,
int64_t
val
);
static
int32_t
tEncodeI32
(
SEncoder
*
pCoder
,
int32_t
val
);
static
int32_t
tEncodeU16v
(
SCoder
*
pEncoder
,
uint16_t
val
);
static
int32_t
tEncodeU64
(
SEncoder
*
pCoder
,
uint64_t
val
);
static
int32_t
tEncodeI16v
(
SCoder
*
pEncoder
,
int16_t
val
);
static
int32_t
tEncodeI64
(
SEncoder
*
pCoder
,
int64_t
val
);
static
int32_t
tEncodeU32v
(
SCoder
*
pEncoder
,
uint32_t
val
);
static
int32_t
tEncodeU16v
(
SEncoder
*
pCoder
,
uint16_t
val
);
static
int32_t
tEncodeI32v
(
SCoder
*
pEncoder
,
int32_t
val
);
static
int32_t
tEncodeI16v
(
SEncoder
*
pCoder
,
int16_t
val
);
static
int32_t
tEncodeU64v
(
SCoder
*
pEncoder
,
uint64_t
val
);
static
int32_t
tEncodeU32v
(
SEncoder
*
pCoder
,
uint32_t
val
);
static
int32_t
tEncodeI64v
(
SCoder
*
pEncoder
,
int64_t
val
);
static
int32_t
tEncodeI32v
(
SEncoder
*
pCoder
,
int32_t
val
);
static
int32_t
tEncodeFloat
(
SCoder
*
pEncoder
,
float
val
);
static
int32_t
tEncodeU64v
(
SEncoder
*
pCoder
,
uint64_t
val
);
static
int32_t
tEncodeDouble
(
SCoder
*
pEncoder
,
double
val
);
static
int32_t
tEncodeI64v
(
SEncoder
*
pCoder
,
int64_t
val
);
static
int32_t
tEncodeBinary
(
SCoder
*
pEncoder
,
const
void
*
val
,
uint64_t
len
);
static
int32_t
tEncodeFloat
(
SEncoder
*
pCoder
,
float
val
);
static
int32_t
tEncodeCStrWithLen
(
SCoder
*
pEncoder
,
const
char
*
val
,
uint64_t
len
);
static
int32_t
tEncodeDouble
(
SEncoder
*
pCoder
,
double
val
);
static
int32_t
tEncodeCStr
(
SCoder
*
pEncoder
,
const
char
*
val
);
static
int32_t
tEncodeBinary
(
SEncoder
*
pCoder
,
const
uint8_t
*
val
,
uint32_t
len
);
static
int32_t
tEncodeCStrWithLen
(
SEncoder
*
pCoder
,
const
char
*
val
,
uint32_t
len
);
static
int32_t
tEncodeCStr
(
SEncoder
*
pCoder
,
const
char
*
val
);
/* ------------------------ DECODE ------------------------ */
/* ------------------------ DECODE ------------------------ */
int32_t
tStartDecode
(
SCoder
*
pDecoder
);
void
tDecoderInit
(
SDecoder
*
pCoder
,
const
uint8_t
*
data
,
uint32_t
size
);
void
tEndDecode
(
SCoder
*
pDecoder
);
void
tDecoderClear
(
SDecoder
*
SDecoder
);
static
bool
tDecodeIsEnd
(
SCoder
*
pCoder
);
int32_t
tStartDecode
(
SDecoder
*
pCoder
);
static
int32_t
tDecodeU8
(
SCoder
*
pDecoder
,
uint8_t
*
val
);
void
tEndDecode
(
SDecoder
*
pCoder
);
static
int32_t
tDecodeI8
(
SCoder
*
pDecoder
,
int8_t
*
val
);
static
bool
tDecodeIsEnd
(
SDecoder
*
pCoder
);
static
int32_t
tDecodeU16
(
SCoder
*
pDecoder
,
uint16_t
*
val
);
static
int32_t
tDecodeU8
(
SDecoder
*
pCoder
,
uint8_t
*
val
);
static
int32_t
tDecodeI16
(
SCoder
*
pDecoder
,
int16_t
*
val
);
static
int32_t
tDecodeI8
(
SDecoder
*
pCoder
,
int8_t
*
val
);
static
int32_t
tDecodeU32
(
SCoder
*
pDecoder
,
uint32_t
*
val
);
static
int32_t
tDecodeU16
(
SDecoder
*
pCoder
,
uint16_t
*
val
);
static
int32_t
tDecodeI32
(
SCoder
*
pDecoder
,
int32_t
*
val
);
static
int32_t
tDecodeI16
(
SDecoder
*
pCoder
,
int16_t
*
val
);
static
int32_t
tDecodeU64
(
SCoder
*
pDecoder
,
uint64_t
*
val
);
static
int32_t
tDecodeU32
(
SDecoder
*
pCoder
,
uint32_t
*
val
);
static
int32_t
tDecodeI64
(
SCoder
*
pDecoder
,
int64_t
*
val
);
static
int32_t
tDecodeI32
(
SDecoder
*
pCoder
,
int32_t
*
val
);
static
int32_t
tDecodeU16v
(
SCoder
*
pDecoder
,
uint16_t
*
val
);
static
int32_t
tDecodeU64
(
SDecoder
*
pCoder
,
uint64_t
*
val
);
static
int32_t
tDecodeI16v
(
SCoder
*
pDecoder
,
int16_t
*
val
);
static
int32_t
tDecodeI64
(
SDecoder
*
pCoder
,
int64_t
*
val
);
static
int32_t
tDecodeU32v
(
SCoder
*
pDecoder
,
uint32_t
*
val
);
static
int32_t
tDecodeU16v
(
SDecoder
*
pCoder
,
uint16_t
*
val
);
static
int32_t
tDecodeI32v
(
SCoder
*
pDecoder
,
int32_t
*
val
);
static
int32_t
tDecodeI16v
(
SDecoder
*
pCoder
,
int16_t
*
val
);
static
int32_t
tDecodeU64v
(
SCoder
*
pDecoder
,
uint64_t
*
val
);
static
int32_t
tDecodeU32v
(
SDecoder
*
pCoder
,
uint32_t
*
val
);
static
int32_t
tDecodeI64v
(
SCoder
*
pDecoder
,
int64_t
*
val
);
static
int32_t
tDecodeI32v
(
SDecoder
*
pCoder
,
int32_t
*
val
);
static
int32_t
tDecodeFloat
(
SCoder
*
pDecoder
,
float
*
val
);
static
int32_t
tDecodeU64v
(
SDecoder
*
pCoder
,
uint64_t
*
val
);
static
int32_t
tDecodeDouble
(
SCoder
*
pDecoder
,
double
*
val
);
static
int32_t
tDecodeI64v
(
SDecoder
*
pCoder
,
int64_t
*
val
);
static
int32_t
tDecodeBinary
(
SCoder
*
pDecoder
,
const
void
**
val
,
uint64_t
*
len
);
static
int32_t
tDecodeFloat
(
SDecoder
*
pCoder
,
float
*
val
);
static
int32_t
tDecodeCStrAndLen
(
SCoder
*
pDecoder
,
const
char
**
val
,
uint64_t
*
len
);
static
int32_t
tDecodeDouble
(
SDecoder
*
pCoder
,
double
*
val
);
static
int32_t
tDecodeCStr
(
SCoder
*
pDecoder
,
const
char
**
val
);
static
int32_t
tDecodeBinary
(
SDecoder
*
pCoder
,
const
uint8_t
**
val
,
uint32_t
*
len
);
static
int32_t
tDecodeCStrTo
(
SCoder
*
pDecoder
,
char
*
val
);
static
int32_t
tDecodeCStrAndLen
(
SDecoder
*
pCoder
,
const
char
**
val
,
uint32_t
*
len
);
static
int32_t
tDecodeCStr
(
SDecoder
*
pCoder
,
const
char
**
val
);
static
int32_t
tDecodeCStrTo
(
SDecoder
*
pCoder
,
char
*
val
);
/* ------------------------ IMPL ------------------------ */
/* ------------------------ IMPL ------------------------ */
#define TD_ENCODE_MACRO(CODER, VAL, TYPE, BITS) \
#define TD_ENCODE_MACRO(CODER, VAL, TYPE, BITS) \
if ((CODER)->data) { \
if ((CODER)->data) { \
if (TD_CODER_CHECK_CAPACITY_FAILED(CODER, sizeof(VAL))) return -1; \
if (TD_CODER_CHECK_CAPACITY_FAILED(CODER, sizeof(VAL))) return -1; \
if (TD_RT_ENDIAN() == (CODER)->endian) { \
tPut(TYPE, TD_CODER_CURRENT(CODER), (VAL)); \
tPut(TYPE, TD_CODER_CURRENT(CODER), (VAL)); \
} else { \
tRPut##BITS(TD_CODER_CURRENT(CODER), &(VAL)); \
} \
} \
} \
TD_CODER_MOVE_POS(CODER, sizeof(VAL)); \
TD_CODER_MOVE_POS(CODER, sizeof(VAL)); \
return 0;
return 0;
...
@@ -200,12 +176,7 @@ static int32_t tDecodeCStrTo(SCoder* pDecoder, char* val);
...
@@ -200,12 +176,7 @@ static int32_t tDecodeCStrTo(SCoder* pDecoder, char* val);
#define TD_DECODE_MACRO(CODER, PVAL, TYPE, BITS) \
#define TD_DECODE_MACRO(CODER, PVAL, TYPE, BITS) \
if (TD_CODER_CHECK_CAPACITY_FAILED(CODER, sizeof(*(PVAL)))) return -1; \
if (TD_CODER_CHECK_CAPACITY_FAILED(CODER, sizeof(*(PVAL)))) return -1; \
if (TD_RT_ENDIAN() == (CODER)->endian) { \
tGet(TYPE, TD_CODER_CURRENT(CODER), *(PVAL)); \
tGet(TYPE, TD_CODER_CURRENT(CODER), *(PVAL)); \
} else { \
tRGet##BITS(PVAL, TD_CODER_CURRENT(CODER)); \
} \
\
TD_CODER_MOVE_POS(CODER, sizeof(*(PVAL))); \
TD_CODER_MOVE_POS(CODER, sizeof(*(PVAL))); \
return 0;
return 0;
...
@@ -217,140 +188,134 @@ static int32_t tDecodeCStrTo(SCoder* pDecoder, char* val);
...
@@ -217,140 +188,134 @@ static int32_t tDecodeCStrTo(SCoder* pDecoder, char* val);
TYPE tval = TD_CODER_CURRENT(CODER)[0]; \
TYPE tval = TD_CODER_CURRENT(CODER)[0]; \
if (tval < ENCODE_LIMIT) { \
if (tval < ENCODE_LIMIT) { \
*(PVAL) |= (tval << (7 * i)); \
*(PVAL) |= (tval << (7 * i)); \
TD_CODER_MOVE_POS(p
Decoder, 1);
\
TD_CODER_MOVE_POS(p
Coder, 1);
\
break; \
break; \
} else { \
} else { \
*(PVAL) |= (((tval) & (ENCODE_LIMIT - 1)) << (7 * i)); \
*(PVAL) |= (((tval) & (ENCODE_LIMIT - 1)) << (7 * i)); \
i++; \
i++; \
TD_CODER_MOVE_POS(p
Decoder, 1);
\
TD_CODER_MOVE_POS(p
Coder, 1);
\
} \
} \
} \
} \
\
\
return 0;
return 0;
// 8
// 8
static
FORCE_INLINE
int32_t
tEncodeU8
(
S
Coder
*
pEnc
oder
,
uint8_t
val
)
{
static
FORCE_INLINE
int32_t
tEncodeU8
(
S
Encoder
*
pC
oder
,
uint8_t
val
)
{
if
(
p
Enc
oder
->
data
)
{
if
(
p
C
oder
->
data
)
{
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
p
Enc
oder
,
sizeof
(
val
)))
return
-
1
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
p
C
oder
,
sizeof
(
val
)))
return
-
1
;
tPut
(
uint8_t
,
TD_CODER_CURRENT
(
p
Enc
oder
),
val
);
tPut
(
uint8_t
,
TD_CODER_CURRENT
(
p
C
oder
),
val
);
}
}
TD_CODER_MOVE_POS
(
p
Enc
oder
,
sizeof
(
val
));
TD_CODER_MOVE_POS
(
p
C
oder
,
sizeof
(
val
));
return
0
;
return
0
;
}
}
static
FORCE_INLINE
int32_t
tEncodeI8
(
S
Coder
*
pEnc
oder
,
int8_t
val
)
{
static
FORCE_INLINE
int32_t
tEncodeI8
(
S
Encoder
*
pC
oder
,
int8_t
val
)
{
if
(
p
Enc
oder
->
data
)
{
if
(
p
C
oder
->
data
)
{
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
p
Enc
oder
,
sizeof
(
val
)))
return
-
1
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
p
C
oder
,
sizeof
(
val
)))
return
-
1
;
tPut
(
int8_t
,
TD_CODER_CURRENT
(
p
Enc
oder
),
val
);
tPut
(
int8_t
,
TD_CODER_CURRENT
(
p
C
oder
),
val
);
}
}
TD_CODER_MOVE_POS
(
p
Enc
oder
,
sizeof
(
val
));
TD_CODER_MOVE_POS
(
p
C
oder
,
sizeof
(
val
));
return
0
;
return
0
;
}
}
// 16
// 16
static
FORCE_INLINE
int32_t
tEncodeU16
(
S
Coder
*
pEncoder
,
uint16_t
val
)
{
TD_ENCODE_MACRO
(
pEnc
oder
,
val
,
uint16_t
,
16
);
}
static
FORCE_INLINE
int32_t
tEncodeU16
(
S
Encoder
*
pCoder
,
uint16_t
val
)
{
TD_ENCODE_MACRO
(
pC
oder
,
val
,
uint16_t
,
16
);
}
static
FORCE_INLINE
int32_t
tEncodeI16
(
S
Coder
*
pEncoder
,
int16_t
val
)
{
TD_ENCODE_MACRO
(
pEnc
oder
,
val
,
int16_t
,
16
);
}
static
FORCE_INLINE
int32_t
tEncodeI16
(
S
Encoder
*
pCoder
,
int16_t
val
)
{
TD_ENCODE_MACRO
(
pC
oder
,
val
,
int16_t
,
16
);
}
// 32
// 32
static
FORCE_INLINE
int32_t
tEncodeU32
(
S
Coder
*
pEncoder
,
uint32_t
val
)
{
TD_ENCODE_MACRO
(
pEnc
oder
,
val
,
uint32_t
,
32
);
}
static
FORCE_INLINE
int32_t
tEncodeU32
(
S
Encoder
*
pCoder
,
uint32_t
val
)
{
TD_ENCODE_MACRO
(
pC
oder
,
val
,
uint32_t
,
32
);
}
static
FORCE_INLINE
int32_t
tEncodeI32
(
S
Coder
*
pEncoder
,
int32_t
val
)
{
TD_ENCODE_MACRO
(
pEnc
oder
,
val
,
int32_t
,
32
);
}
static
FORCE_INLINE
int32_t
tEncodeI32
(
S
Encoder
*
pCoder
,
int32_t
val
)
{
TD_ENCODE_MACRO
(
pC
oder
,
val
,
int32_t
,
32
);
}
// 64
// 64
static
FORCE_INLINE
int32_t
tEncodeU64
(
S
Coder
*
pEncoder
,
uint64_t
val
)
{
TD_ENCODE_MACRO
(
pEnc
oder
,
val
,
uint64_t
,
64
);
}
static
FORCE_INLINE
int32_t
tEncodeU64
(
S
Encoder
*
pCoder
,
uint64_t
val
)
{
TD_ENCODE_MACRO
(
pC
oder
,
val
,
uint64_t
,
64
);
}
static
FORCE_INLINE
int32_t
tEncodeI64
(
S
Coder
*
pEncoder
,
int64_t
val
)
{
TD_ENCODE_MACRO
(
pEnc
oder
,
val
,
int64_t
,
64
);
}
static
FORCE_INLINE
int32_t
tEncodeI64
(
S
Encoder
*
pCoder
,
int64_t
val
)
{
TD_ENCODE_MACRO
(
pC
oder
,
val
,
int64_t
,
64
);
}
// 16v
// 16v
static
FORCE_INLINE
int32_t
tEncodeU16v
(
S
Coder
*
pEncoder
,
uint16_t
val
)
{
TD_ENCODE_VARIANT_MACRO
(
pEnc
oder
,
val
);
}
static
FORCE_INLINE
int32_t
tEncodeU16v
(
S
Encoder
*
pCoder
,
uint16_t
val
)
{
TD_ENCODE_VARIANT_MACRO
(
pC
oder
,
val
);
}
static
FORCE_INLINE
int32_t
tEncodeI16v
(
S
Coder
*
pEnc
oder
,
int16_t
val
)
{
static
FORCE_INLINE
int32_t
tEncodeI16v
(
S
Encoder
*
pC
oder
,
int16_t
val
)
{
return
tEncodeU16v
(
p
Enc
oder
,
ZIGZAGE
(
int16_t
,
val
));
return
tEncodeU16v
(
p
C
oder
,
ZIGZAGE
(
int16_t
,
val
));
}
}
// 32v
// 32v
static
FORCE_INLINE
int32_t
tEncodeU32v
(
S
Coder
*
pEncoder
,
uint32_t
val
)
{
TD_ENCODE_VARIANT_MACRO
(
pEnc
oder
,
val
);
}
static
FORCE_INLINE
int32_t
tEncodeU32v
(
S
Encoder
*
pCoder
,
uint32_t
val
)
{
TD_ENCODE_VARIANT_MACRO
(
pC
oder
,
val
);
}
static
FORCE_INLINE
int32_t
tEncodeI32v
(
S
Coder
*
pEnc
oder
,
int32_t
val
)
{
static
FORCE_INLINE
int32_t
tEncodeI32v
(
S
Encoder
*
pC
oder
,
int32_t
val
)
{
return
tEncodeU32v
(
p
Enc
oder
,
ZIGZAGE
(
int32_t
,
val
));
return
tEncodeU32v
(
p
C
oder
,
ZIGZAGE
(
int32_t
,
val
));
}
}
// 64v
// 64v
static
FORCE_INLINE
int32_t
tEncodeU64v
(
S
Coder
*
pEncoder
,
uint64_t
val
)
{
TD_ENCODE_VARIANT_MACRO
(
pEnc
oder
,
val
);
}
static
FORCE_INLINE
int32_t
tEncodeU64v
(
S
Encoder
*
pCoder
,
uint64_t
val
)
{
TD_ENCODE_VARIANT_MACRO
(
pC
oder
,
val
);
}
static
FORCE_INLINE
int32_t
tEncodeI64v
(
S
Coder
*
pEnc
oder
,
int64_t
val
)
{
static
FORCE_INLINE
int32_t
tEncodeI64v
(
S
Encoder
*
pC
oder
,
int64_t
val
)
{
return
tEncodeU64v
(
p
Enc
oder
,
ZIGZAGE
(
int64_t
,
val
));
return
tEncodeU64v
(
p
C
oder
,
ZIGZAGE
(
int64_t
,
val
));
}
}
static
FORCE_INLINE
int32_t
tEncodeFloat
(
S
Coder
*
pEnc
oder
,
float
val
)
{
static
FORCE_INLINE
int32_t
tEncodeFloat
(
S
Encoder
*
pC
oder
,
float
val
)
{
union
{
union
{
uint32_t
ui
;
uint32_t
ui
;
float
f
;
float
f
;
}
v
;
}
v
;
v
.
f
=
val
;
v
.
f
=
val
;
return
tEncodeU32
(
p
Enc
oder
,
v
.
ui
);
return
tEncodeU32
(
p
C
oder
,
v
.
ui
);
}
}
static
FORCE_INLINE
int32_t
tEncodeDouble
(
S
Coder
*
pEnc
oder
,
double
val
)
{
static
FORCE_INLINE
int32_t
tEncodeDouble
(
S
Encoder
*
pC
oder
,
double
val
)
{
union
{
union
{
uint64_t
ui
;
uint64_t
ui
;
double
d
;
double
d
;
}
v
;
}
v
;
v
.
d
=
val
;
v
.
d
=
val
;
return
tEncodeU64
(
p
Enc
oder
,
v
.
ui
);
return
tEncodeU64
(
p
C
oder
,
v
.
ui
);
}
}
static
FORCE_INLINE
int32_t
tEncodeBinary
(
S
Coder
*
pEncoder
,
const
void
*
val
,
uint64
_t
len
)
{
static
FORCE_INLINE
int32_t
tEncodeBinary
(
S
Encoder
*
pCoder
,
const
uint8_t
*
val
,
uint32
_t
len
)
{
if
(
tEncodeU
64v
(
pEnc
oder
,
len
)
<
0
)
return
-
1
;
if
(
tEncodeU
32v
(
pC
oder
,
len
)
<
0
)
return
-
1
;
if
(
p
Enc
oder
->
data
)
{
if
(
p
C
oder
->
data
)
{
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
p
Enc
oder
,
len
))
return
-
1
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
p
C
oder
,
len
))
return
-
1
;
memcpy
(
TD_CODER_CURRENT
(
p
Enc
oder
),
val
,
len
);
memcpy
(
TD_CODER_CURRENT
(
p
C
oder
),
val
,
len
);
}
}
TD_CODER_MOVE_POS
(
p
Enc
oder
,
len
);
TD_CODER_MOVE_POS
(
p
C
oder
,
len
);
return
0
;
return
0
;
}
}
static
FORCE_INLINE
int32_t
tEncodeCStrWithLen
(
S
Coder
*
pEncoder
,
const
char
*
val
,
uint64
_t
len
)
{
static
FORCE_INLINE
int32_t
tEncodeCStrWithLen
(
S
Encoder
*
pCoder
,
const
char
*
val
,
uint32
_t
len
)
{
return
tEncodeBinary
(
p
Encoder
,
(
void
*
)
val
,
len
+
1
);
return
tEncodeBinary
(
p
Coder
,
(
uint8_t
*
)
val
,
len
+
1
);
}
}
static
FORCE_INLINE
int32_t
tEncodeCStr
(
S
Coder
*
pEnc
oder
,
const
char
*
val
)
{
static
FORCE_INLINE
int32_t
tEncodeCStr
(
S
Encoder
*
pC
oder
,
const
char
*
val
)
{
return
tEncodeCStrWithLen
(
p
Encoder
,
val
,
(
uint64
_t
)
strlen
(
val
));
return
tEncodeCStrWithLen
(
p
Coder
,
val
,
(
uint32
_t
)
strlen
(
val
));
}
}
/* ------------------------ FOR DECODER ------------------------ */
/* ------------------------ FOR DECODER ------------------------ */
// 8
// 8
static
FORCE_INLINE
int32_t
tDecodeU8
(
S
Coder
*
pDec
oder
,
uint8_t
*
val
)
{
static
FORCE_INLINE
int32_t
tDecodeU8
(
S
Decoder
*
pC
oder
,
uint8_t
*
val
)
{
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
p
Dec
oder
,
sizeof
(
*
val
)))
return
-
1
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
p
C
oder
,
sizeof
(
*
val
)))
return
-
1
;
tGet
(
uint8_t
,
TD_CODER_CURRENT
(
p
Dec
oder
),
*
val
);
tGet
(
uint8_t
,
TD_CODER_CURRENT
(
p
C
oder
),
*
val
);
TD_CODER_MOVE_POS
(
p
Dec
oder
,
sizeof
(
*
val
));
TD_CODER_MOVE_POS
(
p
C
oder
,
sizeof
(
*
val
));
return
0
;
return
0
;
}
}
static
FORCE_INLINE
int32_t
tDecodeI8
(
S
Coder
*
pDec
oder
,
int8_t
*
val
)
{
static
FORCE_INLINE
int32_t
tDecodeI8
(
S
Decoder
*
pC
oder
,
int8_t
*
val
)
{
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
p
Dec
oder
,
sizeof
(
*
val
)))
return
-
1
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
p
C
oder
,
sizeof
(
*
val
)))
return
-
1
;
tGet
(
int8_t
,
TD_CODER_CURRENT
(
p
Dec
oder
),
*
val
);
tGet
(
int8_t
,
TD_CODER_CURRENT
(
p
C
oder
),
*
val
);
TD_CODER_MOVE_POS
(
p
Dec
oder
,
sizeof
(
*
val
));
TD_CODER_MOVE_POS
(
p
C
oder
,
sizeof
(
*
val
));
return
0
;
return
0
;
}
}
// 16
// 16
static
FORCE_INLINE
int32_t
tDecodeU16
(
SCoder
*
pDecoder
,
uint16_t
*
val
)
{
static
FORCE_INLINE
int32_t
tDecodeU16
(
SDecoder
*
pCoder
,
uint16_t
*
val
)
{
TD_DECODE_MACRO
(
pCoder
,
val
,
uint16_t
,
16
);
}
TD_DECODE_MACRO
(
pDecoder
,
val
,
uint16_t
,
16
);
static
FORCE_INLINE
int32_t
tDecodeI16
(
SDecoder
*
pCoder
,
int16_t
*
val
)
{
TD_DECODE_MACRO
(
pCoder
,
val
,
int16_t
,
16
);
}
}
static
FORCE_INLINE
int32_t
tDecodeI16
(
SCoder
*
pDecoder
,
int16_t
*
val
)
{
TD_DECODE_MACRO
(
pDecoder
,
val
,
int16_t
,
16
);
}
// 32
// 32
static
FORCE_INLINE
int32_t
tDecodeU32
(
SCoder
*
pDecoder
,
uint32_t
*
val
)
{
static
FORCE_INLINE
int32_t
tDecodeU32
(
SDecoder
*
pCoder
,
uint32_t
*
val
)
{
TD_DECODE_MACRO
(
pCoder
,
val
,
uint32_t
,
32
);
}
TD_DECODE_MACRO
(
pDecoder
,
val
,
uint32_t
,
32
);
static
FORCE_INLINE
int32_t
tDecodeI32
(
SDecoder
*
pCoder
,
int32_t
*
val
)
{
TD_DECODE_MACRO
(
pCoder
,
val
,
int32_t
,
32
);
}
}
static
FORCE_INLINE
int32_t
tDecodeI32
(
SCoder
*
pDecoder
,
int32_t
*
val
)
{
TD_DECODE_MACRO
(
pDecoder
,
val
,
int32_t
,
32
);
}
// 64
// 64
static
FORCE_INLINE
int32_t
tDecodeU64
(
SCoder
*
pDecoder
,
uint64_t
*
val
)
{
static
FORCE_INLINE
int32_t
tDecodeU64
(
SDecoder
*
pCoder
,
uint64_t
*
val
)
{
TD_DECODE_MACRO
(
pCoder
,
val
,
uint64_t
,
64
);
}
TD_DECODE_MACRO
(
pDecoder
,
val
,
uint64_t
,
64
);
static
FORCE_INLINE
int32_t
tDecodeI64
(
SDecoder
*
pCoder
,
int64_t
*
val
)
{
TD_DECODE_MACRO
(
pCoder
,
val
,
int64_t
,
64
);
}
}
static
FORCE_INLINE
int32_t
tDecodeI64
(
SCoder
*
pDecoder
,
int64_t
*
val
)
{
TD_DECODE_MACRO
(
pDecoder
,
val
,
int64_t
,
64
);
}
// 16v
// 16v
static
FORCE_INLINE
int32_t
tDecodeU16v
(
S
Coder
*
pDec
oder
,
uint16_t
*
val
)
{
static
FORCE_INLINE
int32_t
tDecodeU16v
(
S
Decoder
*
pC
oder
,
uint16_t
*
val
)
{
TD_DECODE_VARIANT_MACRO
(
p
Dec
oder
,
val
,
uint16_t
);
TD_DECODE_VARIANT_MACRO
(
p
C
oder
,
val
,
uint16_t
);
}
}
static
FORCE_INLINE
int32_t
tDecodeI16v
(
S
Coder
*
pDec
oder
,
int16_t
*
val
)
{
static
FORCE_INLINE
int32_t
tDecodeI16v
(
S
Decoder
*
pC
oder
,
int16_t
*
val
)
{
uint16_t
tval
;
uint16_t
tval
;
if
(
tDecodeU16v
(
p
Dec
oder
,
&
tval
)
<
0
)
{
if
(
tDecodeU16v
(
p
C
oder
,
&
tval
)
<
0
)
{
return
-
1
;
return
-
1
;
}
}
*
val
=
ZIGZAGD
(
int16_t
,
tval
);
*
val
=
ZIGZAGD
(
int16_t
,
tval
);
...
@@ -358,13 +323,13 @@ static FORCE_INLINE int32_t tDecodeI16v(SCoder* pDecoder, int16_t* val) {
...
@@ -358,13 +323,13 @@ static FORCE_INLINE int32_t tDecodeI16v(SCoder* pDecoder, int16_t* val) {
}
}
// 32v
// 32v
static
FORCE_INLINE
int32_t
tDecodeU32v
(
S
Coder
*
pDec
oder
,
uint32_t
*
val
)
{
static
FORCE_INLINE
int32_t
tDecodeU32v
(
S
Decoder
*
pC
oder
,
uint32_t
*
val
)
{
TD_DECODE_VARIANT_MACRO
(
p
Dec
oder
,
val
,
uint32_t
);
TD_DECODE_VARIANT_MACRO
(
p
C
oder
,
val
,
uint32_t
);
}
}
static
FORCE_INLINE
int32_t
tDecodeI32v
(
S
Coder
*
pDec
oder
,
int32_t
*
val
)
{
static
FORCE_INLINE
int32_t
tDecodeI32v
(
S
Decoder
*
pC
oder
,
int32_t
*
val
)
{
uint32_t
tval
;
uint32_t
tval
;
if
(
tDecodeU32v
(
p
Dec
oder
,
&
tval
)
<
0
)
{
if
(
tDecodeU32v
(
p
C
oder
,
&
tval
)
<
0
)
{
return
-
1
;
return
-
1
;
}
}
*
val
=
ZIGZAGD
(
int32_t
,
tval
);
*
val
=
ZIGZAGD
(
int32_t
,
tval
);
...
@@ -372,26 +337,26 @@ static FORCE_INLINE int32_t tDecodeI32v(SCoder* pDecoder, int32_t* val) {
...
@@ -372,26 +337,26 @@ static FORCE_INLINE int32_t tDecodeI32v(SCoder* pDecoder, int32_t* val) {
}
}
// 64v
// 64v
static
FORCE_INLINE
int32_t
tDecodeU64v
(
S
Coder
*
pDec
oder
,
uint64_t
*
val
)
{
static
FORCE_INLINE
int32_t
tDecodeU64v
(
S
Decoder
*
pC
oder
,
uint64_t
*
val
)
{
TD_DECODE_VARIANT_MACRO
(
p
Dec
oder
,
val
,
uint64_t
);
TD_DECODE_VARIANT_MACRO
(
p
C
oder
,
val
,
uint64_t
);
}
}
static
FORCE_INLINE
int32_t
tDecodeI64v
(
S
Coder
*
pDec
oder
,
int64_t
*
val
)
{
static
FORCE_INLINE
int32_t
tDecodeI64v
(
S
Decoder
*
pC
oder
,
int64_t
*
val
)
{
uint64_t
tval
;
uint64_t
tval
;
if
(
tDecodeU64v
(
p
Dec
oder
,
&
tval
)
<
0
)
{
if
(
tDecodeU64v
(
p
C
oder
,
&
tval
)
<
0
)
{
return
-
1
;
return
-
1
;
}
}
*
val
=
ZIGZAGD
(
int64_t
,
tval
);
*
val
=
ZIGZAGD
(
int64_t
,
tval
);
return
0
;
return
0
;
}
}
static
FORCE_INLINE
int32_t
tDecodeFloat
(
S
Coder
*
pDec
oder
,
float
*
val
)
{
static
FORCE_INLINE
int32_t
tDecodeFloat
(
S
Decoder
*
pC
oder
,
float
*
val
)
{
union
{
union
{
uint32_t
ui
;
uint32_t
ui
;
float
f
;
float
f
;
}
v
;
}
v
;
if
(
tDecodeU32
(
p
Dec
oder
,
&
(
v
.
ui
))
<
0
)
{
if
(
tDecodeU32
(
p
C
oder
,
&
(
v
.
ui
))
<
0
)
{
return
-
1
;
return
-
1
;
}
}
...
@@ -399,13 +364,13 @@ static FORCE_INLINE int32_t tDecodeFloat(SCoder* pDecoder, float* val) {
...
@@ -399,13 +364,13 @@ static FORCE_INLINE int32_t tDecodeFloat(SCoder* pDecoder, float* val) {
return
0
;
return
0
;
}
}
static
FORCE_INLINE
int32_t
tDecodeDouble
(
S
Coder
*
pDec
oder
,
double
*
val
)
{
static
FORCE_INLINE
int32_t
tDecodeDouble
(
S
Decoder
*
pC
oder
,
double
*
val
)
{
union
{
union
{
uint64_t
ui
;
uint64_t
ui
;
double
d
;
double
d
;
}
v
;
}
v
;
if
(
tDecodeU64
(
p
Dec
oder
,
&
(
v
.
ui
))
<
0
)
{
if
(
tDecodeU64
(
p
C
oder
,
&
(
v
.
ui
))
<
0
)
{
return
-
1
;
return
-
1
;
}
}
...
@@ -413,62 +378,84 @@ static FORCE_INLINE int32_t tDecodeDouble(SCoder* pDecoder, double* val) {
...
@@ -413,62 +378,84 @@ static FORCE_INLINE int32_t tDecodeDouble(SCoder* pDecoder, double* val) {
return
0
;
return
0
;
}
}
static
FORCE_INLINE
int32_t
tDecodeBinary
(
S
Coder
*
pDecoder
,
const
void
**
val
,
uint64
_t
*
len
)
{
static
FORCE_INLINE
int32_t
tDecodeBinary
(
S
Decoder
*
pCoder
,
const
uint8_t
**
val
,
uint32
_t
*
len
)
{
if
(
tDecodeU
64v
(
pDec
oder
,
len
)
<
0
)
return
-
1
;
if
(
tDecodeU
32v
(
pC
oder
,
len
)
<
0
)
return
-
1
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
p
Dec
oder
,
*
len
))
return
-
1
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
p
C
oder
,
*
len
))
return
-
1
;
if
(
val
)
{
if
(
val
)
{
*
val
=
(
void
*
)
TD_CODER_CURRENT
(
pDec
oder
);
*
val
=
(
uint8_t
*
)
TD_CODER_CURRENT
(
pC
oder
);
}
}
TD_CODER_MOVE_POS
(
p
Dec
oder
,
*
len
);
TD_CODER_MOVE_POS
(
p
C
oder
,
*
len
);
return
0
;
return
0
;
}
}
static
FORCE_INLINE
int32_t
tDecodeCStrAndLen
(
S
Coder
*
pDecoder
,
const
char
**
val
,
uint64
_t
*
len
)
{
static
FORCE_INLINE
int32_t
tDecodeCStrAndLen
(
S
Decoder
*
pCoder
,
const
char
**
val
,
uint32
_t
*
len
)
{
if
(
tDecodeBinary
(
p
Decoder
,
(
const
void
**
)
val
,
len
)
<
0
)
return
-
1
;
if
(
tDecodeBinary
(
p
Coder
,
(
const
uint8_t
**
)
val
,
len
)
<
0
)
return
-
1
;
(
*
len
)
-=
1
;
(
*
len
)
-=
1
;
return
0
;
return
0
;
}
}
static
FORCE_INLINE
int32_t
tDecodeCStr
(
S
Coder
*
pDec
oder
,
const
char
**
val
)
{
static
FORCE_INLINE
int32_t
tDecodeCStr
(
S
Decoder
*
pC
oder
,
const
char
**
val
)
{
uint
64
_t
len
;
uint
32
_t
len
;
return
tDecodeCStrAndLen
(
p
Dec
oder
,
val
,
&
len
);
return
tDecodeCStrAndLen
(
p
C
oder
,
val
,
&
len
);
}
}
static
int32_t
tDecodeCStrTo
(
S
Coder
*
pDec
oder
,
char
*
val
)
{
static
int32_t
tDecodeCStrTo
(
S
Decoder
*
pC
oder
,
char
*
val
)
{
const
char
*
pStr
;
const
char
*
pStr
;
uint
64
_t
len
;
uint
32
_t
len
;
if
(
tDecodeCStrAndLen
(
p
Dec
oder
,
&
pStr
,
&
len
)
<
0
)
return
-
1
;
if
(
tDecodeCStrAndLen
(
p
C
oder
,
&
pStr
,
&
len
)
<
0
)
return
-
1
;
memcpy
(
val
,
pStr
,
len
+
1
);
memcpy
(
val
,
pStr
,
len
+
1
);
return
0
;
return
0
;
}
}
static
FORCE_INLINE
int32_t
tDecodeBinaryAlloc
(
S
Coder
*
pDec
oder
,
void
**
val
,
uint64_t
*
len
)
{
static
FORCE_INLINE
int32_t
tDecodeBinaryAlloc
(
S
Decoder
*
pC
oder
,
void
**
val
,
uint64_t
*
len
)
{
if
(
tDecodeU64v
(
p
Dec
oder
,
len
)
<
0
)
return
-
1
;
if
(
tDecodeU64v
(
p
C
oder
,
len
)
<
0
)
return
-
1
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
p
Dec
oder
,
*
len
))
return
-
1
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
p
C
oder
,
*
len
))
return
-
1
;
*
val
=
taosMemoryMalloc
(
*
len
);
*
val
=
taosMemoryMalloc
(
*
len
);
if
(
*
val
==
NULL
)
return
-
1
;
if
(
*
val
==
NULL
)
return
-
1
;
memcpy
(
*
val
,
TD_CODER_CURRENT
(
p
Dec
oder
),
*
len
);
memcpy
(
*
val
,
TD_CODER_CURRENT
(
p
C
oder
),
*
len
);
TD_CODER_MOVE_POS
(
p
Dec
oder
,
*
len
);
TD_CODER_MOVE_POS
(
p
C
oder
,
*
len
);
return
0
;
return
0
;
}
}
static
FORCE_INLINE
int32_t
tDecodeCStrAndLenAlloc
(
S
Coder
*
pDec
oder
,
char
**
val
,
uint64_t
*
len
)
{
static
FORCE_INLINE
int32_t
tDecodeCStrAndLenAlloc
(
S
Decoder
*
pC
oder
,
char
**
val
,
uint64_t
*
len
)
{
if
(
tDecodeBinaryAlloc
(
p
Dec
oder
,
(
void
**
)
val
,
len
)
<
0
)
return
-
1
;
if
(
tDecodeBinaryAlloc
(
p
C
oder
,
(
void
**
)
val
,
len
)
<
0
)
return
-
1
;
(
*
len
)
-=
1
;
(
*
len
)
-=
1
;
return
0
;
return
0
;
}
}
static
FORCE_INLINE
int32_t
tDecodeCStrAlloc
(
S
Coder
*
pDec
oder
,
char
**
val
)
{
static
FORCE_INLINE
int32_t
tDecodeCStrAlloc
(
S
Decoder
*
pC
oder
,
char
**
val
)
{
uint64_t
len
;
uint64_t
len
;
return
tDecodeCStrAndLenAlloc
(
p
Dec
oder
,
val
,
&
len
);
return
tDecodeCStrAndLenAlloc
(
p
C
oder
,
val
,
&
len
);
}
}
static
FORCE_INLINE
bool
tDecodeIsEnd
(
SCoder
*
pCoder
)
{
return
(
pCoder
->
size
==
pCoder
->
pos
);
}
static
FORCE_INLINE
bool
tDecodeIsEnd
(
SDecoder
*
pCoder
)
{
return
(
pCoder
->
size
==
pCoder
->
pos
);
}
static
FORCE_INLINE
void
*
tEncoderMalloc
(
SEncoder
*
pCoder
,
int32_t
size
)
{
void
*
p
=
NULL
;
SCoderMem
*
pMem
=
(
SCoderMem
*
)
taosMemoryMalloc
(
sizeof
(
*
pMem
)
+
size
);
if
(
pMem
)
{
pMem
->
next
=
pCoder
->
mList
;
pCoder
->
mList
=
pMem
;
p
=
(
void
*
)
&
pMem
[
1
];
}
return
p
;
}
static
FORCE_INLINE
void
*
tDecoderMalloc
(
SDecoder
*
pCoder
,
int32_t
size
)
{
void
*
p
=
NULL
;
SCoderMem
*
pMem
=
(
SCoderMem
*
)
taosMemoryMalloc
(
sizeof
(
*
pMem
)
+
size
);
if
(
pMem
)
{
pMem
->
next
=
pCoder
->
mList
;
pCoder
->
mList
=
pMem
;
p
=
(
void
*
)
&
pMem
[
1
];
}
return
p
;
}
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/client/src/tmq.c
浏览文件 @
a06bf6e5
...
@@ -547,21 +547,21 @@ tmq_resp_err_t tmq_commit(tmq_t* tmq, const tmq_topic_vgroup_list_t* offsets, in
...
@@ -547,21 +547,21 @@ tmq_resp_err_t tmq_commit(tmq_t* tmq, const tmq_topic_vgroup_list_t* offsets, in
req
.
offsets
=
(
SMqOffset
*
)
offsets
->
container
.
pData
;
req
.
offsets
=
(
SMqOffset
*
)
offsets
->
container
.
pData
;
}
}
S
C
oder
encoder
;
S
Enc
oder
encoder
;
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
NULL
,
0
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
NULL
,
0
);
tEncodeSMqCMCommitOffsetReq
(
&
encoder
,
&
req
);
tEncodeSMqCMCommitOffsetReq
(
&
encoder
,
&
req
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
void
*
buf
=
taosMemoryMalloc
(
tlen
);
void
*
buf
=
taosMemoryMalloc
(
tlen
);
if
(
buf
==
NULL
)
{
if
(
buf
==
NULL
)
{
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
-
1
;
return
-
1
;
}
}
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
tlen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
tlen
);
tEncodeSMqCMCommitOffsetReq
(
&
encoder
,
&
req
);
tEncodeSMqCMCommitOffsetReq
(
&
encoder
,
&
req
);
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
pRequest
=
createRequest
(
tmq
->
pTscObj
,
NULL
,
NULL
,
TDMT_MND_MQ_COMMIT_OFFSET
);
pRequest
=
createRequest
(
tmq
->
pTscObj
,
NULL
,
NULL
,
TDMT_MND_MQ_COMMIT_OFFSET
);
if
(
pRequest
==
NULL
)
{
if
(
pRequest
==
NULL
)
{
...
...
source/common/src/tmsg.c
浏览文件 @
a06bf6e5
...
@@ -122,7 +122,7 @@ int32_t tPrintFixedSchemaSubmitReq(const SSubmitReq *pReq, STSchema *pTschema) {
...
@@ -122,7 +122,7 @@ int32_t tPrintFixedSchemaSubmitReq(const SSubmitReq *pReq, STSchema *pTschema) {
return
0
;
return
0
;
}
}
int32_t
tEncodeSEpSet
(
S
C
oder
*
pEncoder
,
const
SEpSet
*
pEp
)
{
int32_t
tEncodeSEpSet
(
S
Enc
oder
*
pEncoder
,
const
SEpSet
*
pEp
)
{
if
(
tEncodeI8
(
pEncoder
,
pEp
->
inUse
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pEp
->
inUse
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pEp
->
numOfEps
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pEp
->
numOfEps
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
i
++
)
{
...
@@ -132,7 +132,7 @@ int32_t tEncodeSEpSet(SCoder *pEncoder, const SEpSet *pEp) {
...
@@ -132,7 +132,7 @@ int32_t tEncodeSEpSet(SCoder *pEncoder, const SEpSet *pEp) {
return
0
;
return
0
;
}
}
int32_t
tDecodeSEpSet
(
S
C
oder
*
pDecoder
,
SEpSet
*
pEp
)
{
int32_t
tDecodeSEpSet
(
S
Dec
oder
*
pDecoder
,
SEpSet
*
pEp
)
{
if
(
tDecodeI8
(
pDecoder
,
&
pEp
->
inUse
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pEp
->
inUse
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pEp
->
numOfEps
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pEp
->
numOfEps
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
i
++
)
{
...
@@ -142,13 +142,13 @@ int32_t tDecodeSEpSet(SCoder *pDecoder, SEpSet *pEp) {
...
@@ -142,13 +142,13 @@ int32_t tDecodeSEpSet(SCoder *pDecoder, SEpSet *pEp) {
return
0
;
return
0
;
}
}
int32_t
tEncodeSQueryNodeAddr
(
S
C
oder
*
pEncoder
,
SQueryNodeAddr
*
pAddr
)
{
int32_t
tEncodeSQueryNodeAddr
(
S
Enc
oder
*
pEncoder
,
SQueryNodeAddr
*
pAddr
)
{
if
(
tEncodeI32
(
pEncoder
,
pAddr
->
nodeId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pAddr
->
nodeId
)
<
0
)
return
-
1
;
if
(
tEncodeSEpSet
(
pEncoder
,
&
pAddr
->
epSet
)
<
0
)
return
-
1
;
if
(
tEncodeSEpSet
(
pEncoder
,
&
pAddr
->
epSet
)
<
0
)
return
-
1
;
return
0
;
return
0
;
}
}
int32_t
tDecodeSQueryNodeAddr
(
S
C
oder
*
pDecoder
,
SQueryNodeAddr
*
pAddr
)
{
int32_t
tDecodeSQueryNodeAddr
(
S
Dec
oder
*
pDecoder
,
SQueryNodeAddr
*
pAddr
)
{
if
(
tDecodeI32
(
pDecoder
,
&
pAddr
->
nodeId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pAddr
->
nodeId
)
<
0
)
return
-
1
;
if
(
tDecodeSEpSet
(
pDecoder
,
&
pAddr
->
epSet
)
<
0
)
return
-
1
;
if
(
tDecodeSEpSet
(
pDecoder
,
&
pAddr
->
epSet
)
<
0
)
return
-
1
;
return
0
;
return
0
;
...
@@ -175,7 +175,7 @@ void *taosDecodeSEpSet(const void *buf, SEpSet *pEp) {
...
@@ -175,7 +175,7 @@ void *taosDecodeSEpSet(const void *buf, SEpSet *pEp) {
return
(
void
*
)
buf
;
return
(
void
*
)
buf
;
}
}
static
int32_t
tSerializeSClientHbReq
(
S
C
oder
*
pEncoder
,
const
SClientHbReq
*
pReq
)
{
static
int32_t
tSerializeSClientHbReq
(
S
Enc
oder
*
pEncoder
,
const
SClientHbReq
*
pReq
)
{
if
(
tEncodeSClientHbKey
(
pEncoder
,
&
pReq
->
connKey
)
<
0
)
return
-
1
;
if
(
tEncodeSClientHbKey
(
pEncoder
,
&
pReq
->
connKey
)
<
0
)
return
-
1
;
if
(
pReq
->
connKey
.
connType
==
CONN_TYPE__QUERY
)
{
if
(
pReq
->
connKey
.
connType
==
CONN_TYPE__QUERY
)
{
...
@@ -226,7 +226,7 @@ static int32_t tSerializeSClientHbReq(SCoder *pEncoder, const SClientHbReq *pReq
...
@@ -226,7 +226,7 @@ static int32_t tSerializeSClientHbReq(SCoder *pEncoder, const SClientHbReq *pReq
return
0
;
return
0
;
}
}
static
int32_t
tDeserializeSClientHbReq
(
S
C
oder
*
pDecoder
,
SClientHbReq
*
pReq
)
{
static
int32_t
tDeserializeSClientHbReq
(
S
Dec
oder
*
pDecoder
,
SClientHbReq
*
pReq
)
{
if
(
tDecodeSClientHbKey
(
pDecoder
,
&
pReq
->
connKey
)
<
0
)
return
-
1
;
if
(
tDecodeSClientHbKey
(
pDecoder
,
&
pReq
->
connKey
)
<
0
)
return
-
1
;
if
(
pReq
->
connKey
.
connType
==
CONN_TYPE__QUERY
)
{
if
(
pReq
->
connKey
.
connType
==
CONN_TYPE__QUERY
)
{
...
@@ -291,7 +291,7 @@ static int32_t tDeserializeSClientHbReq(SCoder *pDecoder, SClientHbReq *pReq) {
...
@@ -291,7 +291,7 @@ static int32_t tDeserializeSClientHbReq(SCoder *pDecoder, SClientHbReq *pReq) {
return
0
;
return
0
;
}
}
static
int32_t
tSerializeSClientHbRsp
(
S
C
oder
*
pEncoder
,
const
SClientHbRsp
*
pRsp
)
{
static
int32_t
tSerializeSClientHbRsp
(
S
Enc
oder
*
pEncoder
,
const
SClientHbRsp
*
pRsp
)
{
if
(
tEncodeSClientHbKey
(
pEncoder
,
&
pRsp
->
connKey
)
<
0
)
return
-
1
;
if
(
tEncodeSClientHbKey
(
pEncoder
,
&
pRsp
->
connKey
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pRsp
->
status
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pRsp
->
status
)
<
0
)
return
-
1
;
...
@@ -319,7 +319,7 @@ static int32_t tSerializeSClientHbRsp(SCoder *pEncoder, const SClientHbRsp *pRsp
...
@@ -319,7 +319,7 @@ static int32_t tSerializeSClientHbRsp(SCoder *pEncoder, const SClientHbRsp *pRsp
return
0
;
return
0
;
}
}
static
int32_t
tDeserializeSClientHbRsp
(
S
C
oder
*
pDecoder
,
SClientHbRsp
*
pRsp
)
{
static
int32_t
tDeserializeSClientHbRsp
(
S
Dec
oder
*
pDecoder
,
SClientHbRsp
*
pRsp
)
{
if
(
tDecodeSClientHbKey
(
pDecoder
,
&
pRsp
->
connKey
)
<
0
)
return
-
1
;
if
(
tDecodeSClientHbKey
(
pDecoder
,
&
pRsp
->
connKey
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pRsp
->
status
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pRsp
->
status
)
<
0
)
return
-
1
;
...
@@ -350,8 +350,8 @@ static int32_t tDeserializeSClientHbRsp(SCoder *pDecoder, SClientHbRsp *pRsp) {
...
@@ -350,8 +350,8 @@ static int32_t tDeserializeSClientHbRsp(SCoder *pDecoder, SClientHbRsp *pRsp) {
}
}
int32_t
tSerializeSClientHbBatchReq
(
void
*
buf
,
int32_t
bufLen
,
const
SClientHbBatchReq
*
pBatchReq
)
{
int32_t
tSerializeSClientHbBatchReq
(
void
*
buf
,
int32_t
bufLen
,
const
SClientHbBatchReq
*
pBatchReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pBatchReq
->
reqId
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pBatchReq
->
reqId
)
<
0
)
return
-
1
;
...
@@ -365,13 +365,13 @@ int32_t tSerializeSClientHbBatchReq(void *buf, int32_t bufLen, const SClientHbBa
...
@@ -365,13 +365,13 @@ int32_t tSerializeSClientHbBatchReq(void *buf, int32_t bufLen, const SClientHbBa
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSClientHbBatchReq
(
void
*
buf
,
int32_t
bufLen
,
SClientHbBatchReq
*
pBatchReq
)
{
int32_t
tDeserializeSClientHbBatchReq
(
void
*
buf
,
int32_t
bufLen
,
SClientHbBatchReq
*
pBatchReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pBatchReq
->
reqId
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pBatchReq
->
reqId
)
<
0
)
return
-
1
;
...
@@ -389,13 +389,13 @@ int32_t tDeserializeSClientHbBatchReq(void *buf, int32_t bufLen, SClientHbBatchR
...
@@ -389,13 +389,13 @@ int32_t tDeserializeSClientHbBatchReq(void *buf, int32_t bufLen, SClientHbBatchR
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSClientHbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SClientHbBatchRsp
*
pBatchRsp
)
{
int32_t
tSerializeSClientHbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SClientHbBatchRsp
*
pBatchRsp
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pBatchRsp
->
reqId
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pBatchRsp
->
reqId
)
<
0
)
return
-
1
;
...
@@ -410,13 +410,13 @@ int32_t tSerializeSClientHbBatchRsp(void *buf, int32_t bufLen, const SClientHbBa
...
@@ -410,13 +410,13 @@ int32_t tSerializeSClientHbBatchRsp(void *buf, int32_t bufLen, const SClientHbBa
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSClientHbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SClientHbBatchRsp
*
pBatchRsp
)
{
int32_t
tDeserializeSClientHbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SClientHbBatchRsp
*
pBatchRsp
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pBatchRsp
->
reqId
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pBatchRsp
->
reqId
)
<
0
)
return
-
1
;
...
@@ -434,13 +434,13 @@ int32_t tDeserializeSClientHbBatchRsp(void *buf, int32_t bufLen, SClientHbBatchR
...
@@ -434,13 +434,13 @@ int32_t tDeserializeSClientHbBatchRsp(void *buf, int32_t bufLen, SClientHbBatchR
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSMCreateStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateStbReq
*
pReq
)
{
int32_t
tSerializeSMCreateStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateStbReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -482,13 +482,13 @@ int32_t tSerializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pReq
...
@@ -482,13 +482,13 @@ int32_t tSerializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pReq
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSMCreateStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateStbReq
*
pReq
)
{
int32_t
tDeserializeSMCreateStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateStbReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -553,7 +553,7 @@ int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pR
...
@@ -553,7 +553,7 @@ int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pR
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -568,8 +568,8 @@ void tFreeSMCreateStbReq(SMCreateStbReq *pReq) {
...
@@ -568,8 +568,8 @@ void tFreeSMCreateStbReq(SMCreateStbReq *pReq) {
}
}
int32_t
tSerializeSMDropStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropStbReq
*
pReq
)
{
int32_t
tSerializeSMDropStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropStbReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -577,26 +577,26 @@ int32_t tSerializeSMDropStbReq(void *buf, int32_t bufLen, SMDropStbReq *pReq) {
...
@@ -577,26 +577,26 @@ int32_t tSerializeSMDropStbReq(void *buf, int32_t bufLen, SMDropStbReq *pReq) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSMDropStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropStbReq
*
pReq
)
{
int32_t
tDeserializeSMDropStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropStbReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
igNotExists
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
igNotExists
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSMAlterStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMAlterStbReq
*
pReq
)
{
int32_t
tSerializeSMAlterStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMAlterStbReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -611,13 +611,13 @@ int32_t tSerializeSMAlterStbReq(void *buf, int32_t bufLen, SMAlterStbReq *pReq)
...
@@ -611,13 +611,13 @@ int32_t tSerializeSMAlterStbReq(void *buf, int32_t bufLen, SMAlterStbReq *pReq)
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSMAlterStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMAlterStbReq
*
pReq
)
{
int32_t
tDeserializeSMAlterStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMAlterStbReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -641,7 +641,7 @@ int32_t tDeserializeSMAlterStbReq(void *buf, int32_t bufLen, SMAlterStbReq *pReq
...
@@ -641,7 +641,7 @@ int32_t tDeserializeSMAlterStbReq(void *buf, int32_t bufLen, SMAlterStbReq *pReq
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -650,30 +650,30 @@ void tFreeSMAltertbReq(SMAlterStbReq *pReq) {
...
@@ -650,30 +650,30 @@ void tFreeSMAltertbReq(SMAlterStbReq *pReq) {
pReq
->
pFields
=
NULL
;
pReq
->
pFields
=
NULL
;
}
}
int32_t
tSerializeSMEpSet
(
void
*
buf
,
int32_t
bufLen
,
SMEpSet
*
pReq
)
{
int32_t
tSerializeSMEpSet
(
void
*
buf
,
int32_t
bufLen
,
SMEpSet
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeSEpSet
(
&
encoder
,
&
pReq
->
epSet
)
<
0
)
return
-
1
;
if
(
tEncodeSEpSet
(
&
encoder
,
&
pReq
->
epSet
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSMEpSet
(
void
*
buf
,
int32_t
bufLen
,
SMEpSet
*
pReq
)
{
int32_t
tDeserializeSMEpSet
(
void
*
buf
,
int32_t
bufLen
,
SMEpSet
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeSEpSet
(
&
decoder
,
&
pReq
->
epSet
)
<
0
)
return
-
1
;
if
(
tDecodeSEpSet
(
&
decoder
,
&
pReq
->
epSet
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSMCreateSmaReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateSmaReq
*
pReq
)
{
int32_t
tSerializeSMCreateSmaReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateSmaReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -705,13 +705,13 @@ int32_t tSerializeSMCreateSmaReq(void *buf, int32_t bufLen, SMCreateSmaReq *pReq
...
@@ -705,13 +705,13 @@ int32_t tSerializeSMCreateSmaReq(void *buf, int32_t bufLen, SMCreateSmaReq *pReq
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSMCreateSmaReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateSmaReq
*
pReq
)
{
int32_t
tDeserializeSMCreateSmaReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateSmaReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -750,7 +750,7 @@ int32_t tDeserializeSMCreateSmaReq(void *buf, int32_t bufLen, SMCreateSmaReq *pR
...
@@ -750,7 +750,7 @@ int32_t tDeserializeSMCreateSmaReq(void *buf, int32_t bufLen, SMCreateSmaReq *pR
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -762,8 +762,8 @@ void tFreeSMCreateSmaReq(SMCreateSmaReq *pReq) {
...
@@ -762,8 +762,8 @@ void tFreeSMCreateSmaReq(SMCreateSmaReq *pReq) {
}
}
int32_t
tSerializeSMDropSmaReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropSmaReq
*
pReq
)
{
int32_t
tSerializeSMDropSmaReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropSmaReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -772,40 +772,40 @@ int32_t tSerializeSMDropSmaReq(void *buf, int32_t bufLen, SMDropSmaReq *pReq) {
...
@@ -772,40 +772,40 @@ int32_t tSerializeSMDropSmaReq(void *buf, int32_t bufLen, SMDropSmaReq *pReq) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSMDropSmaReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropSmaReq
*
pReq
)
{
int32_t
tDeserializeSMDropSmaReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropSmaReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
igNotExists
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
igNotExists
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSMCreateFullTextReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateFullTextReq
*
pReq
)
{
int32_t
tSerializeSMCreateFullTextReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateFullTextReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSMCreateFullTextReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateFullTextReq
*
pReq
)
{
int32_t
tDeserializeSMCreateFullTextReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateFullTextReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
void
tFreeSMCreateFullTextReq
(
SMCreateFullTextReq
*
pReq
)
{
void
tFreeSMCreateFullTextReq
(
SMCreateFullTextReq
*
pReq
)
{
...
@@ -813,8 +813,8 @@ void tFreeSMCreateFullTextReq(SMCreateFullTextReq *pReq) {
...
@@ -813,8 +813,8 @@ void tFreeSMCreateFullTextReq(SMCreateFullTextReq *pReq) {
return
;
return
;
}
}
int32_t
tSerializeSMDropFullTextReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropFullTextReq
*
pReq
)
{
int32_t
tSerializeSMDropFullTextReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropFullTextReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
...
@@ -824,24 +824,24 @@ int32_t tSerializeSMDropFullTextReq(void *buf, int32_t bufLen, SMDropFullTextReq
...
@@ -824,24 +824,24 @@ int32_t tSerializeSMDropFullTextReq(void *buf, int32_t bufLen, SMDropFullTextReq
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSMDropFullTextReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropFullTextReq
*
pReq
)
{
int32_t
tDeserializeSMDropFullTextReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropFullTextReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
igNotExists
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
igNotExists
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSStatusReq
(
void
*
buf
,
int32_t
bufLen
,
SStatusReq
*
pReq
)
{
int32_t
tSerializeSStatusReq
(
void
*
buf
,
int32_t
bufLen
,
SStatusReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
...
@@ -880,13 +880,13 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
...
@@ -880,13 +880,13 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSStatusReq
(
void
*
buf
,
int32_t
bufLen
,
SStatusReq
*
pReq
)
{
int32_t
tDeserializeSStatusReq
(
void
*
buf
,
int32_t
bufLen
,
SStatusReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
...
@@ -933,15 +933,15 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
...
@@ -933,15 +933,15 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
void
tFreeSStatusReq
(
SStatusReq
*
pReq
)
{
taosArrayDestroy
(
pReq
->
pVloads
);
}
void
tFreeSStatusReq
(
SStatusReq
*
pReq
)
{
taosArrayDestroy
(
pReq
->
pVloads
);
}
int32_t
tSerializeSStatusRsp
(
void
*
buf
,
int32_t
bufLen
,
SStatusRsp
*
pRsp
)
{
int32_t
tSerializeSStatusRsp
(
void
*
buf
,
int32_t
bufLen
,
SStatusRsp
*
pRsp
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
...
@@ -966,13 +966,13 @@ int32_t tSerializeSStatusRsp(void *buf, int32_t bufLen, SStatusRsp *pRsp) {
...
@@ -966,13 +966,13 @@ int32_t tSerializeSStatusRsp(void *buf, int32_t bufLen, SStatusRsp *pRsp) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSStatusRsp
(
void
*
buf
,
int32_t
bufLen
,
SStatusRsp
*
pRsp
)
{
int32_t
tDeserializeSStatusRsp
(
void
*
buf
,
int32_t
bufLen
,
SStatusRsp
*
pRsp
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
...
@@ -1005,15 +1005,15 @@ int32_t tDeserializeSStatusRsp(void *buf, int32_t bufLen, SStatusRsp *pRsp) {
...
@@ -1005,15 +1005,15 @@ int32_t tDeserializeSStatusRsp(void *buf, int32_t bufLen, SStatusRsp *pRsp) {
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
void
tFreeSStatusRsp
(
SStatusRsp
*
pRsp
)
{
taosArrayDestroy
(
pRsp
->
pDnodeEps
);
}
void
tFreeSStatusRsp
(
SStatusRsp
*
pRsp
)
{
taosArrayDestroy
(
pRsp
->
pDnodeEps
);
}
int32_t
tSerializeSCreateAcctReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateAcctReq
*
pReq
)
{
int32_t
tSerializeSCreateAcctReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateAcctReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
user
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
user
)
<
0
)
return
-
1
;
...
@@ -1027,13 +1027,13 @@ int32_t tSerializeSCreateAcctReq(void *buf, int32_t bufLen, SCreateAcctReq *pReq
...
@@ -1027,13 +1027,13 @@ int32_t tSerializeSCreateAcctReq(void *buf, int32_t bufLen, SCreateAcctReq *pReq
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSCreateAcctReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateAcctReq
*
pReq
)
{
int32_t
tDeserializeSCreateAcctReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateAcctReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
user
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
user
)
<
0
)
return
-
1
;
...
@@ -1046,38 +1046,38 @@ int32_t tDeserializeSCreateAcctReq(void *buf, int32_t bufLen, SCreateAcctReq *pR
...
@@ -1046,38 +1046,38 @@ int32_t tDeserializeSCreateAcctReq(void *buf, int32_t bufLen, SCreateAcctReq *pR
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
maxStorage
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
maxStorage
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSDropUserReq
(
void
*
buf
,
int32_t
bufLen
,
SDropUserReq
*
pReq
)
{
int32_t
tSerializeSDropUserReq
(
void
*
buf
,
int32_t
bufLen
,
SDropUserReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
user
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
user
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSDropUserReq
(
void
*
buf
,
int32_t
bufLen
,
SDropUserReq
*
pReq
)
{
int32_t
tDeserializeSDropUserReq
(
void
*
buf
,
int32_t
bufLen
,
SDropUserReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
user
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
user
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSCreateUserReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateUserReq
*
pReq
)
{
int32_t
tSerializeSCreateUserReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateUserReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
createType
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
createType
)
<
0
)
return
-
1
;
...
@@ -1087,13 +1087,13 @@ int32_t tSerializeSCreateUserReq(void *buf, int32_t bufLen, SCreateUserReq *pReq
...
@@ -1087,13 +1087,13 @@ int32_t tSerializeSCreateUserReq(void *buf, int32_t bufLen, SCreateUserReq *pReq
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSCreateUserReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateUserReq
*
pReq
)
{
int32_t
tDeserializeSCreateUserReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateUserReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
createType
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
createType
)
<
0
)
return
-
1
;
...
@@ -1102,13 +1102,13 @@ int32_t tDeserializeSCreateUserReq(void *buf, int32_t bufLen, SCreateUserReq *pR
...
@@ -1102,13 +1102,13 @@ int32_t tDeserializeSCreateUserReq(void *buf, int32_t bufLen, SCreateUserReq *pR
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
pass
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
pass
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSAlterUserReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterUserReq
*
pReq
)
{
int32_t
tSerializeSAlterUserReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterUserReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
alterType
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
alterType
)
<
0
)
return
-
1
;
...
@@ -1119,13 +1119,13 @@ int32_t tSerializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq)
...
@@ -1119,13 +1119,13 @@ int32_t tSerializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq)
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSAlterUserReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterUserReq
*
pReq
)
{
int32_t
tDeserializeSAlterUserReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterUserReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
alterType
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
alterType
)
<
0
)
return
-
1
;
...
@@ -1135,36 +1135,36 @@ int32_t tDeserializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq
...
@@ -1135,36 +1135,36 @@ int32_t tDeserializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
dbname
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
dbname
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSGetUserAuthReq
(
void
*
buf
,
int32_t
bufLen
,
SGetUserAuthReq
*
pReq
)
{
int32_t
tSerializeSGetUserAuthReq
(
void
*
buf
,
int32_t
bufLen
,
SGetUserAuthReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
user
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
user
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSGetUserAuthReq
(
void
*
buf
,
int32_t
bufLen
,
SGetUserAuthReq
*
pReq
)
{
int32_t
tDeserializeSGetUserAuthReq
(
void
*
buf
,
int32_t
bufLen
,
SGetUserAuthReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
user
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
user
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSGetUserAuthRspImpl
(
S
C
oder
*
pEncoder
,
SGetUserAuthRsp
*
pRsp
)
{
int32_t
tSerializeSGetUserAuthRspImpl
(
S
Enc
oder
*
pEncoder
,
SGetUserAuthRsp
*
pRsp
)
{
if
(
tEncodeCStr
(
pEncoder
,
pRsp
->
user
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pRsp
->
user
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pRsp
->
superAuth
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pRsp
->
superAuth
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pRsp
->
version
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pRsp
->
version
)
<
0
)
return
-
1
;
...
@@ -1198,8 +1198,8 @@ int32_t tSerializeSGetUserAuthRspImpl(SCoder *pEncoder, SGetUserAuthRsp *pRsp) {
...
@@ -1198,8 +1198,8 @@ int32_t tSerializeSGetUserAuthRspImpl(SCoder *pEncoder, SGetUserAuthRsp *pRsp) {
}
}
int32_t
tSerializeSGetUserAuthRsp
(
void
*
buf
,
int32_t
bufLen
,
SGetUserAuthRsp
*
pRsp
)
{
int32_t
tSerializeSGetUserAuthRsp
(
void
*
buf
,
int32_t
bufLen
,
SGetUserAuthRsp
*
pRsp
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
...
@@ -1208,11 +1208,11 @@ int32_t tSerializeSGetUserAuthRsp(void *buf, int32_t bufLen, SGetUserAuthRsp *pR
...
@@ -1208,11 +1208,11 @@ int32_t tSerializeSGetUserAuthRsp(void *buf, int32_t bufLen, SGetUserAuthRsp *pR
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSGetUserAuthRspImpl
(
S
C
oder
*
pDecoder
,
SGetUserAuthRsp
*
pRsp
)
{
int32_t
tDeserializeSGetUserAuthRspImpl
(
S
Dec
oder
*
pDecoder
,
SGetUserAuthRsp
*
pRsp
)
{
pRsp
->
createdDbs
=
taosHashInit
(
4
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_ENTRY_LOCK
);
pRsp
->
createdDbs
=
taosHashInit
(
4
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_ENTRY_LOCK
);
pRsp
->
readDbs
=
taosHashInit
(
4
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_ENTRY_LOCK
);
pRsp
->
readDbs
=
taosHashInit
(
4
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_ENTRY_LOCK
);
pRsp
->
writeDbs
=
taosHashInit
(
4
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_ENTRY_LOCK
);
pRsp
->
writeDbs
=
taosHashInit
(
4
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_ENTRY_LOCK
);
...
@@ -1256,8 +1256,8 @@ int32_t tDeserializeSGetUserAuthRspImpl(SCoder *pDecoder, SGetUserAuthRsp *pRsp)
...
@@ -1256,8 +1256,8 @@ int32_t tDeserializeSGetUserAuthRspImpl(SCoder *pDecoder, SGetUserAuthRsp *pRsp)
}
}
int32_t
tDeserializeSGetUserAuthRsp
(
void
*
buf
,
int32_t
bufLen
,
SGetUserAuthRsp
*
pRsp
)
{
int32_t
tDeserializeSGetUserAuthRsp
(
void
*
buf
,
int32_t
bufLen
,
SGetUserAuthRsp
*
pRsp
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
...
@@ -1265,7 +1265,7 @@ int32_t tDeserializeSGetUserAuthRsp(void *buf, int32_t bufLen, SGetUserAuthRsp *
...
@@ -1265,7 +1265,7 @@ int32_t tDeserializeSGetUserAuthRsp(void *buf, int32_t bufLen, SGetUserAuthRsp *
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -1276,33 +1276,33 @@ void tFreeSGetUserAuthRsp(SGetUserAuthRsp *pRsp) {
...
@@ -1276,33 +1276,33 @@ void tFreeSGetUserAuthRsp(SGetUserAuthRsp *pRsp) {
}
}
int32_t
tSerializeSCreateDropMQSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
)
{
int32_t
tSerializeSCreateDropMQSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
dnodeId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
dnodeId
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSCreateDropMQSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
)
{
int32_t
tDeserializeSCreateDropMQSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
dnodeId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
dnodeId
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSDropDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDropDnodeReq
*
pReq
)
{
int32_t
tSerializeSDropDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDropDnodeReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
dnodeId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
dnodeId
)
<
0
)
return
-
1
;
...
@@ -1311,13 +1311,13 @@ int32_t tSerializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq)
...
@@ -1311,13 +1311,13 @@ int32_t tSerializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq)
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSDropDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDropDnodeReq
*
pReq
)
{
int32_t
tDeserializeSDropDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDropDnodeReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
dnodeId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
dnodeId
)
<
0
)
return
-
1
;
...
@@ -1325,13 +1325,13 @@ int32_t tDeserializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq
...
@@ -1325,13 +1325,13 @@ int32_t tDeserializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
port
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
port
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSMCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCfgDnodeReq
*
pReq
)
{
int32_t
tSerializeSMCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCfgDnodeReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
dnodeId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
dnodeId
)
<
0
)
return
-
1
;
...
@@ -1340,13 +1340,13 @@ int32_t tSerializeSMCfgDnodeReq(void *buf, int32_t bufLen, SMCfgDnodeReq *pReq)
...
@@ -1340,13 +1340,13 @@ int32_t tSerializeSMCfgDnodeReq(void *buf, int32_t bufLen, SMCfgDnodeReq *pReq)
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSMCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCfgDnodeReq
*
pReq
)
{
int32_t
tDeserializeSMCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCfgDnodeReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
dnodeId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
dnodeId
)
<
0
)
return
-
1
;
...
@@ -1354,13 +1354,13 @@ int32_t tDeserializeSMCfgDnodeReq(void *buf, int32_t bufLen, SMCfgDnodeReq *pReq
...
@@ -1354,13 +1354,13 @@ int32_t tDeserializeSMCfgDnodeReq(void *buf, int32_t bufLen, SMCfgDnodeReq *pReq
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
value
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
value
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSCreateDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateDnodeReq
*
pReq
)
{
int32_t
tSerializeSCreateDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateDnodeReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
fqdn
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
fqdn
)
<
0
)
return
-
1
;
...
@@ -1368,26 +1368,26 @@ int32_t tSerializeSCreateDnodeReq(void *buf, int32_t bufLen, SCreateDnodeReq *pR
...
@@ -1368,26 +1368,26 @@ int32_t tSerializeSCreateDnodeReq(void *buf, int32_t bufLen, SCreateDnodeReq *pR
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSCreateDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateDnodeReq
*
pReq
)
{
int32_t
tDeserializeSCreateDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateDnodeReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
fqdn
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
fqdn
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
port
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
port
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSCreateFuncReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateFuncReq
*
pReq
)
{
int32_t
tSerializeSCreateFuncReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateFuncReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -1416,13 +1416,13 @@ int32_t tSerializeSCreateFuncReq(void *buf, int32_t bufLen, SCreateFuncReq *pReq
...
@@ -1416,13 +1416,13 @@ int32_t tSerializeSCreateFuncReq(void *buf, int32_t bufLen, SCreateFuncReq *pReq
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSCreateFuncReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateFuncReq
*
pReq
)
{
int32_t
tDeserializeSCreateFuncReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateFuncReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -1457,7 +1457,7 @@ int32_t tDeserializeSCreateFuncReq(void *buf, int32_t bufLen, SCreateFuncReq *pR
...
@@ -1457,7 +1457,7 @@ int32_t tDeserializeSCreateFuncReq(void *buf, int32_t bufLen, SCreateFuncReq *pR
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -1467,8 +1467,8 @@ void tFreeSCreateFuncReq(SCreateFuncReq *pReq) {
...
@@ -1467,8 +1467,8 @@ void tFreeSCreateFuncReq(SCreateFuncReq *pReq) {
}
}
int32_t
tSerializeSDropFuncReq
(
void
*
buf
,
int32_t
bufLen
,
SDropFuncReq
*
pReq
)
{
int32_t
tSerializeSDropFuncReq
(
void
*
buf
,
int32_t
bufLen
,
SDropFuncReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -1476,26 +1476,26 @@ int32_t tSerializeSDropFuncReq(void *buf, int32_t bufLen, SDropFuncReq *pReq) {
...
@@ -1476,26 +1476,26 @@ int32_t tSerializeSDropFuncReq(void *buf, int32_t bufLen, SDropFuncReq *pReq) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSDropFuncReq
(
void
*
buf
,
int32_t
bufLen
,
SDropFuncReq
*
pReq
)
{
int32_t
tDeserializeSDropFuncReq
(
void
*
buf
,
int32_t
bufLen
,
SDropFuncReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
igNotExists
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
igNotExists
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSRetrieveFuncReq
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveFuncReq
*
pReq
)
{
int32_t
tSerializeSRetrieveFuncReq
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveFuncReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
numOfFuncs
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
numOfFuncs
)
<
0
)
return
-
1
;
...
@@ -1510,13 +1510,13 @@ int32_t tSerializeSRetrieveFuncReq(void *buf, int32_t bufLen, SRetrieveFuncReq *
...
@@ -1510,13 +1510,13 @@ int32_t tSerializeSRetrieveFuncReq(void *buf, int32_t bufLen, SRetrieveFuncReq *
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSRetrieveFuncReq
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveFuncReq
*
pReq
)
{
int32_t
tDeserializeSRetrieveFuncReq
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveFuncReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
numOfFuncs
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
numOfFuncs
)
<
0
)
return
-
1
;
...
@@ -1532,15 +1532,15 @@ int32_t tDeserializeSRetrieveFuncReq(void *buf, int32_t bufLen, SRetrieveFuncReq
...
@@ -1532,15 +1532,15 @@ int32_t tDeserializeSRetrieveFuncReq(void *buf, int32_t bufLen, SRetrieveFuncReq
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
void
tFreeSRetrieveFuncReq
(
SRetrieveFuncReq
*
pReq
)
{
taosArrayDestroy
(
pReq
->
pFuncNames
);
}
void
tFreeSRetrieveFuncReq
(
SRetrieveFuncReq
*
pReq
)
{
taosArrayDestroy
(
pReq
->
pFuncNames
);
}
int32_t
tSerializeSRetrieveFuncRsp
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveFuncRsp
*
pRsp
)
{
int32_t
tSerializeSRetrieveFuncRsp
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveFuncRsp
*
pRsp
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
numOfFuncs
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
numOfFuncs
)
<
0
)
return
-
1
;
...
@@ -1569,13 +1569,13 @@ int32_t tSerializeSRetrieveFuncRsp(void *buf, int32_t bufLen, SRetrieveFuncRsp *
...
@@ -1569,13 +1569,13 @@ int32_t tSerializeSRetrieveFuncRsp(void *buf, int32_t bufLen, SRetrieveFuncRsp *
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSRetrieveFuncRsp
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveFuncRsp
*
pRsp
)
{
int32_t
tDeserializeSRetrieveFuncRsp
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveFuncRsp
*
pRsp
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
numOfFuncs
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
numOfFuncs
)
<
0
)
return
-
1
;
...
@@ -1615,7 +1615,7 @@ int32_t tDeserializeSRetrieveFuncRsp(void *buf, int32_t bufLen, SRetrieveFuncRsp
...
@@ -1615,7 +1615,7 @@ int32_t tDeserializeSRetrieveFuncRsp(void *buf, int32_t bufLen, SRetrieveFuncRsp
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -1638,8 +1638,8 @@ void tFreeSRetrieveFuncRsp(SRetrieveFuncRsp *pRsp) {
...
@@ -1638,8 +1638,8 @@ void tFreeSRetrieveFuncRsp(SRetrieveFuncRsp *pRsp) {
}
}
int32_t
tSerializeSCreateDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateDbReq
*
pReq
)
{
int32_t
tSerializeSCreateDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateDbReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
db
)
<
0
)
return
-
1
;
...
@@ -1673,13 +1673,13 @@ int32_t tSerializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) {
...
@@ -1673,13 +1673,13 @@ int32_t tSerializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSCreateDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateDbReq
*
pReq
)
{
int32_t
tDeserializeSCreateDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateDbReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
...
@@ -1723,7 +1723,7 @@ int32_t tDeserializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq)
...
@@ -1723,7 +1723,7 @@ int32_t tDeserializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq)
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -1733,8 +1733,8 @@ void tFreeSCreateDbReq(SCreateDbReq *pReq) {
...
@@ -1733,8 +1733,8 @@ void tFreeSCreateDbReq(SCreateDbReq *pReq) {
}
}
int32_t
tSerializeSAlterDbReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterDbReq
*
pReq
)
{
int32_t
tSerializeSAlterDbReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterDbReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
db
)
<
0
)
return
-
1
;
...
@@ -1753,13 +1753,13 @@ int32_t tSerializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
...
@@ -1753,13 +1753,13 @@ int32_t tSerializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSAlterDbReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterDbReq
*
pReq
)
{
int32_t
tDeserializeSAlterDbReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterDbReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
...
@@ -1777,13 +1777,13 @@ int32_t tDeserializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
...
@@ -1777,13 +1777,13 @@ int32_t tDeserializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
replications
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
replications
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSDropDbReq
(
void
*
buf
,
int32_t
bufLen
,
SDropDbReq
*
pReq
)
{
int32_t
tSerializeSDropDbReq
(
void
*
buf
,
int32_t
bufLen
,
SDropDbReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
db
)
<
0
)
return
-
1
;
...
@@ -1791,26 +1791,26 @@ int32_t tSerializeSDropDbReq(void *buf, int32_t bufLen, SDropDbReq *pReq) {
...
@@ -1791,26 +1791,26 @@ int32_t tSerializeSDropDbReq(void *buf, int32_t bufLen, SDropDbReq *pReq) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSDropDbReq
(
void
*
buf
,
int32_t
bufLen
,
SDropDbReq
*
pReq
)
{
int32_t
tDeserializeSDropDbReq
(
void
*
buf
,
int32_t
bufLen
,
SDropDbReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
ignoreNotExists
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
ignoreNotExists
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSDropDbRsp
(
void
*
buf
,
int32_t
bufLen
,
SDropDbRsp
*
pRsp
)
{
int32_t
tSerializeSDropDbRsp
(
void
*
buf
,
int32_t
bufLen
,
SDropDbRsp
*
pRsp
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
db
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
db
)
<
0
)
return
-
1
;
...
@@ -1818,26 +1818,26 @@ int32_t tSerializeSDropDbRsp(void *buf, int32_t bufLen, SDropDbRsp *pRsp) {
...
@@ -1818,26 +1818,26 @@ int32_t tSerializeSDropDbRsp(void *buf, int32_t bufLen, SDropDbRsp *pRsp) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSDropDbRsp
(
void
*
buf
,
int32_t
bufLen
,
SDropDbRsp
*
pRsp
)
{
int32_t
tDeserializeSDropDbRsp
(
void
*
buf
,
int32_t
bufLen
,
SDropDbRsp
*
pRsp
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
db
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
db
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pRsp
->
uid
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pRsp
->
uid
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSUseDbReq
(
void
*
buf
,
int32_t
bufLen
,
SUseDbReq
*
pReq
)
{
int32_t
tSerializeSUseDbReq
(
void
*
buf
,
int32_t
bufLen
,
SUseDbReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
db
)
<
0
)
return
-
1
;
...
@@ -1847,13 +1847,13 @@ int32_t tSerializeSUseDbReq(void *buf, int32_t bufLen, SUseDbReq *pReq) {
...
@@ -1847,13 +1847,13 @@ int32_t tSerializeSUseDbReq(void *buf, int32_t bufLen, SUseDbReq *pReq) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSUseDbReq
(
void
*
buf
,
int32_t
bufLen
,
SUseDbReq
*
pReq
)
{
int32_t
tDeserializeSUseDbReq
(
void
*
buf
,
int32_t
bufLen
,
SUseDbReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
...
@@ -1862,38 +1862,38 @@ int32_t tDeserializeSUseDbReq(void *buf, int32_t bufLen, SUseDbReq *pReq) {
...
@@ -1862,38 +1862,38 @@ int32_t tDeserializeSUseDbReq(void *buf, int32_t bufLen, SUseDbReq *pReq) {
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
numOfTable
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
numOfTable
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSQnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListReq
*
pReq
)
{
int32_t
tSerializeSQnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
rowNum
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
rowNum
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSQnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListReq
*
pReq
)
{
int32_t
tDeserializeSQnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
rowNum
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
rowNum
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
)
{
int32_t
tSerializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
int32_t
num
=
taosArrayGetSize
(
pRsp
->
addrsList
);
int32_t
num
=
taosArrayGetSize
(
pRsp
->
addrsList
);
...
@@ -1905,13 +1905,13 @@ int32_t tSerializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp)
...
@@ -1905,13 +1905,13 @@ int32_t tSerializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp)
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
)
{
int32_t
tDeserializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
int32_t
num
=
0
;
int32_t
num
=
0
;
...
@@ -1928,38 +1928,38 @@ int32_t tDeserializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp
...
@@ -1928,38 +1928,38 @@ int32_t tDeserializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
void
tFreeSQnodeListRsp
(
SQnodeListRsp
*
pRsp
)
{
taosArrayDestroy
(
pRsp
->
addrsList
);
}
void
tFreeSQnodeListRsp
(
SQnodeListRsp
*
pRsp
)
{
taosArrayDestroy
(
pRsp
->
addrsList
);
}
int32_t
tSerializeSCompactDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCompactDbReq
*
pReq
)
{
int32_t
tSerializeSCompactDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCompactDbReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
db
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSCompactDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCompactDbReq
*
pReq
)
{
int32_t
tDeserializeSCompactDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCompactDbReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSUseDbRspImp
(
S
C
oder
*
pEncoder
,
const
SUseDbRsp
*
pRsp
)
{
int32_t
tSerializeSUseDbRspImp
(
S
Enc
oder
*
pEncoder
,
const
SUseDbRsp
*
pRsp
)
{
if
(
tEncodeCStr
(
pEncoder
,
pRsp
->
db
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pRsp
->
db
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pRsp
->
uid
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pRsp
->
uid
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pRsp
->
vgVersion
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pRsp
->
vgVersion
)
<
0
)
return
-
1
;
...
@@ -1979,21 +1979,21 @@ int32_t tSerializeSUseDbRspImp(SCoder *pEncoder, const SUseDbRsp *pRsp) {
...
@@ -1979,21 +1979,21 @@ int32_t tSerializeSUseDbRspImp(SCoder *pEncoder, const SUseDbRsp *pRsp) {
}
}
int32_t
tSerializeSUseDbRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SUseDbRsp
*
pRsp
)
{
int32_t
tSerializeSUseDbRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SUseDbRsp
*
pRsp
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tSerializeSUseDbRspImp
(
&
encoder
,
pRsp
)
<
0
)
return
-
1
;
if
(
tSerializeSUseDbRspImp
(
&
encoder
,
pRsp
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tSerializeSUseDbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SUseDbBatchRsp
*
pRsp
)
{
int32_t
tSerializeSUseDbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SUseDbBatchRsp
*
pRsp
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
...
@@ -2006,11 +2006,11 @@ int32_t tSerializeSUseDbBatchRsp(void *buf, int32_t bufLen, SUseDbBatchRsp *pRsp
...
@@ -2006,11 +2006,11 @@ int32_t tSerializeSUseDbBatchRsp(void *buf, int32_t bufLen, SUseDbBatchRsp *pRsp
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSUseDbRspImp
(
S
C
oder
*
pDecoder
,
SUseDbRsp
*
pRsp
)
{
int32_t
tDeserializeSUseDbRspImp
(
S
Dec
oder
*
pDecoder
,
SUseDbRsp
*
pRsp
)
{
if
(
tDecodeCStrTo
(
pDecoder
,
pRsp
->
db
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
pRsp
->
db
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pRsp
->
uid
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pRsp
->
uid
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pRsp
->
vgVersion
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pRsp
->
vgVersion
)
<
0
)
return
-
1
;
...
@@ -2041,20 +2041,20 @@ int32_t tDeserializeSUseDbRspImp(SCoder *pDecoder, SUseDbRsp *pRsp) {
...
@@ -2041,20 +2041,20 @@ int32_t tDeserializeSUseDbRspImp(SCoder *pDecoder, SUseDbRsp *pRsp) {
}
}
int32_t
tDeserializeSUseDbRsp
(
void
*
buf
,
int32_t
bufLen
,
SUseDbRsp
*
pRsp
)
{
int32_t
tDeserializeSUseDbRsp
(
void
*
buf
,
int32_t
bufLen
,
SUseDbRsp
*
pRsp
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDeserializeSUseDbRspImp
(
&
decoder
,
pRsp
)
<
0
)
return
-
1
;
if
(
tDeserializeSUseDbRspImp
(
&
decoder
,
pRsp
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tDeserializeSUseDbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SUseDbBatchRsp
*
pRsp
)
{
int32_t
tDeserializeSUseDbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SUseDbBatchRsp
*
pRsp
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
...
@@ -2074,7 +2074,7 @@ int32_t tDeserializeSUseDbBatchRsp(void *buf, int32_t bufLen, SUseDbBatchRsp *pR
...
@@ -2074,7 +2074,7 @@ int32_t tDeserializeSUseDbBatchRsp(void *buf, int32_t bufLen, SUseDbBatchRsp *pR
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -2091,8 +2091,8 @@ void tFreeSUseDbBatchRsp(SUseDbBatchRsp *pRsp) {
...
@@ -2091,8 +2091,8 @@ void tFreeSUseDbBatchRsp(SUseDbBatchRsp *pRsp) {
}
}
int32_t
tSerializeSUserAuthBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SUserAuthBatchRsp
*
pRsp
)
{
int32_t
tSerializeSUserAuthBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SUserAuthBatchRsp
*
pRsp
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
...
@@ -2105,13 +2105,13 @@ int32_t tSerializeSUserAuthBatchRsp(void *buf, int32_t bufLen, SUserAuthBatchRsp
...
@@ -2105,13 +2105,13 @@ int32_t tSerializeSUserAuthBatchRsp(void *buf, int32_t bufLen, SUserAuthBatchRsp
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSUserAuthBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SUserAuthBatchRsp
*
pRsp
)
{
int32_t
tDeserializeSUserAuthBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SUserAuthBatchRsp
*
pRsp
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
...
@@ -2131,7 +2131,7 @@ int32_t tDeserializeSUserAuthBatchRsp(void *buf, int32_t bufLen, SUserAuthBatchR
...
@@ -2131,7 +2131,7 @@ int32_t tDeserializeSUserAuthBatchRsp(void *buf, int32_t bufLen, SUserAuthBatchR
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -2146,33 +2146,33 @@ void tFreeSUserAuthBatchRsp(SUserAuthBatchRsp *pRsp) {
...
@@ -2146,33 +2146,33 @@ void tFreeSUserAuthBatchRsp(SUserAuthBatchRsp *pRsp) {
}
}
int32_t
tSerializeSDbCfgReq
(
void
*
buf
,
int32_t
bufLen
,
SDbCfgReq
*
pReq
)
{
int32_t
tSerializeSDbCfgReq
(
void
*
buf
,
int32_t
bufLen
,
SDbCfgReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
db
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSDbCfgReq
(
void
*
buf
,
int32_t
bufLen
,
SDbCfgReq
*
pReq
)
{
int32_t
tDeserializeSDbCfgReq
(
void
*
buf
,
int32_t
bufLen
,
SDbCfgReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSDbCfgRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SDbCfgRsp
*
pRsp
)
{
int32_t
tSerializeSDbCfgRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SDbCfgRsp
*
pRsp
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
numOfVgroups
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
numOfVgroups
)
<
0
)
return
-
1
;
...
@@ -2204,13 +2204,13 @@ int32_t tSerializeSDbCfgRsp(void *buf, int32_t bufLen, const SDbCfgRsp *pRsp) {
...
@@ -2204,13 +2204,13 @@ int32_t tSerializeSDbCfgRsp(void *buf, int32_t bufLen, const SDbCfgRsp *pRsp) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSDbCfgRsp
(
void
*
buf
,
int32_t
bufLen
,
SDbCfgRsp
*
pRsp
)
{
int32_t
tDeserializeSDbCfgRsp
(
void
*
buf
,
int32_t
bufLen
,
SDbCfgRsp
*
pRsp
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
numOfVgroups
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
numOfVgroups
)
<
0
)
return
-
1
;
...
@@ -2251,38 +2251,38 @@ int32_t tDeserializeSDbCfgRsp(void *buf, int32_t bufLen, SDbCfgRsp *pRsp) {
...
@@ -2251,38 +2251,38 @@ int32_t tDeserializeSDbCfgRsp(void *buf, int32_t bufLen, SDbCfgRsp *pRsp) {
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSUserIndexReq
(
void
*
buf
,
int32_t
bufLen
,
SUserIndexReq
*
pReq
)
{
int32_t
tSerializeSUserIndexReq
(
void
*
buf
,
int32_t
bufLen
,
SUserIndexReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
indexFName
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
indexFName
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSUserIndexReq
(
void
*
buf
,
int32_t
bufLen
,
SUserIndexReq
*
pReq
)
{
int32_t
tDeserializeSUserIndexReq
(
void
*
buf
,
int32_t
bufLen
,
SUserIndexReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
indexFName
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
indexFName
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSUserIndexRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SUserIndexRsp
*
pRsp
)
{
int32_t
tSerializeSUserIndexRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SUserIndexRsp
*
pRsp
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
dbFName
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
dbFName
)
<
0
)
return
-
1
;
...
@@ -2293,13 +2293,13 @@ int32_t tSerializeSUserIndexRsp(void *buf, int32_t bufLen, const SUserIndexRsp *
...
@@ -2293,13 +2293,13 @@ int32_t tSerializeSUserIndexRsp(void *buf, int32_t bufLen, const SUserIndexRsp *
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSUserIndexRsp
(
void
*
buf
,
int32_t
bufLen
,
SUserIndexRsp
*
pRsp
)
{
int32_t
tDeserializeSUserIndexRsp
(
void
*
buf
,
int32_t
bufLen
,
SUserIndexRsp
*
pRsp
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
dbFName
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
dbFName
)
<
0
)
return
-
1
;
...
@@ -2309,13 +2309,13 @@ int32_t tDeserializeSUserIndexRsp(void *buf, int32_t bufLen, SUserIndexRsp *pRsp
...
@@ -2309,13 +2309,13 @@ int32_t tDeserializeSUserIndexRsp(void *buf, int32_t bufLen, SUserIndexRsp *pRsp
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
indexExts
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
indexExts
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSShowReq
(
void
*
buf
,
int32_t
bufLen
,
SShowReq
*
pReq
)
{
int32_t
tSerializeSShowReq
(
void
*
buf
,
int32_t
bufLen
,
SShowReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
type
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
type
)
<
0
)
return
-
1
;
...
@@ -2327,13 +2327,13 @@ int32_t tSerializeSShowReq(void *buf, int32_t bufLen, SShowReq *pReq) {
...
@@ -2327,13 +2327,13 @@ int32_t tSerializeSShowReq(void *buf, int32_t bufLen, SShowReq *pReq) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSShowReq
(
void
*
buf
,
int32_t
bufLen
,
SShowReq
*
pReq
)
{
int32_t
tDeserializeSShowReq
(
void
*
buf
,
int32_t
bufLen
,
SShowReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
type
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
type
)
<
0
)
return
-
1
;
...
@@ -2346,15 +2346,15 @@ int32_t tDeserializeSShowReq(void *buf, int32_t bufLen, SShowReq *pReq) {
...
@@ -2346,15 +2346,15 @@ int32_t tDeserializeSShowReq(void *buf, int32_t bufLen, SShowReq *pReq) {
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
void
tFreeSShowReq
(
SShowReq
*
pReq
)
{
taosMemoryFreeClear
(
pReq
->
payload
);
}
void
tFreeSShowReq
(
SShowReq
*
pReq
)
{
taosMemoryFreeClear
(
pReq
->
payload
);
}
int32_t
tSerializeSRetrieveTableReq
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveTableReq
*
pReq
)
{
int32_t
tSerializeSRetrieveTableReq
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveTableReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
showId
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
showId
)
<
0
)
return
-
1
;
...
@@ -2363,24 +2363,24 @@ int32_t tSerializeSRetrieveTableReq(void *buf, int32_t bufLen, SRetrieveTableReq
...
@@ -2363,24 +2363,24 @@ int32_t tSerializeSRetrieveTableReq(void *buf, int32_t bufLen, SRetrieveTableReq
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSRetrieveTableReq
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveTableReq
*
pReq
)
{
int32_t
tDeserializeSRetrieveTableReq
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveTableReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
showId
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
showId
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
tb
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
tb
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
static
int32_t
tEncodeSTableMetaRsp
(
S
C
oder
*
pEncoder
,
STableMetaRsp
*
pRsp
)
{
static
int32_t
tEncodeSTableMetaRsp
(
S
Enc
oder
*
pEncoder
,
STableMetaRsp
*
pRsp
)
{
if
(
tEncodeCStr
(
pEncoder
,
pRsp
->
tbName
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pRsp
->
tbName
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pRsp
->
stbName
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pRsp
->
stbName
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pRsp
->
dbFName
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pRsp
->
dbFName
)
<
0
)
return
-
1
;
...
@@ -2402,7 +2402,7 @@ static int32_t tEncodeSTableMetaRsp(SCoder *pEncoder, STableMetaRsp *pRsp) {
...
@@ -2402,7 +2402,7 @@ static int32_t tEncodeSTableMetaRsp(SCoder *pEncoder, STableMetaRsp *pRsp) {
return
0
;
return
0
;
}
}
static
int32_t
tDecodeSTableMetaRsp
(
S
C
oder
*
pDecoder
,
STableMetaRsp
*
pRsp
)
{
static
int32_t
tDecodeSTableMetaRsp
(
S
Dec
oder
*
pDecoder
,
STableMetaRsp
*
pRsp
)
{
if
(
tDecodeCStrTo
(
pDecoder
,
pRsp
->
tbName
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
pRsp
->
tbName
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
pRsp
->
stbName
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
pRsp
->
stbName
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
pRsp
->
dbFName
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
pRsp
->
dbFName
)
<
0
)
return
-
1
;
...
@@ -2430,21 +2430,21 @@ static int32_t tDecodeSTableMetaRsp(SCoder *pDecoder, STableMetaRsp *pRsp) {
...
@@ -2430,21 +2430,21 @@ static int32_t tDecodeSTableMetaRsp(SCoder *pDecoder, STableMetaRsp *pRsp) {
}
}
int32_t
tSerializeSTableMetaRsp
(
void
*
buf
,
int32_t
bufLen
,
STableMetaRsp
*
pRsp
)
{
int32_t
tSerializeSTableMetaRsp
(
void
*
buf
,
int32_t
bufLen
,
STableMetaRsp
*
pRsp
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeSTableMetaRsp
(
&
encoder
,
pRsp
)
<
0
)
return
-
1
;
if
(
tEncodeSTableMetaRsp
(
&
encoder
,
pRsp
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tSerializeSTableMetaBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
STableMetaBatchRsp
*
pRsp
)
{
int32_t
tSerializeSTableMetaBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
STableMetaBatchRsp
*
pRsp
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
...
@@ -2457,25 +2457,25 @@ int32_t tSerializeSTableMetaBatchRsp(void *buf, int32_t bufLen, STableMetaBatchR
...
@@ -2457,25 +2457,25 @@ int32_t tSerializeSTableMetaBatchRsp(void *buf, int32_t bufLen, STableMetaBatchR
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSTableMetaRsp
(
void
*
buf
,
int32_t
bufLen
,
STableMetaRsp
*
pRsp
)
{
int32_t
tDeserializeSTableMetaRsp
(
void
*
buf
,
int32_t
bufLen
,
STableMetaRsp
*
pRsp
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeSTableMetaRsp
(
&
decoder
,
pRsp
)
<
0
)
return
-
1
;
if
(
tDecodeSTableMetaRsp
(
&
decoder
,
pRsp
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tDeserializeSTableMetaBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
STableMetaBatchRsp
*
pRsp
)
{
int32_t
tDeserializeSTableMetaBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
STableMetaBatchRsp
*
pRsp
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
...
@@ -2495,7 +2495,7 @@ int32_t tDeserializeSTableMetaBatchRsp(void *buf, int32_t bufLen, STableMetaBatc
...
@@ -2495,7 +2495,7 @@ int32_t tDeserializeSTableMetaBatchRsp(void *buf, int32_t bufLen, STableMetaBatc
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -2512,8 +2512,8 @@ void tFreeSTableMetaBatchRsp(STableMetaBatchRsp *pRsp) {
...
@@ -2512,8 +2512,8 @@ void tFreeSTableMetaBatchRsp(STableMetaBatchRsp *pRsp) {
}
}
int32_t
tSerializeSShowRsp
(
void
*
buf
,
int32_t
bufLen
,
SShowRsp
*
pRsp
)
{
int32_t
tSerializeSShowRsp
(
void
*
buf
,
int32_t
bufLen
,
SShowRsp
*
pRsp
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pRsp
->
showId
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pRsp
->
showId
)
<
0
)
return
-
1
;
...
@@ -2521,20 +2521,20 @@ int32_t tSerializeSShowRsp(void *buf, int32_t bufLen, SShowRsp *pRsp) {
...
@@ -2521,20 +2521,20 @@ int32_t tSerializeSShowRsp(void *buf, int32_t bufLen, SShowRsp *pRsp) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSShowRsp
(
void
*
buf
,
int32_t
bufLen
,
SShowRsp
*
pRsp
)
{
int32_t
tDeserializeSShowRsp
(
void
*
buf
,
int32_t
bufLen
,
SShowRsp
*
pRsp
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pRsp
->
showId
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pRsp
->
showId
)
<
0
)
return
-
1
;
if
(
tDecodeSTableMetaRsp
(
&
decoder
,
&
pRsp
->
tableMeta
)
<
0
)
return
-
1
;
if
(
tDecodeSTableMetaRsp
(
&
decoder
,
&
pRsp
->
tableMeta
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -2547,8 +2547,8 @@ int32_t tSerializeSTableInfoReq(void *buf, int32_t bufLen, STableInfoReq *pReq)
...
@@ -2547,8 +2547,8 @@ int32_t tSerializeSTableInfoReq(void *buf, int32_t bufLen, STableInfoReq *pReq)
bufLen
-=
headLen
;
bufLen
-=
headLen
;
}
}
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
dbFName
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
dbFName
)
<
0
)
return
-
1
;
...
@@ -2556,7 +2556,7 @@ int32_t tSerializeSTableInfoReq(void *buf, int32_t bufLen, STableInfoReq *pReq)
...
@@ -2556,7 +2556,7 @@ int32_t tSerializeSTableInfoReq(void *buf, int32_t bufLen, STableInfoReq *pReq)
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
if
(
buf
!=
NULL
)
{
if
(
buf
!=
NULL
)
{
SMsgHead
*
pHead
=
(
SMsgHead
*
)((
char
*
)
buf
-
headLen
);
SMsgHead
*
pHead
=
(
SMsgHead
*
)((
char
*
)
buf
-
headLen
);
...
@@ -2574,21 +2574,21 @@ int32_t tDeserializeSTableInfoReq(void *buf, int32_t bufLen, STableInfoReq *pReq
...
@@ -2574,21 +2574,21 @@ int32_t tDeserializeSTableInfoReq(void *buf, int32_t bufLen, STableInfoReq *pReq
pHead
->
vgId
=
pReq
->
header
.
vgId
;
pHead
->
vgId
=
pReq
->
header
.
vgId
;
pHead
->
contLen
=
pReq
->
header
.
contLen
;
pHead
->
contLen
=
pReq
->
header
.
contLen
;
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
(
char
*
)
buf
+
headLen
,
bufLen
-
headLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
(
char
*
)
buf
+
headLen
,
bufLen
-
headLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
dbFName
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
dbFName
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
tbName
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
tbName
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSMDropTopicReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropTopicReq
*
pReq
)
{
int32_t
tSerializeSMDropTopicReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropTopicReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -2596,20 +2596,20 @@ int32_t tSerializeSMDropTopicReq(void *buf, int32_t bufLen, SMDropTopicReq *pReq
...
@@ -2596,20 +2596,20 @@ int32_t tSerializeSMDropTopicReq(void *buf, int32_t bufLen, SMDropTopicReq *pReq
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSMDropTopicReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropTopicReq
*
pReq
)
{
int32_t
tDeserializeSMDropTopicReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropTopicReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
igNotExists
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
igNotExists
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -2619,8 +2619,8 @@ int32_t tSerializeSCMCreateTopicReq(void *buf, int32_t bufLen, const SCMCreateTo
...
@@ -2619,8 +2619,8 @@ int32_t tSerializeSCMCreateTopicReq(void *buf, int32_t bufLen, const SCMCreateTo
if
(
pReq
->
sql
!=
NULL
)
sqlLen
=
(
int32_t
)
strlen
(
pReq
->
sql
);
if
(
pReq
->
sql
!=
NULL
)
sqlLen
=
(
int32_t
)
strlen
(
pReq
->
sql
);
if
(
pReq
->
ast
!=
NULL
)
astLen
=
(
int32_t
)
strlen
(
pReq
->
ast
);
if
(
pReq
->
ast
!=
NULL
)
astLen
=
(
int32_t
)
strlen
(
pReq
->
ast
);
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -2637,7 +2637,7 @@ int32_t tSerializeSCMCreateTopicReq(void *buf, int32_t bufLen, const SCMCreateTo
...
@@ -2637,7 +2637,7 @@ int32_t tSerializeSCMCreateTopicReq(void *buf, int32_t bufLen, const SCMCreateTo
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
...
@@ -2645,8 +2645,8 @@ int32_t tDeserializeSCMCreateTopicReq(void *buf, int32_t bufLen, SCMCreateTopicR
...
@@ -2645,8 +2645,8 @@ int32_t tDeserializeSCMCreateTopicReq(void *buf, int32_t bufLen, SCMCreateTopicR
int32_t
sqlLen
=
0
;
int32_t
sqlLen
=
0
;
int32_t
astLen
=
0
;
int32_t
astLen
=
0
;
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -2673,7 +2673,7 @@ int32_t tDeserializeSCMCreateTopicReq(void *buf, int32_t bufLen, SCMCreateTopicR
...
@@ -2673,7 +2673,7 @@ int32_t tDeserializeSCMCreateTopicReq(void *buf, int32_t bufLen, SCMCreateTopicR
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -2683,33 +2683,33 @@ void tFreeSCMCreateTopicReq(SCMCreateTopicReq *pReq) {
...
@@ -2683,33 +2683,33 @@ void tFreeSCMCreateTopicReq(SCMCreateTopicReq *pReq) {
}
}
int32_t
tSerializeSCMCreateTopicRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SCMCreateTopicRsp
*
pRsp
)
{
int32_t
tSerializeSCMCreateTopicRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SCMCreateTopicRsp
*
pRsp
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pRsp
->
topicId
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pRsp
->
topicId
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSCMCreateTopicRsp
(
void
*
buf
,
int32_t
bufLen
,
SCMCreateTopicRsp
*
pRsp
)
{
int32_t
tDeserializeSCMCreateTopicRsp
(
void
*
buf
,
int32_t
bufLen
,
SCMCreateTopicRsp
*
pRsp
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pRsp
->
topicId
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pRsp
->
topicId
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSConnectReq
(
void
*
buf
,
int32_t
bufLen
,
SConnectReq
*
pReq
)
{
int32_t
tSerializeSConnectReq
(
void
*
buf
,
int32_t
bufLen
,
SConnectReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
connType
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
connType
)
<
0
)
return
-
1
;
...
@@ -2722,13 +2722,13 @@ int32_t tSerializeSConnectReq(void *buf, int32_t bufLen, SConnectReq *pReq) {
...
@@ -2722,13 +2722,13 @@ int32_t tSerializeSConnectReq(void *buf, int32_t bufLen, SConnectReq *pReq) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSConnectReq
(
void
*
buf
,
int32_t
bufLen
,
SConnectReq
*
pReq
)
{
int32_t
tDeserializeSConnectReq
(
void
*
buf
,
int32_t
bufLen
,
SConnectReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
connType
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
connType
)
<
0
)
return
-
1
;
...
@@ -2740,13 +2740,13 @@ int32_t tDeserializeSConnectReq(void *buf, int32_t bufLen, SConnectReq *pReq) {
...
@@ -2740,13 +2740,13 @@ int32_t tDeserializeSConnectReq(void *buf, int32_t bufLen, SConnectReq *pReq) {
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
startTime
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
startTime
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSConnectRsp
(
void
*
buf
,
int32_t
bufLen
,
SConnectRsp
*
pRsp
)
{
int32_t
tSerializeSConnectRsp
(
void
*
buf
,
int32_t
bufLen
,
SConnectRsp
*
pRsp
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
acctId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
acctId
)
<
0
)
return
-
1
;
...
@@ -2759,13 +2759,13 @@ int32_t tSerializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) {
...
@@ -2759,13 +2759,13 @@ int32_t tSerializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSConnectRsp
(
void
*
buf
,
int32_t
bufLen
,
SConnectRsp
*
pRsp
)
{
int32_t
tDeserializeSConnectRsp
(
void
*
buf
,
int32_t
bufLen
,
SConnectRsp
*
pRsp
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
acctId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
acctId
)
<
0
)
return
-
1
;
...
@@ -2777,43 +2777,43 @@ int32_t tDeserializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) {
...
@@ -2777,43 +2777,43 @@ int32_t tDeserializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) {
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
sVersion
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
sVersion
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSMTimerMsg
(
void
*
buf
,
int32_t
bufLen
,
SMTimerReq
*
pReq
)
{
int32_t
tSerializeSMTimerMsg
(
void
*
buf
,
int32_t
bufLen
,
SMTimerReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
reserved
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
reserved
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSMTimerMsg
(
void
*
buf
,
int32_t
bufLen
,
SMTimerReq
*
pReq
)
{
int32_t
tDeserializeSMTimerMsg
(
void
*
buf
,
int32_t
bufLen
,
SMTimerReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
reserved
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
reserved
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tEncodeSReplica
(
S
C
oder
*
pEncoder
,
SReplica
*
pReplica
)
{
int32_t
tEncodeSReplica
(
S
Enc
oder
*
pEncoder
,
SReplica
*
pReplica
)
{
if
(
tEncodeI32
(
pEncoder
,
pReplica
->
id
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pReplica
->
id
)
<
0
)
return
-
1
;
if
(
tEncodeU16
(
pEncoder
,
pReplica
->
port
)
<
0
)
return
-
1
;
if
(
tEncodeU16
(
pEncoder
,
pReplica
->
port
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pReplica
->
fqdn
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pReplica
->
fqdn
)
<
0
)
return
-
1
;
return
0
;
return
0
;
}
}
int32_t
tDecodeSReplica
(
S
C
oder
*
pDecoder
,
SReplica
*
pReplica
)
{
int32_t
tDecodeSReplica
(
S
Dec
oder
*
pDecoder
,
SReplica
*
pReplica
)
{
if
(
tDecodeI32
(
pDecoder
,
&
pReplica
->
id
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pReplica
->
id
)
<
0
)
return
-
1
;
if
(
tDecodeU16
(
pDecoder
,
&
pReplica
->
port
)
<
0
)
return
-
1
;
if
(
tDecodeU16
(
pDecoder
,
&
pReplica
->
port
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
pReplica
->
fqdn
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
pReplica
->
fqdn
)
<
0
)
return
-
1
;
...
@@ -2821,8 +2821,8 @@ int32_t tDecodeSReplica(SCoder *pDecoder, SReplica *pReplica) {
...
@@ -2821,8 +2821,8 @@ int32_t tDecodeSReplica(SCoder *pDecoder, SReplica *pReplica) {
}
}
int32_t
tSerializeSCreateVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateVnodeReq
*
pReq
)
{
int32_t
tSerializeSCreateVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateVnodeReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
vgId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
vgId
)
<
0
)
return
-
1
;
...
@@ -2866,13 +2866,13 @@ int32_t tSerializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *pR
...
@@ -2866,13 +2866,13 @@ int32_t tSerializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *pR
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSCreateVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateVnodeReq
*
pReq
)
{
int32_t
tDeserializeSCreateVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateVnodeReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
vgId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
vgId
)
<
0
)
return
-
1
;
...
@@ -2926,7 +2926,7 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *
...
@@ -2926,7 +2926,7 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -2937,8 +2937,8 @@ int32_t tFreeSCreateVnodeReq(SCreateVnodeReq *pReq) {
...
@@ -2937,8 +2937,8 @@ int32_t tFreeSCreateVnodeReq(SCreateVnodeReq *pReq) {
}
}
int32_t
tSerializeSDropVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDropVnodeReq
*
pReq
)
{
int32_t
tSerializeSDropVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDropVnodeReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
vgId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
vgId
)
<
0
)
return
-
1
;
...
@@ -2948,13 +2948,13 @@ int32_t tSerializeSDropVnodeReq(void *buf, int32_t bufLen, SDropVnodeReq *pReq)
...
@@ -2948,13 +2948,13 @@ int32_t tSerializeSDropVnodeReq(void *buf, int32_t bufLen, SDropVnodeReq *pReq)
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSDropVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDropVnodeReq
*
pReq
)
{
int32_t
tDeserializeSDropVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDropVnodeReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
vgId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
vgId
)
<
0
)
return
-
1
;
...
@@ -2963,13 +2963,13 @@ int32_t tDeserializeSDropVnodeReq(void *buf, int32_t bufLen, SDropVnodeReq *pReq
...
@@ -2963,13 +2963,13 @@ int32_t tDeserializeSDropVnodeReq(void *buf, int32_t bufLen, SDropVnodeReq *pReq
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSCompactVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCompactVnodeReq
*
pReq
)
{
int32_t
tSerializeSCompactVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCompactVnodeReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
dbUid
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
dbUid
)
<
0
)
return
-
1
;
...
@@ -2977,26 +2977,26 @@ int32_t tSerializeSCompactVnodeReq(void *buf, int32_t bufLen, SCompactVnodeReq *
...
@@ -2977,26 +2977,26 @@ int32_t tSerializeSCompactVnodeReq(void *buf, int32_t bufLen, SCompactVnodeReq *
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSCompactVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCompactVnodeReq
*
pReq
)
{
int32_t
tDeserializeSCompactVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCompactVnodeReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
dbUid
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
dbUid
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSAlterVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterVnodeReq
*
pReq
)
{
int32_t
tSerializeSAlterVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterVnodeReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
vgVersion
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
vgVersion
)
<
0
)
return
-
1
;
...
@@ -3021,13 +3021,13 @@ int32_t tSerializeSAlterVnodeReq(void *buf, int32_t bufLen, SAlterVnodeReq *pReq
...
@@ -3021,13 +3021,13 @@ int32_t tSerializeSAlterVnodeReq(void *buf, int32_t bufLen, SAlterVnodeReq *pReq
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSAlterVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterVnodeReq
*
pReq
)
{
int32_t
tDeserializeSAlterVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterVnodeReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
vgVersion
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
vgVersion
)
<
0
)
return
-
1
;
...
@@ -3050,13 +3050,13 @@ int32_t tDeserializeSAlterVnodeReq(void *buf, int32_t bufLen, SAlterVnodeReq *pR
...
@@ -3050,13 +3050,13 @@ int32_t tDeserializeSAlterVnodeReq(void *buf, int32_t bufLen, SAlterVnodeReq *pR
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSKillQueryReq
(
void
*
buf
,
int32_t
bufLen
,
SKillQueryReq
*
pReq
)
{
int32_t
tSerializeSKillQueryReq
(
void
*
buf
,
int32_t
bufLen
,
SKillQueryReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
connId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
connId
)
<
0
)
return
-
1
;
...
@@ -3064,76 +3064,76 @@ int32_t tSerializeSKillQueryReq(void *buf, int32_t bufLen, SKillQueryReq *pReq)
...
@@ -3064,76 +3064,76 @@ int32_t tSerializeSKillQueryReq(void *buf, int32_t bufLen, SKillQueryReq *pReq)
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSKillQueryReq
(
void
*
buf
,
int32_t
bufLen
,
SKillQueryReq
*
pReq
)
{
int32_t
tDeserializeSKillQueryReq
(
void
*
buf
,
int32_t
bufLen
,
SKillQueryReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
connId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
connId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
queryId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
queryId
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSKillConnReq
(
void
*
buf
,
int32_t
bufLen
,
SKillConnReq
*
pReq
)
{
int32_t
tSerializeSKillConnReq
(
void
*
buf
,
int32_t
bufLen
,
SKillConnReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
connId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
connId
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSKillConnReq
(
void
*
buf
,
int32_t
bufLen
,
SKillConnReq
*
pReq
)
{
int32_t
tDeserializeSKillConnReq
(
void
*
buf
,
int32_t
bufLen
,
SKillConnReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
connId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
connId
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSKillTransReq
(
void
*
buf
,
int32_t
bufLen
,
SKillTransReq
*
pReq
)
{
int32_t
tSerializeSKillTransReq
(
void
*
buf
,
int32_t
bufLen
,
SKillTransReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
transId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
transId
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSKillTransReq
(
void
*
buf
,
int32_t
bufLen
,
SKillTransReq
*
pReq
)
{
int32_t
tDeserializeSKillTransReq
(
void
*
buf
,
int32_t
bufLen
,
SKillTransReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
transId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
transId
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSDCreateMnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDCreateMnodeReq
*
pReq
)
{
int32_t
tSerializeSDCreateMnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDCreateMnodeReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
dnodeId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
dnodeId
)
<
0
)
return
-
1
;
...
@@ -3145,13 +3145,13 @@ int32_t tSerializeSDCreateMnodeReq(void *buf, int32_t bufLen, SDCreateMnodeReq *
...
@@ -3145,13 +3145,13 @@ int32_t tSerializeSDCreateMnodeReq(void *buf, int32_t bufLen, SDCreateMnodeReq *
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSDCreateMnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDCreateMnodeReq
*
pReq
)
{
int32_t
tDeserializeSDCreateMnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDCreateMnodeReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
dnodeId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
dnodeId
)
<
0
)
return
-
1
;
...
@@ -3162,13 +3162,13 @@ int32_t tDeserializeSDCreateMnodeReq(void *buf, int32_t bufLen, SDCreateMnodeReq
...
@@ -3162,13 +3162,13 @@ int32_t tDeserializeSDCreateMnodeReq(void *buf, int32_t bufLen, SDCreateMnodeReq
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSAuthReq
(
void
*
buf
,
int32_t
bufLen
,
SAuthReq
*
pReq
)
{
int32_t
tSerializeSAuthReq
(
void
*
buf
,
int32_t
bufLen
,
SAuthReq
*
pReq
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
user
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
user
)
<
0
)
return
-
1
;
...
@@ -3179,13 +3179,13 @@ int32_t tSerializeSAuthReq(void *buf, int32_t bufLen, SAuthReq *pReq) {
...
@@ -3179,13 +3179,13 @@ int32_t tSerializeSAuthReq(void *buf, int32_t bufLen, SAuthReq *pReq) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSAuthReq
(
void
*
buf
,
int32_t
bufLen
,
SAuthReq
*
pReq
)
{
int32_t
tDeserializeSAuthReq
(
void
*
buf
,
int32_t
bufLen
,
SAuthReq
*
pReq
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
user
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
user
)
<
0
)
return
-
1
;
...
@@ -3195,13 +3195,13 @@ int32_t tDeserializeSAuthReq(void *buf, int32_t bufLen, SAuthReq *pReq) {
...
@@ -3195,13 +3195,13 @@ int32_t tDeserializeSAuthReq(void *buf, int32_t bufLen, SAuthReq *pReq) {
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
ckey
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
ckey
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSServerStatusRsp
(
void
*
buf
,
int32_t
bufLen
,
SServerStatusRsp
*
pRsp
)
{
int32_t
tSerializeSServerStatusRsp
(
void
*
buf
,
int32_t
bufLen
,
SServerStatusRsp
*
pRsp
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
statusCode
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
statusCode
)
<
0
)
return
-
1
;
...
@@ -3210,24 +3210,24 @@ int32_t tSerializeSServerStatusRsp(void *buf, int32_t bufLen, SServerStatusRsp *
...
@@ -3210,24 +3210,24 @@ int32_t tSerializeSServerStatusRsp(void *buf, int32_t bufLen, SServerStatusRsp *
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSServerStatusRsp
(
void
*
buf
,
int32_t
bufLen
,
SServerStatusRsp
*
pRsp
)
{
int32_t
tDeserializeSServerStatusRsp
(
void
*
buf
,
int32_t
bufLen
,
SServerStatusRsp
*
pRsp
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
statusCode
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
statusCode
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
details
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
details
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tEncodeSMqOffset
(
S
C
oder
*
encoder
,
const
SMqOffset
*
pOffset
)
{
int32_t
tEncodeSMqOffset
(
S
Enc
oder
*
encoder
,
const
SMqOffset
*
pOffset
)
{
if
(
tEncodeI32
(
encoder
,
pOffset
->
vgId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
encoder
,
pOffset
->
vgId
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
encoder
,
pOffset
->
offset
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
encoder
,
pOffset
->
offset
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
encoder
,
pOffset
->
topicName
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
encoder
,
pOffset
->
topicName
)
<
0
)
return
-
1
;
...
@@ -3235,7 +3235,7 @@ int32_t tEncodeSMqOffset(SCoder *encoder, const SMqOffset *pOffset) {
...
@@ -3235,7 +3235,7 @@ int32_t tEncodeSMqOffset(SCoder *encoder, const SMqOffset *pOffset) {
return
encoder
->
pos
;
return
encoder
->
pos
;
}
}
int32_t
tDecodeSMqOffset
(
S
C
oder
*
decoder
,
SMqOffset
*
pOffset
)
{
int32_t
tDecodeSMqOffset
(
S
Dec
oder
*
decoder
,
SMqOffset
*
pOffset
)
{
if
(
tDecodeI32
(
decoder
,
&
pOffset
->
vgId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
decoder
,
&
pOffset
->
vgId
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
decoder
,
&
pOffset
->
offset
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
decoder
,
&
pOffset
->
offset
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
decoder
,
pOffset
->
topicName
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
decoder
,
pOffset
->
topicName
)
<
0
)
return
-
1
;
...
@@ -3243,7 +3243,7 @@ int32_t tDecodeSMqOffset(SCoder *decoder, SMqOffset *pOffset) {
...
@@ -3243,7 +3243,7 @@ int32_t tDecodeSMqOffset(SCoder *decoder, SMqOffset *pOffset) {
return
0
;
return
0
;
}
}
int32_t
tEncodeSMqCMCommitOffsetReq
(
S
C
oder
*
encoder
,
const
SMqCMCommitOffsetReq
*
pReq
)
{
int32_t
tEncodeSMqCMCommitOffsetReq
(
S
Enc
oder
*
encoder
,
const
SMqCMCommitOffsetReq
*
pReq
)
{
if
(
tStartEncode
(
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
encoder
,
pReq
->
num
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
encoder
,
pReq
->
num
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
pReq
->
num
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
pReq
->
num
;
i
++
)
{
...
@@ -3253,10 +3253,10 @@ int32_t tEncodeSMqCMCommitOffsetReq(SCoder *encoder, const SMqCMCommitOffsetReq
...
@@ -3253,10 +3253,10 @@ int32_t tEncodeSMqCMCommitOffsetReq(SCoder *encoder, const SMqCMCommitOffsetReq
return
encoder
->
pos
;
return
encoder
->
pos
;
}
}
int32_t
tDecodeSMqCMCommitOffsetReq
(
S
C
oder
*
decoder
,
SMqCMCommitOffsetReq
*
pReq
)
{
int32_t
tDecodeSMqCMCommitOffsetReq
(
S
Dec
oder
*
decoder
,
SMqCMCommitOffsetReq
*
pReq
)
{
if
(
tStartDecode
(
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
decoder
,
&
pReq
->
num
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
decoder
,
&
pReq
->
num
)
<
0
)
return
-
1
;
pReq
->
offsets
=
(
SMqOffset
*
)
t
C
oderMalloc
(
decoder
,
sizeof
(
SMqOffset
)
*
pReq
->
num
);
pReq
->
offsets
=
(
SMqOffset
*
)
t
Dec
oderMalloc
(
decoder
,
sizeof
(
SMqOffset
)
*
pReq
->
num
);
if
(
pReq
->
offsets
==
NULL
)
return
-
1
;
if
(
pReq
->
offsets
==
NULL
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
pReq
->
num
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
pReq
->
num
;
i
++
)
{
tDecodeSMqOffset
(
decoder
,
&
pReq
->
offsets
[
i
]);
tDecodeSMqOffset
(
decoder
,
&
pReq
->
offsets
[
i
]);
...
@@ -3266,8 +3266,8 @@ int32_t tDecodeSMqCMCommitOffsetReq(SCoder *decoder, SMqCMCommitOffsetReq *pReq)
...
@@ -3266,8 +3266,8 @@ int32_t tDecodeSMqCMCommitOffsetReq(SCoder *decoder, SMqCMCommitOffsetReq *pReq)
}
}
int32_t
tSerializeSExplainRsp
(
void
*
buf
,
int32_t
bufLen
,
SExplainRsp
*
pRsp
)
{
int32_t
tSerializeSExplainRsp
(
void
*
buf
,
int32_t
bufLen
,
SExplainRsp
*
pRsp
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
numOfPlans
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
numOfPlans
)
<
0
)
return
-
1
;
...
@@ -3281,13 +3281,13 @@ int32_t tSerializeSExplainRsp(void *buf, int32_t bufLen, SExplainRsp *pRsp) {
...
@@ -3281,13 +3281,13 @@ int32_t tSerializeSExplainRsp(void *buf, int32_t bufLen, SExplainRsp *pRsp) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSExplainRsp
(
void
*
buf
,
int32_t
bufLen
,
SExplainRsp
*
pRsp
)
{
int32_t
tDeserializeSExplainRsp
(
void
*
buf
,
int32_t
bufLen
,
SExplainRsp
*
pRsp
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
numOfPlans
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
numOfPlans
)
<
0
)
return
-
1
;
...
@@ -3303,7 +3303,7 @@ int32_t tDeserializeSExplainRsp(void *buf, int32_t bufLen, SExplainRsp *pRsp) {
...
@@ -3303,7 +3303,7 @@ int32_t tDeserializeSExplainRsp(void *buf, int32_t bufLen, SExplainRsp *pRsp) {
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -3314,8 +3314,8 @@ int32_t tSerializeSSchedulerHbReq(void *buf, int32_t bufLen, SSchedulerHbReq *pR
...
@@ -3314,8 +3314,8 @@ int32_t tSerializeSSchedulerHbReq(void *buf, int32_t bufLen, SSchedulerHbReq *pR
bufLen
-=
headLen
;
bufLen
-=
headLen
;
}
}
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeU64
(
&
encoder
,
pReq
->
sId
)
<
0
)
return
-
1
;
if
(
tEncodeU64
(
&
encoder
,
pReq
->
sId
)
<
0
)
return
-
1
;
...
@@ -3337,7 +3337,7 @@ int32_t tSerializeSSchedulerHbReq(void *buf, int32_t bufLen, SSchedulerHbReq *pR
...
@@ -3337,7 +3337,7 @@ int32_t tSerializeSSchedulerHbReq(void *buf, int32_t bufLen, SSchedulerHbReq *pR
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
if
(
buf
!=
NULL
)
{
if
(
buf
!=
NULL
)
{
SMsgHead
*
pHead
=
(
SMsgHead
*
)((
char
*
)
buf
-
headLen
);
SMsgHead
*
pHead
=
(
SMsgHead
*
)((
char
*
)
buf
-
headLen
);
...
@@ -3355,8 +3355,8 @@ int32_t tDeserializeSSchedulerHbReq(void *buf, int32_t bufLen, SSchedulerHbReq *
...
@@ -3355,8 +3355,8 @@ int32_t tDeserializeSSchedulerHbReq(void *buf, int32_t bufLen, SSchedulerHbReq *
pHead
->
vgId
=
pReq
->
header
.
vgId
;
pHead
->
vgId
=
pReq
->
header
.
vgId
;
pHead
->
contLen
=
pReq
->
header
.
contLen
;
pHead
->
contLen
=
pReq
->
header
.
contLen
;
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
(
char
*
)
buf
+
headLen
,
bufLen
-
headLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
(
char
*
)
buf
+
headLen
,
bufLen
-
headLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeU64
(
&
decoder
,
&
pReq
->
sId
)
<
0
)
return
-
1
;
if
(
tDecodeU64
(
&
decoder
,
&
pReq
->
sId
)
<
0
)
return
-
1
;
...
@@ -3380,15 +3380,15 @@ int32_t tDeserializeSSchedulerHbReq(void *buf, int32_t bufLen, SSchedulerHbReq *
...
@@ -3380,15 +3380,15 @@ int32_t tDeserializeSSchedulerHbReq(void *buf, int32_t bufLen, SSchedulerHbReq *
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
void
tFreeSSchedulerHbReq
(
SSchedulerHbReq
*
pReq
)
{
taosArrayDestroy
(
pReq
->
taskAction
);
}
void
tFreeSSchedulerHbReq
(
SSchedulerHbReq
*
pReq
)
{
taosArrayDestroy
(
pReq
->
taskAction
);
}
int32_t
tSerializeSSchedulerHbRsp
(
void
*
buf
,
int32_t
bufLen
,
SSchedulerHbRsp
*
pRsp
)
{
int32_t
tSerializeSSchedulerHbRsp
(
void
*
buf
,
int32_t
bufLen
,
SSchedulerHbRsp
*
pRsp
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
epId
.
nodeId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
epId
.
nodeId
)
<
0
)
return
-
1
;
...
@@ -3410,13 +3410,13 @@ int32_t tSerializeSSchedulerHbRsp(void *buf, int32_t bufLen, SSchedulerHbRsp *pR
...
@@ -3410,13 +3410,13 @@ int32_t tSerializeSSchedulerHbRsp(void *buf, int32_t bufLen, SSchedulerHbRsp *pR
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSSchedulerHbRsp
(
void
*
buf
,
int32_t
bufLen
,
SSchedulerHbRsp
*
pRsp
)
{
int32_t
tDeserializeSSchedulerHbRsp
(
void
*
buf
,
int32_t
bufLen
,
SSchedulerHbRsp
*
pRsp
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
epId
.
nodeId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
epId
.
nodeId
)
<
0
)
return
-
1
;
...
@@ -3440,40 +3440,40 @@ int32_t tDeserializeSSchedulerHbRsp(void *buf, int32_t bufLen, SSchedulerHbRsp *
...
@@ -3440,40 +3440,40 @@ int32_t tDeserializeSSchedulerHbRsp(void *buf, int32_t bufLen, SSchedulerHbRsp *
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
void
tFreeSSchedulerHbRsp
(
SSchedulerHbRsp
*
pRsp
)
{
taosArrayDestroy
(
pRsp
->
taskStatus
);
}
void
tFreeSSchedulerHbRsp
(
SSchedulerHbRsp
*
pRsp
)
{
taosArrayDestroy
(
pRsp
->
taskStatus
);
}
int32_t
tSerializeSQueryTableRsp
(
void
*
buf
,
int32_t
bufLen
,
SQueryTableRsp
*
pRsp
)
{
int32_t
tSerializeSQueryTableRsp
(
void
*
buf
,
int32_t
bufLen
,
SQueryTableRsp
*
pRsp
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
code
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
code
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSQueryTableRsp
(
void
*
buf
,
int32_t
bufLen
,
SQueryTableRsp
*
pRsp
)
{
int32_t
tDeserializeSQueryTableRsp
(
void
*
buf
,
int32_t
bufLen
,
SQueryTableRsp
*
pRsp
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
code
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
code
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSVCreateTbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SVCreateTbBatchRsp
*
pRsp
)
{
int32_t
tSerializeSVCreateTbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SVCreateTbBatchRsp
*
pRsp
)
{
// S
C
oder encoder = {0};
// S
Enc
oder encoder = {0};
// t
CoderInit(&encoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_ENCODER
);
// t
EncoderInit(&encoder, buf, bufLen
);
// if (tStartEncode(&encoder) < 0) return -1;
// if (tStartEncode(&encoder) < 0) return -1;
// if (pRsp->rspList) {
// if (pRsp->rspList) {
...
@@ -3489,15 +3489,15 @@ int32_t tSerializeSVCreateTbBatchRsp(void *buf, int32_t bufLen, SVCreateTbBatchR
...
@@ -3489,15 +3489,15 @@ int32_t tSerializeSVCreateTbBatchRsp(void *buf, int32_t bufLen, SVCreateTbBatchR
// tEndEncode(&encoder);
// tEndEncode(&encoder);
// int32_t tlen = encoder.pos;
// int32_t tlen = encoder.pos;
// t
C
oderClear(&encoder);
// t
Enc
oderClear(&encoder);
// reture tlen;
// reture tlen;
return
0
;
return
0
;
}
}
int32_t
tDeserializeSVCreateTbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SVCreateTbBatchRsp
*
pRsp
)
{
int32_t
tDeserializeSVCreateTbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SVCreateTbBatchRsp
*
pRsp
)
{
// S
C
oder decoder = {0};
// S
Dec
oder decoder = {0};
// int32_t num = 0;
// int32_t num = 0;
// t
CoderInit(&decoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_DECODER
);
// t
DecoderInit(&decoder, buf, bufLen
);
// if (tStartDecode(&decoder) < 0) return -1;
// if (tStartDecode(&decoder) < 0) return -1;
// if (tDecodeI32(&decoder, &num) < 0) return -1;
// if (tDecodeI32(&decoder, &num) < 0) return -1;
...
@@ -3514,11 +3514,11 @@ int32_t tDeserializeSVCreateTbBatchRsp(void *buf, int32_t bufLen, SVCreateTbBatc
...
@@ -3514,11 +3514,11 @@ int32_t tDeserializeSVCreateTbBatchRsp(void *buf, int32_t bufLen, SVCreateTbBatc
// }
// }
// tEndDecode(&decoder);
// tEndDecode(&decoder);
// t
C
oderClear(&decoder);
// t
Dec
oderClear(&decoder);
return
0
;
return
0
;
}
}
int
tEncodeSVCreateTbBatchRsp
(
S
C
oder
*
pCoder
,
const
SVCreateTbBatchRsp
*
pRsp
)
{
int
tEncodeSVCreateTbBatchRsp
(
S
Enc
oder
*
pCoder
,
const
SVCreateTbBatchRsp
*
pRsp
)
{
int32_t
nRsps
=
taosArrayGetSize
(
pRsp
->
pArray
);
int32_t
nRsps
=
taosArrayGetSize
(
pRsp
->
pArray
);
SVCreateTbRsp
*
pCreateRsp
;
SVCreateTbRsp
*
pCreateRsp
;
...
@@ -3535,11 +3535,11 @@ int tEncodeSVCreateTbBatchRsp(SCoder *pCoder, const SVCreateTbBatchRsp *pRsp) {
...
@@ -3535,11 +3535,11 @@ int tEncodeSVCreateTbBatchRsp(SCoder *pCoder, const SVCreateTbBatchRsp *pRsp) {
return
0
;
return
0
;
}
}
int
tDecodeSVCreateTbBatchRsp
(
S
C
oder
*
pCoder
,
SVCreateTbBatchRsp
*
pRsp
)
{
int
tDecodeSVCreateTbBatchRsp
(
S
Dec
oder
*
pCoder
,
SVCreateTbBatchRsp
*
pRsp
)
{
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pCoder
,
&
pRsp
->
nRsps
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pCoder
,
&
pRsp
->
nRsps
)
<
0
)
return
-
1
;
pRsp
->
pRsps
=
(
SVCreateTbRsp
*
)
t
C
oderMalloc
(
pCoder
,
sizeof
(
*
pRsp
->
pRsps
)
*
pRsp
->
nRsps
);
pRsp
->
pRsps
=
(
SVCreateTbRsp
*
)
t
Dec
oderMalloc
(
pCoder
,
sizeof
(
*
pRsp
->
pRsps
)
*
pRsp
->
nRsps
);
for
(
int32_t
i
=
0
;
i
<
pRsp
->
nRsps
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
pRsp
->
nRsps
;
i
++
)
{
if
(
tDecodeSVCreateTbRsp
(
pCoder
,
pRsp
->
pRsps
+
i
)
<
0
)
return
-
1
;
if
(
tDecodeSVCreateTbRsp
(
pCoder
,
pRsp
->
pRsps
+
i
)
<
0
)
return
-
1
;
}
}
...
@@ -3589,8 +3589,8 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS
...
@@ -3589,8 +3589,8 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS
if
(
pReq
->
sql
!=
NULL
)
sqlLen
=
(
int32_t
)
strlen
(
pReq
->
sql
);
if
(
pReq
->
sql
!=
NULL
)
sqlLen
=
(
int32_t
)
strlen
(
pReq
->
sql
);
if
(
pReq
->
ast
!=
NULL
)
astLen
=
(
int32_t
)
strlen
(
pReq
->
ast
);
if
(
pReq
->
ast
!=
NULL
)
astLen
=
(
int32_t
)
strlen
(
pReq
->
ast
);
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -3606,7 +3606,7 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS
...
@@ -3606,7 +3606,7 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
...
@@ -3614,8 +3614,8 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea
...
@@ -3614,8 +3614,8 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea
int32_t
sqlLen
=
0
;
int32_t
sqlLen
=
0
;
int32_t
astLen
=
0
;
int32_t
astLen
=
0
;
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -3639,7 +3639,7 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea
...
@@ -3639,7 +3639,7 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -3648,7 +3648,7 @@ void tFreeSCMCreateStreamReq(SCMCreateStreamReq *pReq) {
...
@@ -3648,7 +3648,7 @@ void tFreeSCMCreateStreamReq(SCMCreateStreamReq *pReq) {
taosMemoryFreeClear
(
pReq
->
ast
);
taosMemoryFreeClear
(
pReq
->
ast
);
}
}
int32_t
tEncodeSRSmaParam
(
S
C
oder
*
pCoder
,
const
SRSmaParam
*
pRSmaParam
)
{
int32_t
tEncodeSRSmaParam
(
S
Enc
oder
*
pCoder
,
const
SRSmaParam
*
pRSmaParam
)
{
if
(
tEncodeFloat
(
pCoder
,
pRSmaParam
->
xFilesFactor
)
<
0
)
return
-
1
;
if
(
tEncodeFloat
(
pCoder
,
pRSmaParam
->
xFilesFactor
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pCoder
,
pRSmaParam
->
delay
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pCoder
,
pRSmaParam
->
delay
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pCoder
,
pRSmaParam
->
qmsg1Len
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pCoder
,
pRSmaParam
->
qmsg1Len
)
<
0
)
return
-
1
;
...
@@ -3665,7 +3665,7 @@ int32_t tEncodeSRSmaParam(SCoder *pCoder, const SRSmaParam *pRSmaParam) {
...
@@ -3665,7 +3665,7 @@ int32_t tEncodeSRSmaParam(SCoder *pCoder, const SRSmaParam *pRSmaParam) {
return
0
;
return
0
;
}
}
int32_t
tDecodeSRSmaParam
(
S
C
oder
*
pCoder
,
SRSmaParam
*
pRSmaParam
)
{
int32_t
tDecodeSRSmaParam
(
S
Dec
oder
*
pCoder
,
SRSmaParam
*
pRSmaParam
)
{
if
(
tDecodeFloat
(
pCoder
,
&
pRSmaParam
->
xFilesFactor
)
<
0
)
return
-
1
;
if
(
tDecodeFloat
(
pCoder
,
&
pRSmaParam
->
xFilesFactor
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pCoder
,
&
pRSmaParam
->
delay
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pCoder
,
&
pRSmaParam
->
delay
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pCoder
,
&
pRSmaParam
->
qmsg1Len
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pCoder
,
&
pRSmaParam
->
qmsg1Len
)
<
0
)
return
-
1
;
...
@@ -3685,7 +3685,7 @@ int32_t tDecodeSRSmaParam(SCoder *pCoder, SRSmaParam *pRSmaParam) {
...
@@ -3685,7 +3685,7 @@ int32_t tDecodeSRSmaParam(SCoder *pCoder, SRSmaParam *pRSmaParam) {
return
0
;
return
0
;
}
}
int
tEncodeSVCreateStbReq
(
S
C
oder
*
pCoder
,
const
SVCreateStbReq
*
pReq
)
{
int
tEncodeSVCreateStbReq
(
S
Enc
oder
*
pCoder
,
const
SVCreateStbReq
*
pReq
)
{
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pCoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pCoder
,
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -3701,7 +3701,7 @@ int tEncodeSVCreateStbReq(SCoder *pCoder, const SVCreateStbReq *pReq) {
...
@@ -3701,7 +3701,7 @@ int tEncodeSVCreateStbReq(SCoder *pCoder, const SVCreateStbReq *pReq) {
return
0
;
return
0
;
}
}
int
tDecodeSVCreateStbReq
(
S
C
oder
*
pCoder
,
SVCreateStbReq
*
pReq
)
{
int
tDecodeSVCreateStbReq
(
S
Dec
oder
*
pCoder
,
SVCreateStbReq
*
pReq
)
{
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStr
(
pCoder
,
&
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStr
(
pCoder
,
&
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -3741,7 +3741,7 @@ STSchema *tdGetSTSChemaFromSSChema(SSchema **pSchema, int32_t nCols) {
...
@@ -3741,7 +3741,7 @@ STSchema *tdGetSTSChemaFromSSChema(SSchema **pSchema, int32_t nCols) {
return
pNSchema
;
return
pNSchema
;
}
}
int
tEncodeSVCreateTbReq
(
S
C
oder
*
pCoder
,
const
SVCreateTbReq
*
pReq
)
{
int
tEncodeSVCreateTbReq
(
S
Enc
oder
*
pCoder
,
const
SVCreateTbReq
*
pReq
)
{
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pCoder
,
pReq
->
flags
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pCoder
,
pReq
->
flags
)
<
0
)
return
-
1
;
...
@@ -3765,8 +3765,8 @@ int tEncodeSVCreateTbReq(SCoder *pCoder, const SVCreateTbReq *pReq) {
...
@@ -3765,8 +3765,8 @@ int tEncodeSVCreateTbReq(SCoder *pCoder, const SVCreateTbReq *pReq) {
return
0
;
return
0
;
}
}
int
tDecodeSVCreateTbReq
(
S
C
oder
*
pCoder
,
SVCreateTbReq
*
pReq
)
{
int
tDecodeSVCreateTbReq
(
S
Dec
oder
*
pCoder
,
SVCreateTbReq
*
pReq
)
{
uint
64
_t
len
;
uint
32
_t
len
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
...
@@ -3791,7 +3791,7 @@ int tDecodeSVCreateTbReq(SCoder *pCoder, SVCreateTbReq *pReq) {
...
@@ -3791,7 +3791,7 @@ int tDecodeSVCreateTbReq(SCoder *pCoder, SVCreateTbReq *pReq) {
return
0
;
return
0
;
}
}
int
tEncodeSVCreateTbBatchReq
(
S
C
oder
*
pCoder
,
const
SVCreateTbBatchReq
*
pReq
)
{
int
tEncodeSVCreateTbBatchReq
(
S
Enc
oder
*
pCoder
,
const
SVCreateTbBatchReq
*
pReq
)
{
int32_t
nReq
=
taosArrayGetSize
(
pReq
->
pArray
);
int32_t
nReq
=
taosArrayGetSize
(
pReq
->
pArray
);
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
...
@@ -3805,11 +3805,11 @@ int tEncodeSVCreateTbBatchReq(SCoder *pCoder, const SVCreateTbBatchReq *pReq) {
...
@@ -3805,11 +3805,11 @@ int tEncodeSVCreateTbBatchReq(SCoder *pCoder, const SVCreateTbBatchReq *pReq) {
return
0
;
return
0
;
}
}
int
tDecodeSVCreateTbBatchReq
(
S
C
oder
*
pCoder
,
SVCreateTbBatchReq
*
pReq
)
{
int
tDecodeSVCreateTbBatchReq
(
S
Dec
oder
*
pCoder
,
SVCreateTbBatchReq
*
pReq
)
{
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pCoder
,
&
pReq
->
nReqs
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pCoder
,
&
pReq
->
nReqs
)
<
0
)
return
-
1
;
pReq
->
pReqs
=
(
SVCreateTbReq
*
)
t
C
oderMalloc
(
pCoder
,
sizeof
(
SVCreateTbReq
)
*
pReq
->
nReqs
);
pReq
->
pReqs
=
(
SVCreateTbReq
*
)
t
Dec
oderMalloc
(
pCoder
,
sizeof
(
SVCreateTbReq
)
*
pReq
->
nReqs
);
if
(
pReq
->
pReqs
==
NULL
)
return
-
1
;
if
(
pReq
->
pReqs
==
NULL
)
return
-
1
;
for
(
int
iReq
=
0
;
iReq
<
pReq
->
nReqs
;
iReq
++
)
{
for
(
int
iReq
=
0
;
iReq
<
pReq
->
nReqs
;
iReq
++
)
{
if
(
tDecodeSVCreateTbReq
(
pCoder
,
pReq
->
pReqs
+
iReq
)
<
0
)
return
-
1
;
if
(
tDecodeSVCreateTbReq
(
pCoder
,
pReq
->
pReqs
+
iReq
)
<
0
)
return
-
1
;
...
@@ -3819,7 +3819,7 @@ int tDecodeSVCreateTbBatchReq(SCoder *pCoder, SVCreateTbBatchReq *pReq) {
...
@@ -3819,7 +3819,7 @@ int tDecodeSVCreateTbBatchReq(SCoder *pCoder, SVCreateTbBatchReq *pReq) {
return
0
;
return
0
;
}
}
int
tEncodeSVCreateTbRsp
(
S
C
oder
*
pCoder
,
const
SVCreateTbRsp
*
pRsp
)
{
int
tEncodeSVCreateTbRsp
(
S
Enc
oder
*
pCoder
,
const
SVCreateTbRsp
*
pRsp
)
{
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pCoder
,
pRsp
->
code
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pCoder
,
pRsp
->
code
)
<
0
)
return
-
1
;
...
@@ -3828,7 +3828,7 @@ int tEncodeSVCreateTbRsp(SCoder *pCoder, const SVCreateTbRsp *pRsp) {
...
@@ -3828,7 +3828,7 @@ int tEncodeSVCreateTbRsp(SCoder *pCoder, const SVCreateTbRsp *pRsp) {
return
0
;
return
0
;
}
}
int
tDecodeSVCreateTbRsp
(
S
C
oder
*
pCoder
,
SVCreateTbRsp
*
pRsp
)
{
int
tDecodeSVCreateTbRsp
(
S
Dec
oder
*
pCoder
,
SVCreateTbRsp
*
pRsp
)
{
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pCoder
,
&
pRsp
->
code
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pCoder
,
&
pRsp
->
code
)
<
0
)
return
-
1
;
...
@@ -3838,7 +3838,7 @@ int tDecodeSVCreateTbRsp(SCoder *pCoder, SVCreateTbRsp *pRsp) {
...
@@ -3838,7 +3838,7 @@ int tDecodeSVCreateTbRsp(SCoder *pCoder, SVCreateTbRsp *pRsp) {
}
}
// TDMT_VND_DROP_TABLE =================
// TDMT_VND_DROP_TABLE =================
static
int32_t
tEncodeSVDropTbReq
(
S
C
oder
*
pCoder
,
const
SVDropTbReq
*
pReq
)
{
static
int32_t
tEncodeSVDropTbReq
(
S
Enc
oder
*
pCoder
,
const
SVDropTbReq
*
pReq
)
{
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pCoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pCoder
,
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -3848,7 +3848,7 @@ static int32_t tEncodeSVDropTbReq(SCoder *pCoder, const SVDropTbReq *pReq) {
...
@@ -3848,7 +3848,7 @@ static int32_t tEncodeSVDropTbReq(SCoder *pCoder, const SVDropTbReq *pReq) {
return
0
;
return
0
;
}
}
static
int32_t
tDecodeSVDropTbReq
(
S
C
oder
*
pCoder
,
SVDropTbReq
*
pReq
)
{
static
int32_t
tDecodeSVDropTbReq
(
S
Dec
oder
*
pCoder
,
SVDropTbReq
*
pReq
)
{
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStr
(
pCoder
,
&
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStr
(
pCoder
,
&
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -3858,7 +3858,7 @@ static int32_t tDecodeSVDropTbReq(SCoder *pCoder, SVDropTbReq *pReq) {
...
@@ -3858,7 +3858,7 @@ static int32_t tDecodeSVDropTbReq(SCoder *pCoder, SVDropTbReq *pReq) {
return
0
;
return
0
;
}
}
static
int32_t
tEncodeSVDropTbRsp
(
S
C
oder
*
pCoder
,
const
SVDropTbRsp
*
pReq
)
{
static
int32_t
tEncodeSVDropTbRsp
(
S
Enc
oder
*
pCoder
,
const
SVDropTbRsp
*
pReq
)
{
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pCoder
,
pReq
->
code
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pCoder
,
pReq
->
code
)
<
0
)
return
-
1
;
...
@@ -3867,7 +3867,7 @@ static int32_t tEncodeSVDropTbRsp(SCoder *pCoder, const SVDropTbRsp *pReq) {
...
@@ -3867,7 +3867,7 @@ static int32_t tEncodeSVDropTbRsp(SCoder *pCoder, const SVDropTbRsp *pReq) {
return
0
;
return
0
;
}
}
static
int32_t
tDecodeSVDropTbRsp
(
S
C
oder
*
pCoder
,
SVDropTbRsp
*
pReq
)
{
static
int32_t
tDecodeSVDropTbRsp
(
S
Dec
oder
*
pCoder
,
SVDropTbRsp
*
pReq
)
{
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pCoder
,
&
pReq
->
code
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pCoder
,
&
pReq
->
code
)
<
0
)
return
-
1
;
...
@@ -3876,7 +3876,7 @@ static int32_t tDecodeSVDropTbRsp(SCoder *pCoder, SVDropTbRsp *pReq) {
...
@@ -3876,7 +3876,7 @@ static int32_t tDecodeSVDropTbRsp(SCoder *pCoder, SVDropTbRsp *pReq) {
return
0
;
return
0
;
}
}
int32_t
tEncodeSVDropTbBatchReq
(
S
C
oder
*
pCoder
,
const
SVDropTbBatchReq
*
pReq
)
{
int32_t
tEncodeSVDropTbBatchReq
(
S
Enc
oder
*
pCoder
,
const
SVDropTbBatchReq
*
pReq
)
{
int32_t
nReqs
=
taosArrayGetSize
(
pReq
->
pArray
);
int32_t
nReqs
=
taosArrayGetSize
(
pReq
->
pArray
);
SVDropTbReq
*
pDropTbReq
;
SVDropTbReq
*
pDropTbReq
;
...
@@ -3892,11 +3892,11 @@ int32_t tEncodeSVDropTbBatchReq(SCoder *pCoder, const SVDropTbBatchReq *pReq) {
...
@@ -3892,11 +3892,11 @@ int32_t tEncodeSVDropTbBatchReq(SCoder *pCoder, const SVDropTbBatchReq *pReq) {
return
0
;
return
0
;
}
}
int32_t
tDecodeSVDropTbBatchReq
(
S
C
oder
*
pCoder
,
SVDropTbBatchReq
*
pReq
)
{
int32_t
tDecodeSVDropTbBatchReq
(
S
Dec
oder
*
pCoder
,
SVDropTbBatchReq
*
pReq
)
{
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pCoder
,
&
pReq
->
nReqs
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pCoder
,
&
pReq
->
nReqs
)
<
0
)
return
-
1
;
pReq
->
pReqs
=
(
SVDropTbReq
*
)
t
C
oderMalloc
(
pCoder
,
sizeof
(
SVDropTbReq
)
*
pReq
->
nReqs
);
pReq
->
pReqs
=
(
SVDropTbReq
*
)
t
Dec
oderMalloc
(
pCoder
,
sizeof
(
SVDropTbReq
)
*
pReq
->
nReqs
);
if
(
pReq
->
pReqs
==
NULL
)
return
-
1
;
if
(
pReq
->
pReqs
==
NULL
)
return
-
1
;
for
(
int
iReq
=
0
;
iReq
<
pReq
->
nReqs
;
iReq
++
)
{
for
(
int
iReq
=
0
;
iReq
<
pReq
->
nReqs
;
iReq
++
)
{
if
(
tDecodeSVDropTbReq
(
pCoder
,
pReq
->
pReqs
+
iReq
)
<
0
)
return
-
1
;
if
(
tDecodeSVDropTbReq
(
pCoder
,
pReq
->
pReqs
+
iReq
)
<
0
)
return
-
1
;
...
@@ -3906,7 +3906,7 @@ int32_t tDecodeSVDropTbBatchReq(SCoder *pCoder, SVDropTbBatchReq *pReq) {
...
@@ -3906,7 +3906,7 @@ int32_t tDecodeSVDropTbBatchReq(SCoder *pCoder, SVDropTbBatchReq *pReq) {
return
0
;
return
0
;
}
}
int32_t
tEncodeSVDropTbBatchRsp
(
S
C
oder
*
pCoder
,
const
SVDropTbBatchRsp
*
pRsp
)
{
int32_t
tEncodeSVDropTbBatchRsp
(
S
Enc
oder
*
pCoder
,
const
SVDropTbBatchRsp
*
pRsp
)
{
int32_t
nRsps
=
taosArrayGetSize
(
pRsp
->
pArray
);
int32_t
nRsps
=
taosArrayGetSize
(
pRsp
->
pArray
);
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
...
@@ -3919,11 +3919,11 @@ int32_t tEncodeSVDropTbBatchRsp(SCoder *pCoder, const SVDropTbBatchRsp *pRsp) {
...
@@ -3919,11 +3919,11 @@ int32_t tEncodeSVDropTbBatchRsp(SCoder *pCoder, const SVDropTbBatchRsp *pRsp) {
return
0
;
return
0
;
}
}
int32_t
tDecodeSVDropTbBatchRsp
(
S
C
oder
*
pCoder
,
SVDropTbBatchRsp
*
pRsp
)
{
int32_t
tDecodeSVDropTbBatchRsp
(
S
Dec
oder
*
pCoder
,
SVDropTbBatchRsp
*
pRsp
)
{
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pCoder
,
&
pRsp
->
nRsps
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pCoder
,
&
pRsp
->
nRsps
)
<
0
)
return
-
1
;
pRsp
->
pRsps
=
(
SVDropTbRsp
*
)
t
C
oderMalloc
(
pCoder
,
sizeof
(
SVDropTbRsp
)
*
pRsp
->
nRsps
);
pRsp
->
pRsps
=
(
SVDropTbRsp
*
)
t
Dec
oderMalloc
(
pCoder
,
sizeof
(
SVDropTbRsp
)
*
pRsp
->
nRsps
);
if
(
pRsp
->
pRsps
==
NULL
)
return
-
1
;
if
(
pRsp
->
pRsps
==
NULL
)
return
-
1
;
for
(
int
iRsp
=
0
;
iRsp
<
pRsp
->
nRsps
;
iRsp
++
)
{
for
(
int
iRsp
=
0
;
iRsp
<
pRsp
->
nRsps
;
iRsp
++
)
{
if
(
tDecodeSVDropTbRsp
(
pCoder
,
pRsp
->
pRsps
+
iRsp
)
<
0
)
return
-
1
;
if
(
tDecodeSVDropTbRsp
(
pCoder
,
pRsp
->
pRsps
+
iRsp
)
<
0
)
return
-
1
;
...
@@ -3933,7 +3933,7 @@ int32_t tDecodeSVDropTbBatchRsp(SCoder *pCoder, SVDropTbBatchRsp *pRsp) {
...
@@ -3933,7 +3933,7 @@ int32_t tDecodeSVDropTbBatchRsp(SCoder *pCoder, SVDropTbBatchRsp *pRsp) {
return
0
;
return
0
;
}
}
int32_t
tEncodeSVDropStbReq
(
S
C
oder
*
pCoder
,
const
SVDropStbReq
*
pReq
)
{
int32_t
tEncodeSVDropStbReq
(
S
Enc
oder
*
pCoder
,
const
SVDropStbReq
*
pReq
)
{
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pCoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pCoder
,
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -3943,7 +3943,7 @@ int32_t tEncodeSVDropStbReq(SCoder *pCoder, const SVDropStbReq *pReq) {
...
@@ -3943,7 +3943,7 @@ int32_t tEncodeSVDropStbReq(SCoder *pCoder, const SVDropStbReq *pReq) {
return
0
;
return
0
;
}
}
int32_t
tDecodeSVDropStbReq
(
S
C
oder
*
pCoder
,
SVDropStbReq
*
pReq
)
{
int32_t
tDecodeSVDropStbReq
(
S
Dec
oder
*
pCoder
,
SVDropStbReq
*
pReq
)
{
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStr
(
pCoder
,
&
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStr
(
pCoder
,
&
pReq
->
name
)
<
0
)
return
-
1
;
...
@@ -3953,7 +3953,7 @@ int32_t tDecodeSVDropStbReq(SCoder *pCoder, SVDropStbReq *pReq) {
...
@@ -3953,7 +3953,7 @@ int32_t tDecodeSVDropStbReq(SCoder *pCoder, SVDropStbReq *pReq) {
return
0
;
return
0
;
}
}
static
int32_t
tEncodeSVSubmitBlk
(
S
C
oder
*
pCoder
,
const
SVSubmitBlk
*
pBlock
,
int32_t
flags
)
{
static
int32_t
tEncodeSVSubmitBlk
(
S
Enc
oder
*
pCoder
,
const
SVSubmitBlk
*
pBlock
,
int32_t
flags
)
{
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pCoder
,
pBlock
->
suid
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pCoder
,
pBlock
->
suid
)
<
0
)
return
-
1
;
...
@@ -3969,7 +3969,7 @@ static int32_t tEncodeSVSubmitBlk(SCoder *pCoder, const SVSubmitBlk *pBlock, int
...
@@ -3969,7 +3969,7 @@ static int32_t tEncodeSVSubmitBlk(SCoder *pCoder, const SVSubmitBlk *pBlock, int
return
0
;
return
0
;
}
}
static
int32_t
tDecodeSVSubmitBlk
(
S
C
oder
*
pCoder
,
SVSubmitBlk
*
pBlock
,
int32_t
flags
)
{
static
int32_t
tDecodeSVSubmitBlk
(
S
Dec
oder
*
pCoder
,
SVSubmitBlk
*
pBlock
,
int32_t
flags
)
{
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pBlock
->
suid
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pBlock
->
suid
)
<
0
)
return
-
1
;
...
@@ -3985,7 +3985,7 @@ static int32_t tDecodeSVSubmitBlk(SCoder *pCoder, SVSubmitBlk *pBlock, int32_t f
...
@@ -3985,7 +3985,7 @@ static int32_t tDecodeSVSubmitBlk(SCoder *pCoder, SVSubmitBlk *pBlock, int32_t f
return
0
;
return
0
;
}
}
int32_t
tEncodeSVSubmitReq
(
S
C
oder
*
pCoder
,
const
SVSubmitReq
*
pReq
)
{
int32_t
tEncodeSVSubmitReq
(
S
Enc
oder
*
pCoder
,
const
SVSubmitReq
*
pReq
)
{
int32_t
nBlocks
=
taosArrayGetSize
(
pReq
->
pArray
);
int32_t
nBlocks
=
taosArrayGetSize
(
pReq
->
pArray
);
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
...
@@ -4000,12 +4000,12 @@ int32_t tEncodeSVSubmitReq(SCoder *pCoder, const SVSubmitReq *pReq) {
...
@@ -4000,12 +4000,12 @@ int32_t tEncodeSVSubmitReq(SCoder *pCoder, const SVSubmitReq *pReq) {
return
0
;
return
0
;
}
}
int32_t
tDecodeSVSubmitReq
(
S
C
oder
*
pCoder
,
SVSubmitReq
*
pReq
)
{
int32_t
tDecodeSVSubmitReq
(
S
Dec
oder
*
pCoder
,
SVSubmitReq
*
pReq
)
{
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pCoder
,
&
pReq
->
flags
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pCoder
,
&
pReq
->
flags
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pCoder
,
&
pReq
->
nBlocks
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pCoder
,
&
pReq
->
nBlocks
)
<
0
)
return
-
1
;
pReq
->
pBlocks
=
t
C
oderMalloc
(
pCoder
,
sizeof
(
SVSubmitBlk
)
*
pReq
->
nBlocks
);
pReq
->
pBlocks
=
t
Dec
oderMalloc
(
pCoder
,
sizeof
(
SVSubmitBlk
)
*
pReq
->
nBlocks
);
if
(
pReq
->
pBlocks
==
NULL
)
return
-
1
;
if
(
pReq
->
pBlocks
==
NULL
)
return
-
1
;
for
(
int32_t
iBlock
=
0
;
iBlock
<
pReq
->
nBlocks
;
iBlock
++
)
{
for
(
int32_t
iBlock
=
0
;
iBlock
<
pReq
->
nBlocks
;
iBlock
++
)
{
if
(
tDecodeSVSubmitBlk
(
pCoder
,
pReq
->
pBlocks
+
iBlock
,
pReq
->
flags
)
<
0
)
return
-
1
;
if
(
tDecodeSVSubmitBlk
(
pCoder
,
pReq
->
pBlocks
+
iBlock
,
pReq
->
flags
)
<
0
)
return
-
1
;
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
a06bf6e5
...
@@ -594,8 +594,8 @@ typedef struct {
...
@@ -594,8 +594,8 @@ typedef struct {
SSchemaWrapper
outputSchema
;
SSchemaWrapper
outputSchema
;
}
SStreamObj
;
}
SStreamObj
;
int32_t
tEncodeSStreamObj
(
S
C
oder
*
pEncoder
,
const
SStreamObj
*
pObj
);
int32_t
tEncodeSStreamObj
(
S
Enc
oder
*
pEncoder
,
const
SStreamObj
*
pObj
);
int32_t
tDecodeSStreamObj
(
S
C
oder
*
pDecoder
,
SStreamObj
*
pObj
);
int32_t
tDecodeSStreamObj
(
S
Dec
oder
*
pDecoder
,
SStreamObj
*
pObj
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/mnode/impl/src/mndDef.c
浏览文件 @
a06bf6e5
...
@@ -411,7 +411,7 @@ void *tDecodeSMqSubActionLogObj(const void *buf, SMqSubActionLogObj *pLog) {
...
@@ -411,7 +411,7 @@ void *tDecodeSMqSubActionLogObj(const void *buf, SMqSubActionLogObj *pLog) {
return
(
void
*
)
buf
;
return
(
void
*
)
buf
;
}
}
int32_t
tEncodeSStreamObj
(
S
C
oder
*
pEncoder
,
const
SStreamObj
*
pObj
)
{
int32_t
tEncodeSStreamObj
(
S
Enc
oder
*
pEncoder
,
const
SStreamObj
*
pObj
)
{
int32_t
sz
=
0
;
int32_t
sz
=
0
;
/*int32_t outputNameSz = 0;*/
/*int32_t outputNameSz = 0;*/
if
(
tEncodeCStr
(
pEncoder
,
pObj
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pObj
->
name
)
<
0
)
return
-
1
;
...
@@ -462,7 +462,7 @@ int32_t tEncodeSStreamObj(SCoder *pEncoder, const SStreamObj *pObj) {
...
@@ -462,7 +462,7 @@ int32_t tEncodeSStreamObj(SCoder *pEncoder, const SStreamObj *pObj) {
return
pEncoder
->
pos
;
return
pEncoder
->
pos
;
}
}
int32_t
tDecodeSStreamObj
(
S
C
oder
*
pDecoder
,
SStreamObj
*
pObj
)
{
int32_t
tDecodeSStreamObj
(
S
Dec
oder
*
pDecoder
,
SStreamObj
*
pObj
)
{
if
(
tDecodeCStrTo
(
pDecoder
,
pObj
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
pObj
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
pObj
->
sourceDb
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
pObj
->
sourceDb
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pObj
->
createTime
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pObj
->
createTime
)
<
0
)
return
-
1
;
...
...
source/dnode/mnode/impl/src/mndOffset.c
浏览文件 @
a06bf6e5
...
@@ -157,8 +157,8 @@ static int32_t mndProcessCommitOffsetReq(SNodeMsg *pMsg) {
...
@@ -157,8 +157,8 @@ static int32_t mndProcessCommitOffsetReq(SNodeMsg *pMsg) {
SMnode
*
pMnode
=
pMsg
->
pNode
;
SMnode
*
pMnode
=
pMsg
->
pNode
;
char
*
msgStr
=
pMsg
->
rpcMsg
.
pCont
;
char
*
msgStr
=
pMsg
->
rpcMsg
.
pCont
;
SMqCMCommitOffsetReq
commitOffsetReq
;
SMqCMCommitOffsetReq
commitOffsetReq
;
S
Coder
decoder
;
S
Decoder
decoder
;
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
msgStr
,
pMsg
->
rpcMsg
.
contLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
msgStr
,
pMsg
->
rpcMsg
.
contLen
);
tDecodeSMqCMCommitOffsetReq
(
&
decoder
,
&
commitOffsetReq
);
tDecodeSMqCMCommitOffsetReq
(
&
decoder
,
&
commitOffsetReq
);
...
...
source/dnode/mnode/impl/src/mndScheduler.c
浏览文件 @
a06bf6e5
...
@@ -83,12 +83,12 @@ END:
...
@@ -83,12 +83,12 @@ END:
}
}
int32_t
mndPersistTaskDeployReq
(
STrans
*
pTrans
,
SStreamTask
*
pTask
,
const
SEpSet
*
pEpSet
,
tmsg_t
type
,
int32_t
nodeId
)
{
int32_t
mndPersistTaskDeployReq
(
STrans
*
pTrans
,
SStreamTask
*
pTask
,
const
SEpSet
*
pEpSet
,
tmsg_t
type
,
int32_t
nodeId
)
{
S
C
oder
encoder
;
S
Enc
oder
encoder
;
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
NULL
,
0
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
NULL
,
0
);
tEncodeSStreamTask
(
&
encoder
,
pTask
);
tEncodeSStreamTask
(
&
encoder
,
pTask
);
int32_t
size
=
encoder
.
pos
;
int32_t
size
=
encoder
.
pos
;
int32_t
tlen
=
sizeof
(
SMsgHead
)
+
size
;
int32_t
tlen
=
sizeof
(
SMsgHead
)
+
size
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
void
*
buf
=
taosMemoryMalloc
(
tlen
);
void
*
buf
=
taosMemoryMalloc
(
tlen
);
if
(
buf
==
NULL
)
{
if
(
buf
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
@@ -96,9 +96,9 @@ int32_t mndPersistTaskDeployReq(STrans* pTrans, SStreamTask* pTask, const SEpSet
...
@@ -96,9 +96,9 @@ int32_t mndPersistTaskDeployReq(STrans* pTrans, SStreamTask* pTask, const SEpSet
}
}
((
SMsgHead
*
)
buf
)
->
vgId
=
htonl
(
nodeId
);
((
SMsgHead
*
)
buf
)
->
vgId
=
htonl
(
nodeId
);
void
*
abuf
=
POINTER_SHIFT
(
buf
,
sizeof
(
SMsgHead
));
void
*
abuf
=
POINTER_SHIFT
(
buf
,
sizeof
(
SMsgHead
));
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
abuf
,
size
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
abuf
,
size
);
tEncodeSStreamTask
(
&
encoder
,
pTask
);
tEncodeSStreamTask
(
&
encoder
,
pTask
);
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
STransAction
action
=
{
0
};
STransAction
action
=
{
0
};
memcpy
(
&
action
.
epSet
,
pEpSet
,
sizeof
(
SEpSet
));
memcpy
(
&
action
.
epSet
,
pEpSet
,
sizeof
(
SEpSet
));
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
a06bf6e5
...
@@ -369,7 +369,7 @@ static FORCE_INLINE int schemaExColIdCompare(const void *colId, const void *pSch
...
@@ -369,7 +369,7 @@ static FORCE_INLINE int schemaExColIdCompare(const void *colId, const void *pSch
}
}
static
void
*
mndBuildVCreateStbReq
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
SStbObj
*
pStb
,
int32_t
*
pContLen
)
{
static
void
*
mndBuildVCreateStbReq
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
SStbObj
*
pStb
,
int32_t
*
pContLen
)
{
S
Coder
coder
=
{
0
};
S
Encoder
en
coder
=
{
0
};
int32_t
contLen
;
int32_t
contLen
;
SName
name
=
{
0
};
SName
name
=
{
0
};
SVCreateStbReq
req
=
{
0
};
SVCreateStbReq
req
=
{
0
};
...
@@ -422,11 +422,11 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt
...
@@ -422,11 +422,11 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt
pHead
->
vgId
=
htonl
(
pVgroup
->
vgId
);
pHead
->
vgId
=
htonl
(
pVgroup
->
vgId
);
void
*
pBuf
=
POINTER_SHIFT
(
pHead
,
sizeof
(
SMsgHead
));
void
*
pBuf
=
POINTER_SHIFT
(
pHead
,
sizeof
(
SMsgHead
));
t
CoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
pBuf
,
contLen
-
sizeof
(
SMsgHead
),
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
pBuf
,
contLen
-
sizeof
(
SMsgHead
)
);
if
(
tEncodeSVCreateStbReq
(
&
coder
,
&
req
)
<
0
)
{
if
(
tEncodeSVCreateStbReq
(
&
en
coder
,
&
req
)
<
0
)
{
return
NULL
;
return
NULL
;
}
}
t
CoderClear
(
&
coder
);
t
EncoderClear
(
&
en
coder
);
*
pContLen
=
contLen
;
*
pContLen
=
contLen
;
taosMemoryFreeClear
(
req
.
pRSmaParam
.
qmsg1
);
taosMemoryFreeClear
(
req
.
pRSmaParam
.
qmsg1
);
...
@@ -440,7 +440,7 @@ static void *mndBuildVDropStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb,
...
@@ -440,7 +440,7 @@ static void *mndBuildVDropStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb,
int32_t
contLen
=
0
;
int32_t
contLen
=
0
;
int32_t
ret
=
0
;
int32_t
ret
=
0
;
SMsgHead
*
pHead
=
NULL
;
SMsgHead
*
pHead
=
NULL
;
S
Coder
coder
=
{
0
};
S
Encoder
en
coder
=
{
0
};
tNameFromString
(
&
name
,
pStb
->
name
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
tNameFromString
(
&
name
,
pStb
->
name
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
...
@@ -462,9 +462,9 @@ static void *mndBuildVDropStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb,
...
@@ -462,9 +462,9 @@ static void *mndBuildVDropStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb,
void
*
pBuf
=
POINTER_SHIFT
(
pHead
,
sizeof
(
SMsgHead
));
void
*
pBuf
=
POINTER_SHIFT
(
pHead
,
sizeof
(
SMsgHead
));
t
CoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
pBuf
,
contLen
-
sizeof
(
SMsgHead
),
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
pBuf
,
contLen
-
sizeof
(
SMsgHead
)
);
tEncodeSVDropStbReq
(
&
coder
,
&
req
);
tEncodeSVDropStbReq
(
&
en
coder
,
&
req
);
t
CoderClear
(
&
coder
);
t
EncoderClear
(
&
en
coder
);
*
pContLen
=
contLen
;
*
pContLen
=
contLen
;
return
pHead
;
return
pHead
;
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
a06bf6e5
...
@@ -70,14 +70,14 @@ SSdbRaw *mndStreamActionEncode(SStreamObj *pStream) {
...
@@ -70,14 +70,14 @@ SSdbRaw *mndStreamActionEncode(SStreamObj *pStream) {
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
void
*
buf
=
NULL
;
void
*
buf
=
NULL
;
S
C
oder
encoder
;
S
Enc
oder
encoder
;
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
NULL
,
0
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
NULL
,
0
);
if
(
tEncodeSStreamObj
(
&
encoder
,
pStream
)
<
0
)
{
if
(
tEncodeSStreamObj
(
&
encoder
,
pStream
)
<
0
)
{
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
goto
STREAM_ENCODE_OVER
;
goto
STREAM_ENCODE_OVER
;
}
}
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
int32_t
size
=
sizeof
(
int32_t
)
+
tlen
+
MND_STREAM_RESERVE_SIZE
;
int32_t
size
=
sizeof
(
int32_t
)
+
tlen
+
MND_STREAM_RESERVE_SIZE
;
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_STREAM
,
MND_STREAM_VER_NUMBER
,
size
);
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_STREAM
,
MND_STREAM_VER_NUMBER
,
size
);
...
@@ -86,12 +86,12 @@ SSdbRaw *mndStreamActionEncode(SStreamObj *pStream) {
...
@@ -86,12 +86,12 @@ SSdbRaw *mndStreamActionEncode(SStreamObj *pStream) {
buf
=
taosMemoryMalloc
(
tlen
);
buf
=
taosMemoryMalloc
(
tlen
);
if
(
buf
==
NULL
)
goto
STREAM_ENCODE_OVER
;
if
(
buf
==
NULL
)
goto
STREAM_ENCODE_OVER
;
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
tlen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
tlen
);
if
(
tEncodeSStreamObj
(
&
encoder
,
pStream
)
<
0
)
{
if
(
tEncodeSStreamObj
(
&
encoder
,
pStream
)
<
0
)
{
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
goto
STREAM_ENCODE_OVER
;
goto
STREAM_ENCODE_OVER
;
}
}
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
int32_t
dataPos
=
0
;
int32_t
dataPos
=
0
;
SDB_SET_INT32
(
pRaw
,
dataPos
,
tlen
,
STREAM_ENCODE_OVER
);
SDB_SET_INT32
(
pRaw
,
dataPos
,
tlen
,
STREAM_ENCODE_OVER
);
...
@@ -138,8 +138,8 @@ SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw) {
...
@@ -138,8 +138,8 @@ SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw) {
if
(
buf
==
NULL
)
goto
STREAM_DECODE_OVER
;
if
(
buf
==
NULL
)
goto
STREAM_DECODE_OVER
;
SDB_GET_BINARY
(
pRaw
,
dataPos
,
buf
,
tlen
,
STREAM_DECODE_OVER
);
SDB_GET_BINARY
(
pRaw
,
dataPos
,
buf
,
tlen
,
STREAM_DECODE_OVER
);
S
C
oder
decoder
;
S
Dec
oder
decoder
;
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
tlen
+
1
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
tlen
+
1
);
if
(
tDecodeSStreamObj
(
&
decoder
,
pStream
)
<
0
)
{
if
(
tDecodeSStreamObj
(
&
decoder
,
pStream
)
<
0
)
{
goto
STREAM_DECODE_OVER
;
goto
STREAM_DECODE_OVER
;
}
}
...
...
source/dnode/snode/src/snode.c
浏览文件 @
a06bf6e5
...
@@ -99,10 +99,10 @@ void sndProcessUMsg(SSnode *pSnode, SRpcMsg *pMsg) {
...
@@ -99,10 +99,10 @@ void sndProcessUMsg(SSnode *pSnode, SRpcMsg *pMsg) {
ASSERT
(
0
);
ASSERT
(
0
);
return
;
return
;
}
}
S
C
oder
decoder
;
S
Dec
oder
decoder
;
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
msg
,
pMsg
->
contLen
-
sizeof
(
SMsgHead
),
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
msg
,
pMsg
->
contLen
-
sizeof
(
SMsgHead
)
);
tDecodeSStreamTask
(
&
decoder
,
pTask
);
tDecodeSStreamTask
(
&
decoder
,
pTask
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
sndMetaDeployTask
(
pSnode
->
pMeta
,
pTask
);
sndMetaDeployTask
(
pSnode
->
pMeta
,
pTask
);
}
else
if
(
pMsg
->
msgType
==
TDMT_SND_TASK_EXEC
)
{
}
else
if
(
pMsg
->
msgType
==
TDMT_SND_TASK_EXEC
)
{
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
a06bf6e5
...
@@ -108,7 +108,7 @@ int32_t tsdbQuerySTableByTagCond(void *pMeta, uint64_t uid, TSKEY skey, con
...
@@ -108,7 +108,7 @@ int32_t tsdbQuerySTableByTagCond(void *pMeta, uint64_t uid, TSKEY skey, con
int64_t
tsdbGetNumOfRowsInMemTable
(
tsdbReaderT
*
pHandle
);
int64_t
tsdbGetNumOfRowsInMemTable
(
tsdbReaderT
*
pHandle
);
bool
tsdbNextDataBlock
(
tsdbReaderT
pTsdbReadHandle
);
bool
tsdbNextDataBlock
(
tsdbReaderT
pTsdbReadHandle
);
void
tsdbRetrieveDataBlockInfo
(
tsdbReaderT
*
pTsdbReadHandle
,
SDataBlockInfo
*
pBlockInfo
);
void
tsdbRetrieveDataBlockInfo
(
tsdbReaderT
*
pTsdbReadHandle
,
SDataBlockInfo
*
pBlockInfo
);
int32_t
tsdbRetrieveDataBlockStatisInfo
(
tsdbReaderT
*
pTsdbReadHandle
,
SColumnDataAgg
***
pBlockStatis
,
bool
*
allHave
);
int32_t
tsdbRetrieveDataBlockStatisInfo
(
tsdbReaderT
*
pTsdbReadHandle
,
SColumnDataAgg
***
pBlockStatis
,
bool
*
allHave
);
SArray
*
tsdbRetrieveDataBlock
(
tsdbReaderT
*
pTsdbReadHandle
,
SArray
*
pColumnIdList
);
SArray
*
tsdbRetrieveDataBlock
(
tsdbReaderT
*
pTsdbReadHandle
,
SArray
*
pColumnIdList
);
void
tsdbResetReadHandle
(
tsdbReaderT
queryHandle
,
SQueryTableDataCond
*
pCond
);
void
tsdbResetReadHandle
(
tsdbReaderT
queryHandle
,
SQueryTableDataCond
*
pCond
);
void
tsdbDestroyTableGroup
(
STableGroupInfo
*
pGroupList
);
void
tsdbDestroyTableGroup
(
STableGroupInfo
*
pGroupList
);
...
@@ -126,8 +126,8 @@ int tqReadHandleSetTbUidList(STqReadHandle *pHandle, const SArray *tbUidList
...
@@ -126,8 +126,8 @@ int tqReadHandleSetTbUidList(STqReadHandle *pHandle, const SArray *tbUidList
int
tqReadHandleAddTbUidList
(
STqReadHandle
*
pHandle
,
const
SArray
*
tbUidList
);
int
tqReadHandleAddTbUidList
(
STqReadHandle
*
pHandle
,
const
SArray
*
tbUidList
);
int32_t
tqReadHandleSetMsg
(
STqReadHandle
*
pHandle
,
SSubmitReq
*
pMsg
,
int64_t
ver
);
int32_t
tqReadHandleSetMsg
(
STqReadHandle
*
pHandle
,
SSubmitReq
*
pMsg
,
int64_t
ver
);
bool
tqNextDataBlock
(
STqReadHandle
*
pHandle
);
bool
tqNextDataBlock
(
STqReadHandle
*
pHandle
);
int32_t
tqRetrieveDataBlock
(
SArray
**
ppCols
,
STqReadHandle
*
pHandle
,
uint64_t
*
pGroupId
,
uint64_t
*
pUid
,
int32_t
*
pNumOfRows
,
int32_t
tqRetrieveDataBlock
(
SArray
**
ppCols
,
STqReadHandle
*
pHandle
,
uint64_t
*
pGroupId
,
uint64_t
*
pUid
,
int16_t
*
pNumOfCols
);
int
32_t
*
pNumOfRows
,
int
16_t
*
pNumOfCols
);
// need to reposition
// need to reposition
...
@@ -192,7 +192,7 @@ struct SMetaEntry {
...
@@ -192,7 +192,7 @@ struct SMetaEntry {
int64_t
ctime
;
int64_t
ctime
;
int32_t
ttlDays
;
int32_t
ttlDays
;
tb_uid_t
suid
;
tb_uid_t
suid
;
const
void
*
pTags
;
const
uint8_t
*
pTags
;
}
ctbEntry
;
}
ctbEntry
;
struct
{
struct
{
int64_t
ctime
;
int64_t
ctime
;
...
@@ -205,7 +205,7 @@ struct SMetaEntry {
...
@@ -205,7 +205,7 @@ struct SMetaEntry {
struct
SMetaReader
{
struct
SMetaReader
{
int32_t
flags
;
int32_t
flags
;
SMeta
*
pMeta
;
SMeta
*
pMeta
;
S
Coder
coder
;
S
Decoder
coder
;
SMetaEntry
me
;
SMetaEntry
me
;
void
*
pBuf
;
void
*
pBuf
;
int
szBuf
;
int
szBuf
;
...
...
source/dnode/vnode/src/inc/meta.h
浏览文件 @
a06bf6e5
...
@@ -39,8 +39,8 @@ typedef struct SMSmaCursor SMSmaCursor;
...
@@ -39,8 +39,8 @@ typedef struct SMSmaCursor SMSmaCursor;
// metaOpen ==================
// metaOpen ==================
// metaEntry ==================
// metaEntry ==================
int
metaEncodeEntry
(
S
C
oder
*
pCoder
,
const
SMetaEntry
*
pME
);
int
metaEncodeEntry
(
S
Enc
oder
*
pCoder
,
const
SMetaEntry
*
pME
);
int
metaDecodeEntry
(
S
C
oder
*
pCoder
,
SMetaEntry
*
pME
);
int
metaDecodeEntry
(
S
Dec
oder
*
pCoder
,
SMetaEntry
*
pME
);
// metaTable ==================
// metaTable ==================
...
...
source/dnode/vnode/src/meta/metaEntry.c
浏览文件 @
a06bf6e5
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
#include "meta.h"
#include "meta.h"
int
metaEncodeEntry
(
S
C
oder
*
pCoder
,
const
SMetaEntry
*
pME
)
{
int
metaEncodeEntry
(
S
Enc
oder
*
pCoder
,
const
SMetaEntry
*
pME
)
{
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pCoder
,
pME
->
version
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pCoder
,
pME
->
version
)
<
0
)
return
-
1
;
...
@@ -43,8 +43,8 @@ int metaEncodeEntry(SCoder *pCoder, const SMetaEntry *pME) {
...
@@ -43,8 +43,8 @@ int metaEncodeEntry(SCoder *pCoder, const SMetaEntry *pME) {
return
0
;
return
0
;
}
}
int
metaDecodeEntry
(
S
C
oder
*
pCoder
,
SMetaEntry
*
pME
)
{
int
metaDecodeEntry
(
S
Dec
oder
*
pCoder
,
SMetaEntry
*
pME
)
{
uint
64
_t
len
;
uint
32
_t
len
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pME
->
version
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pME
->
version
)
<
0
)
return
-
1
;
...
...
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
a06bf6e5
...
@@ -22,7 +22,7 @@ void metaReaderInit(SMetaReader *pReader, SMeta *pMeta, int32_t flags) {
...
@@ -22,7 +22,7 @@ void metaReaderInit(SMetaReader *pReader, SMeta *pMeta, int32_t flags) {
}
}
void
metaReaderClear
(
SMetaReader
*
pReader
)
{
void
metaReaderClear
(
SMetaReader
*
pReader
)
{
t
C
oderClear
(
&
pReader
->
coder
);
t
Dec
oderClear
(
&
pReader
->
coder
);
tdbFree
(
pReader
->
pBuf
);
tdbFree
(
pReader
->
pBuf
);
}
}
...
@@ -37,7 +37,7 @@ int metaGetTableEntryByVersion(SMetaReader *pReader, int64_t version, tb_uid_t u
...
@@ -37,7 +37,7 @@ int metaGetTableEntryByVersion(SMetaReader *pReader, int64_t version, tb_uid_t u
}
}
// decode the entry
// decode the entry
t
CoderInit
(
&
pReader
->
coder
,
TD_LITTLE_ENDIAN
,
pReader
->
pBuf
,
pReader
->
szBuf
,
TD_DECODER
);
t
DecoderInit
(
&
pReader
->
coder
,
pReader
->
pBuf
,
pReader
->
szBuf
);
if
(
metaDecodeEntry
(
&
pReader
->
coder
,
&
pReader
->
me
)
<
0
)
{
if
(
metaDecodeEntry
(
&
pReader
->
coder
,
&
pReader
->
me
)
<
0
)
{
goto
_err
;
goto
_err
;
...
@@ -147,7 +147,7 @@ SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, boo
...
@@ -147,7 +147,7 @@ SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, boo
SSchemaWrapper
*
pSW
=
NULL
;
SSchemaWrapper
*
pSW
=
NULL
;
SSchema
*
pSchema
=
NULL
;
SSchema
*
pSchema
=
NULL
;
void
*
pBuf
;
void
*
pBuf
;
S
Coder
coder
=
{
0
};
S
Decoder
coder
=
{
0
};
// fetch
// fetch
skmDbKey
.
uid
=
uid
;
skmDbKey
.
uid
=
uid
;
...
@@ -163,11 +163,11 @@ SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, boo
...
@@ -163,11 +163,11 @@ SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, boo
pBuf
=
pVal
;
pBuf
=
pVal
;
pSW
=
taosMemoryMalloc
(
sizeof
(
SSchemaWrapper
));
pSW
=
taosMemoryMalloc
(
sizeof
(
SSchemaWrapper
));
t
CoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
pVal
,
vLen
,
TD_DECODER
);
t
DecoderInit
(
&
coder
,
pVal
,
vLen
);
tDecodeSSchemaWrapper
(
&
coder
,
pSW
);
tDecodeSSchemaWrapper
(
&
coder
,
pSW
);
pSchema
=
taosMemoryMalloc
(
sizeof
(
SSchema
)
*
pSW
->
nCols
);
pSchema
=
taosMemoryMalloc
(
sizeof
(
SSchema
)
*
pSW
->
nCols
);
memcpy
(
pSchema
,
pSW
->
pSchema
,
sizeof
(
SSchema
)
*
pSW
->
nCols
);
memcpy
(
pSchema
,
pSW
->
pSchema
,
sizeof
(
SSchema
)
*
pSW
->
nCols
);
t
C
oderClear
(
&
coder
);
t
Dec
oderClear
(
&
coder
);
pSW
->
pSchema
=
pSchema
;
pSW
->
pSchema
=
pSchema
;
...
...
source/dnode/vnode/src/meta/metaTDBImpl.c
已删除
100644 → 0
浏览文件 @
6ce36a08
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "vnodeInt.h"
#ifndef META_REFACT
typedef
struct
SPoolMem
{
int64_t
size
;
struct
SPoolMem
*
prev
;
struct
SPoolMem
*
next
;
}
SPoolMem
;
#define META_TDB_SMA_TEST
static
SPoolMem
*
openPool
();
static
void
clearPool
(
SPoolMem
*
pPool
);
static
void
closePool
(
SPoolMem
*
pPool
);
static
void
*
poolMalloc
(
void
*
arg
,
size_t
size
);
static
void
poolFree
(
void
*
arg
,
void
*
ptr
);
struct
SMetaDB
{
TXN
txn
;
TENV
*
pEnv
;
TDB
*
pTbDB
;
TDB
*
pSchemaDB
;
TDB
*
pNameIdx
;
TDB
*
pStbIdx
;
TDB
*
pNtbIdx
;
TDB
*
pCtbIdx
;
SPoolMem
*
pPool
;
#ifdef META_TDB_SMA_TEST
TDB
*
pSmaDB
;
TDB
*
pSmaIdx
;
#endif
};
#pragma pack(push, 1)
typedef
struct
{
tb_uid_t
uid
;
int32_t
sver
;
}
SSchemaDbKey
;
#pragma pack(pop)
typedef
struct
{
char
*
name
;
tb_uid_t
uid
;
}
SNameIdxKey
;
typedef
struct
{
tb_uid_t
suid
;
tb_uid_t
uid
;
}
SCtbIdxKey
;
typedef
struct
{
tb_uid_t
uid
;
int64_t
smaUid
;
}
SSmaIdxKey
;
static
int
metaEncodeTbInfo
(
void
**
buf
,
STbCfg
*
pTbCfg
);
static
void
*
metaDecodeTbInfo
(
void
*
buf
,
STbCfg
*
pTbCfg
);
static
int
metaEncodeSchema
(
void
**
buf
,
SSchemaWrapper
*
pSW
);
static
void
*
metaDecodeSchema
(
void
*
buf
,
SSchemaWrapper
*
pSW
);
static
int
metaEncodeSchemaEx
(
void
**
buf
,
SSchemaWrapper
*
pSW
);
static
void
*
metaDecodeSchemaEx
(
void
*
buf
,
SSchemaWrapper
*
pSW
,
bool
isGetEx
);
static
SSchemaWrapper
*
metaGetTableSchemaImpl
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
,
bool
isinline
,
bool
isGetEx
);
static
inline
int
metaUidCmpr
(
const
void
*
arg1
,
int
len1
,
const
void
*
arg2
,
int
len2
)
{
tb_uid_t
uid1
,
uid2
;
ASSERT
(
len1
==
sizeof
(
tb_uid_t
));
ASSERT
(
len2
==
sizeof
(
tb_uid_t
));
uid1
=
((
tb_uid_t
*
)
arg1
)[
0
];
uid2
=
((
tb_uid_t
*
)
arg2
)[
0
];
if
(
uid1
<
uid2
)
{
return
-
1
;
}
if
(
uid1
==
uid2
)
{
return
0
;
}
else
{
return
1
;
}
}
static
inline
int
metaSchemaKeyCmpr
(
const
void
*
arg1
,
int
len1
,
const
void
*
arg2
,
int
len2
)
{
int
c
;
SSchemaDbKey
*
pKey1
=
(
SSchemaDbKey
*
)
arg1
;
SSchemaDbKey
*
pKey2
=
(
SSchemaDbKey
*
)
arg2
;
c
=
metaUidCmpr
(
arg1
,
sizeof
(
tb_uid_t
),
arg2
,
sizeof
(
tb_uid_t
));
if
(
c
)
return
c
;
if
(
pKey1
->
sver
>
pKey2
->
sver
)
{
return
1
;
}
else
if
(
pKey1
->
sver
==
pKey2
->
sver
)
{
return
0
;
}
else
{
return
-
1
;
}
}
static
inline
int
metaNameIdxCmpr
(
const
void
*
arg1
,
int
len1
,
const
void
*
arg2
,
int
len2
)
{
return
strcmp
((
char
*
)
arg1
,
(
char
*
)
arg2
);
}
static
inline
int
metaCtbIdxCmpr
(
const
void
*
arg1
,
int
len1
,
const
void
*
arg2
,
int
len2
)
{
int
c
;
SCtbIdxKey
*
pKey1
=
(
SCtbIdxKey
*
)
arg1
;
SCtbIdxKey
*
pKey2
=
(
SCtbIdxKey
*
)
arg2
;
c
=
metaUidCmpr
(
arg1
,
sizeof
(
tb_uid_t
),
arg2
,
sizeof
(
tb_uid_t
));
if
(
c
)
return
c
;
return
metaUidCmpr
(
&
pKey1
->
uid
,
sizeof
(
tb_uid_t
),
&
pKey2
->
uid
,
sizeof
(
tb_uid_t
));
}
static
inline
int
metaSmaIdxCmpr
(
const
void
*
arg1
,
int
len1
,
const
void
*
arg2
,
int
len2
)
{
int
c
;
SSmaIdxKey
*
pKey1
=
(
SSmaIdxKey
*
)
arg1
;
SSmaIdxKey
*
pKey2
=
(
SSmaIdxKey
*
)
arg2
;
c
=
metaUidCmpr
(
arg1
,
sizeof
(
tb_uid_t
),
arg2
,
sizeof
(
tb_uid_t
));
if
(
c
)
return
c
;
return
metaUidCmpr
(
&
pKey1
->
smaUid
,
sizeof
(
int64_t
),
&
pKey2
->
smaUid
,
sizeof
(
int64_t
));
}
int
metaOpenDB
(
SMeta
*
pMeta
)
{
SMetaDB
*
pMetaDb
;
int
ret
;
// allocate DB handle
pMetaDb
=
taosMemoryCalloc
(
1
,
sizeof
(
*
pMetaDb
));
if
(
pMetaDb
==
NULL
)
{
// TODO
ASSERT
(
0
);
return
-
1
;
}
// open the ENV
ret
=
tdbEnvOpen
(
pMeta
->
path
,
4096
,
256
,
&
(
pMetaDb
->
pEnv
));
if
(
ret
<
0
)
{
// TODO
ASSERT
(
0
);
return
-
1
;
}
// open table DB
ret
=
tdbDbOpen
(
"table.db"
,
sizeof
(
tb_uid_t
),
TDB_VARIANT_LEN
,
metaUidCmpr
,
pMetaDb
->
pEnv
,
&
(
pMetaDb
->
pTbDB
));
if
(
ret
<
0
)
{
// TODO
ASSERT
(
0
);
return
-
1
;
}
#ifdef META_TDB_SMA_TEST
ret
=
tdbDbOpen
(
"sma.db"
,
sizeof
(
int64_t
),
TDB_VARIANT_LEN
,
metaUidCmpr
,
pMetaDb
->
pEnv
,
&
(
pMetaDb
->
pSmaDB
));
if
(
ret
<
0
)
{
// TODO
ASSERT
(
0
);
return
-
1
;
}
#endif
// open schema DB
ret
=
tdbDbOpen
(
"schema.db"
,
sizeof
(
SSchemaDbKey
),
TDB_VARIANT_LEN
,
metaSchemaKeyCmpr
,
pMetaDb
->
pEnv
,
&
(
pMetaDb
->
pSchemaDB
));
if
(
ret
<
0
)
{
// TODO
ASSERT
(
0
);
return
-
1
;
}
ret
=
tdbDbOpen
(
"name.idx"
,
TDB_VARIANT_LEN
,
0
,
metaNameIdxCmpr
,
pMetaDb
->
pEnv
,
&
(
pMetaDb
->
pNameIdx
));
if
(
ret
<
0
)
{
// TODO
ASSERT
(
0
);
return
-
1
;
}
ret
=
tdbDbOpen
(
"stb.idx"
,
sizeof
(
tb_uid_t
),
0
,
metaUidCmpr
,
pMetaDb
->
pEnv
,
&
(
pMetaDb
->
pStbIdx
));
if
(
ret
<
0
)
{
// TODO
ASSERT
(
0
);
return
-
1
;
}
ret
=
tdbDbOpen
(
"ntb.idx"
,
sizeof
(
tb_uid_t
),
0
,
metaUidCmpr
,
pMetaDb
->
pEnv
,
&
(
pMetaDb
->
pNtbIdx
));
if
(
ret
<
0
)
{
// TODO
ASSERT
(
0
);
return
-
1
;
}
ret
=
tdbDbOpen
(
"ctb.idx"
,
sizeof
(
SCtbIdxKey
),
0
,
metaCtbIdxCmpr
,
pMetaDb
->
pEnv
,
&
(
pMetaDb
->
pCtbIdx
));
if
(
ret
<
0
)
{
// TODO
ASSERT
(
0
);
return
-
1
;
}
#ifdef META_TDB_SMA_TEST
ret
=
tdbDbOpen
(
"sma.idx"
,
sizeof
(
SSmaIdxKey
),
0
,
metaSmaIdxCmpr
,
pMetaDb
->
pEnv
,
&
(
pMetaDb
->
pSmaIdx
));
if
(
ret
<
0
)
{
// TODO
ASSERT
(
0
);
return
-
1
;
}
#endif
pMetaDb
->
pPool
=
openPool
();
tdbTxnOpen
(
&
pMetaDb
->
txn
,
0
,
poolMalloc
,
poolFree
,
pMetaDb
->
pPool
,
TDB_TXN_WRITE
|
TDB_TXN_READ_UNCOMMITTED
);
tdbBegin
(
pMetaDb
->
pEnv
,
NULL
);
pMeta
->
pDB
=
pMetaDb
;
return
0
;
}
void
metaCloseDB
(
SMeta
*
pMeta
)
{
if
(
pMeta
->
pDB
)
{
tdbCommit
(
pMeta
->
pDB
->
pEnv
,
&
pMeta
->
pDB
->
txn
);
tdbTxnClose
(
&
pMeta
->
pDB
->
txn
);
clearPool
(
pMeta
->
pDB
->
pPool
);
#ifdef META_TDB_SMA_TEST
tdbDbClose
(
pMeta
->
pDB
->
pSmaIdx
);
#endif
tdbDbClose
(
pMeta
->
pDB
->
pCtbIdx
);
tdbDbClose
(
pMeta
->
pDB
->
pNtbIdx
);
tdbDbClose
(
pMeta
->
pDB
->
pStbIdx
);
tdbDbClose
(
pMeta
->
pDB
->
pNameIdx
);
#ifdef META_TDB_SMA_TEST
tdbDbClose
(
pMeta
->
pDB
->
pSmaDB
);
#endif
tdbDbClose
(
pMeta
->
pDB
->
pSchemaDB
);
tdbDbClose
(
pMeta
->
pDB
->
pTbDB
);
taosMemoryFree
(
pMeta
->
pDB
);
}
}
int
metaSaveTableToDB
(
SMeta
*
pMeta
,
STbCfg
*
pTbCfg
,
STbDdlH
*
pHandle
)
{
tb_uid_t
uid
;
SMetaDB
*
pMetaDb
;
void
*
pKey
;
void
*
pVal
;
int
kLen
;
int
vLen
;
int
ret
;
char
buf
[
512
];
void
*
pBuf
;
SCtbIdxKey
ctbIdxKey
;
SSchemaDbKey
schemaDbKey
;
SSchemaWrapper
schemaWrapper
;
pMetaDb
=
pMeta
->
pDB
;
// TODO: make this operation pre-process
if
(
pTbCfg
->
type
==
META_SUPER_TABLE
)
{
uid
=
pTbCfg
->
stbCfg
.
suid
;
}
else
{
uid
=
metaGenerateUid
(
pMeta
);
}
// check name and uid unique
if
(
tdbDbGet
(
pMetaDb
->
pTbDB
,
&
uid
,
sizeof
(
uid
),
NULL
,
NULL
)
==
0
)
{
return
-
1
;
}
if
(
tdbDbGet
(
pMetaDb
->
pNameIdx
,
pTbCfg
->
name
,
strlen
(
pTbCfg
->
name
)
+
1
,
NULL
,
NULL
)
==
0
)
{
return
-
1
;
}
// save to table.db
pKey
=
&
uid
;
kLen
=
sizeof
(
uid
);
pVal
=
pBuf
=
buf
;
metaEncodeTbInfo
(
&
pBuf
,
pTbCfg
);
vLen
=
POINTER_DISTANCE
(
pBuf
,
buf
);
ret
=
tdbDbInsert
(
pMetaDb
->
pTbDB
,
pKey
,
kLen
,
pVal
,
vLen
,
&
pMetaDb
->
txn
);
if
(
ret
<
0
)
{
return
-
1
;
}
// save to schema.db for META_SUPER_TABLE and META_NORMAL_TABLE
if
(
pTbCfg
->
type
!=
META_CHILD_TABLE
)
{
schemaDbKey
.
uid
=
uid
;
schemaDbKey
.
sver
=
0
;
// TODO
pKey
=
&
schemaDbKey
;
kLen
=
sizeof
(
schemaDbKey
);
if
(
pTbCfg
->
type
==
META_SUPER_TABLE
)
{
schemaWrapper
.
nCols
=
pTbCfg
->
stbCfg
.
nCols
;
schemaWrapper
.
pSchema
=
pTbCfg
->
stbCfg
.
pSchema
;
}
else
{
schemaWrapper
.
nCols
=
pTbCfg
->
ntbCfg
.
nCols
;
schemaWrapper
.
pSchema
=
pTbCfg
->
ntbCfg
.
pSchema
;
}
pVal
=
pBuf
=
buf
;
metaEncodeSchemaEx
(
&
pBuf
,
&
schemaWrapper
);
vLen
=
POINTER_DISTANCE
(
pBuf
,
buf
);
ret
=
tdbDbInsert
(
pMetaDb
->
pSchemaDB
,
pKey
,
kLen
,
pVal
,
vLen
,
&
pMeta
->
pDB
->
txn
);
if
(
ret
<
0
)
{
return
-
1
;
}
}
// update name.idx
int
nameLen
=
strlen
(
pTbCfg
->
name
);
memcpy
(
buf
,
pTbCfg
->
name
,
nameLen
+
1
);
((
tb_uid_t
*
)(
buf
+
nameLen
+
1
))[
0
]
=
uid
;
pKey
=
buf
;
kLen
=
nameLen
+
1
+
sizeof
(
uid
);
pVal
=
NULL
;
vLen
=
0
;
ret
=
tdbDbInsert
(
pMetaDb
->
pNameIdx
,
pKey
,
kLen
,
pVal
,
vLen
,
&
pMetaDb
->
txn
);
if
(
ret
<
0
)
{
return
-
1
;
}
// update other index
if
(
pTbCfg
->
type
==
META_SUPER_TABLE
)
{
pKey
=
&
uid
;
kLen
=
sizeof
(
uid
);
pVal
=
NULL
;
vLen
=
0
;
ret
=
tdbDbInsert
(
pMetaDb
->
pStbIdx
,
pKey
,
kLen
,
pVal
,
vLen
,
&
pMetaDb
->
txn
);
if
(
ret
<
0
)
{
return
-
1
;
}
}
else
if
(
pTbCfg
->
type
==
META_CHILD_TABLE
)
{
ctbIdxKey
.
suid
=
pTbCfg
->
ctbCfg
.
suid
;
ctbIdxKey
.
uid
=
uid
;
pKey
=
&
ctbIdxKey
;
kLen
=
sizeof
(
ctbIdxKey
);
pVal
=
NULL
;
vLen
=
0
;
ret
=
tdbDbInsert
(
pMetaDb
->
pCtbIdx
,
pKey
,
kLen
,
pVal
,
vLen
,
&
pMetaDb
->
txn
);
if
(
ret
<
0
)
{
return
-
1
;
}
// child table handle for rsma
if
(
pHandle
&&
pHandle
->
fp
)
{
if
(((
*
pHandle
->
fp
)(
pHandle
->
ahandle
,
&
pHandle
->
result
,
&
ctbIdxKey
.
suid
,
&
uid
))
<
0
)
{
return
-
1
;
};
}
}
else
if
(
pTbCfg
->
type
==
META_NORMAL_TABLE
)
{
pKey
=
&
uid
;
kLen
=
sizeof
(
uid
);
pVal
=
NULL
;
vLen
=
0
;
ret
=
tdbDbInsert
(
pMetaDb
->
pNtbIdx
,
pKey
,
kLen
,
pVal
,
vLen
,
&
pMetaDb
->
txn
);
if
(
ret
<
0
)
{
return
-
1
;
}
}
if
(
pMeta
->
pDB
->
pPool
->
size
>
0
)
{
metaCommit
(
pMeta
);
}
return
0
;
}
int
metaRemoveTableFromDb
(
SMeta
*
pMeta
,
tb_uid_t
uid
)
{
// TODO
ASSERT
(
0
);
return
0
;
}
static
SSchemaWrapper
*
metaGetTableSchemaImpl
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
,
bool
isinline
,
bool
isGetEx
)
{
void
*
pKey
;
void
*
pVal
;
int
kLen
;
int
vLen
;
int
ret
;
SSchemaDbKey
schemaDbKey
;
SSchemaWrapper
*
pSchemaWrapper
;
void
*
pBuf
;
// fetch
schemaDbKey
.
uid
=
uid
;
schemaDbKey
.
sver
=
sver
;
pKey
=
&
schemaDbKey
;
kLen
=
sizeof
(
schemaDbKey
);
pVal
=
NULL
;
ret
=
tdbDbGet
(
pMeta
->
pDB
->
pSchemaDB
,
pKey
,
kLen
,
&
pVal
,
&
vLen
);
if
(
ret
<
0
)
{
return
NULL
;
}
// decode
pBuf
=
pVal
;
pSchemaWrapper
=
taosMemoryMalloc
(
sizeof
(
*
pSchemaWrapper
));
metaDecodeSchemaEx
(
pBuf
,
pSchemaWrapper
,
isGetEx
);
tdbFree
(
pVal
);
return
pSchemaWrapper
;
}
struct
SMSmaCursor
{
TDBC
*
pCur
;
tb_uid_t
uid
;
void
*
pKey
;
void
*
pVal
;
int
kLen
;
int
vLen
;
};
STSmaWrapper
*
metaGetSmaInfoByTable
(
SMeta
*
pMeta
,
tb_uid_t
uid
)
{
// TODO
// ASSERT(0);
// return NULL;
#ifdef META_TDB_SMA_TEST
STSmaWrapper
*
pSW
=
NULL
;
SMSmaCursor
*
pCur
=
metaOpenSmaCursor
(
pMeta
,
uid
);
if
(
pCur
==
NULL
)
{
return
NULL
;
}
void
*
pBuf
=
NULL
;
SSmaIdxKey
*
pSmaIdxKey
=
NULL
;
while
(
true
)
{
// TODO: lock during iterate?
if
(
tdbDbcNext
(
pCur
->
pCur
,
&
pCur
->
pKey
,
&
pCur
->
kLen
,
NULL
,
&
pCur
->
vLen
)
==
0
)
{
pSmaIdxKey
=
pCur
->
pKey
;
ASSERT
(
pSmaIdxKey
!=
NULL
);
void
*
pSmaVal
=
metaGetSmaInfoByIndex
(
pMeta
,
pSmaIdxKey
->
smaUid
,
false
);
if
(
pSmaVal
==
NULL
)
{
tsdbWarn
(
"no tsma exists for indexUid: %"
PRIi64
,
pSmaIdxKey
->
smaUid
);
continue
;
}
if
((
pSW
==
NULL
)
&&
((
pSW
=
taosMemoryCalloc
(
1
,
sizeof
(
*
pSW
)))
==
NULL
))
{
tdbFree
(
pSmaVal
);
metaCloseSmaCursor
(
pCur
);
return
NULL
;
}
++
pSW
->
number
;
STSma
*
tptr
=
(
STSma
*
)
taosMemoryRealloc
(
pSW
->
tSma
,
pSW
->
number
*
sizeof
(
STSma
));
if
(
tptr
==
NULL
)
{
tdbFree
(
pSmaVal
);
metaCloseSmaCursor
(
pCur
);
tdDestroyTSmaWrapper
(
pSW
);
taosMemoryFreeClear
(
pSW
);
return
NULL
;
}
pSW
->
tSma
=
tptr
;
pBuf
=
pSmaVal
;
if
(
tDecodeTSma
(
pBuf
,
pSW
->
tSma
+
pSW
->
number
-
1
)
==
NULL
)
{
tdbFree
(
pSmaVal
);
metaCloseSmaCursor
(
pCur
);
tdDestroyTSmaWrapper
(
pSW
);
taosMemoryFreeClear
(
pSW
);
return
NULL
;
}
tdbFree
(
pSmaVal
);
continue
;
}
break
;
}
metaCloseSmaCursor
(
pCur
);
return
pSW
;
#endif
}
int
metaRemoveSmaFromDb
(
SMeta
*
pMeta
,
int64_t
indexUid
)
{
// TODO
ASSERT
(
0
);
#ifndef META_TDB_SMA_TEST
DBT
key
=
{
0
};
key
.
data
=
(
void
*
)
indexName
;
key
.
size
=
strlen
(
indexName
);
metaDBWLock
(
pMeta
->
pDB
);
// TODO: No guarantee of consistence.
// Use transaction or DB->sync() for some guarantee.
pMeta
->
pDB
->
pSmaDB
->
del
(
pMeta
->
pDB
->
pSmaDB
,
NULL
,
&
key
,
0
);
metaDBULock
(
pMeta
->
pDB
);
#endif
return
0
;
}
int
metaSaveSmaToDB
(
SMeta
*
pMeta
,
STSma
*
pSmaCfg
)
{
// TODO
// ASSERT(0);
#ifdef META_TDB_SMA_TEST
int32_t
ret
=
0
;
SMetaDB
*
pMetaDb
=
pMeta
->
pDB
;
void
*
pBuf
=
NULL
,
*
qBuf
=
NULL
;
void
*
key
=
{
0
},
*
val
=
{
0
};
// save sma info
int32_t
len
=
tEncodeTSma
(
NULL
,
pSmaCfg
);
pBuf
=
taosMemoryCalloc
(
1
,
len
);
if
(
pBuf
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
key
=
(
void
*
)
&
pSmaCfg
->
indexUid
;
qBuf
=
pBuf
;
tEncodeTSma
(
&
qBuf
,
pSmaCfg
);
val
=
pBuf
;
int32_t
kLen
=
sizeof
(
pSmaCfg
->
indexUid
);
int32_t
vLen
=
POINTER_DISTANCE
(
qBuf
,
pBuf
);
ret
=
tdbDbInsert
(
pMeta
->
pDB
->
pSmaDB
,
key
,
kLen
,
val
,
vLen
,
&
pMetaDb
->
txn
);
if
(
ret
<
0
)
{
taosMemoryFreeClear
(
pBuf
);
return
-
1
;
}
// add sma idx
SSmaIdxKey
smaIdxKey
;
smaIdxKey
.
uid
=
pSmaCfg
->
tableUid
;
smaIdxKey
.
smaUid
=
pSmaCfg
->
indexUid
;
key
=
&
smaIdxKey
;
kLen
=
sizeof
(
smaIdxKey
);
val
=
NULL
;
vLen
=
0
;
ret
=
tdbDbInsert
(
pMeta
->
pDB
->
pSmaIdx
,
key
,
kLen
,
val
,
vLen
,
&
pMetaDb
->
txn
);
if
(
ret
<
0
)
{
taosMemoryFreeClear
(
pBuf
);
return
-
1
;
}
// release
taosMemoryFreeClear
(
pBuf
);
if
(
pMeta
->
pDB
->
pPool
->
size
>
0
)
{
metaCommit
(
pMeta
);
}
#endif
return
0
;
}
/**
* @brief
*
* @param pMeta
* @param uid 0 means iterate all uids.
* @return SMSmaCursor*
*/
SMSmaCursor
*
metaOpenSmaCursor
(
SMeta
*
pMeta
,
tb_uid_t
uid
)
{
// TODO
// ASSERT(0);
// return NULL;
#ifdef META_TDB_SMA_TEST
SMSmaCursor
*
pCur
=
NULL
;
SMetaDB
*
pDB
=
pMeta
->
pDB
;
int
ret
;
pCur
=
(
SMSmaCursor
*
)
taosMemoryCalloc
(
1
,
sizeof
(
*
pCur
));
if
(
pCur
==
NULL
)
{
return
NULL
;
}
pCur
->
uid
=
uid
;
ret
=
tdbDbcOpen
(
pDB
->
pSmaIdx
,
&
(
pCur
->
pCur
));
if
((
ret
!=
0
)
||
(
pCur
->
pCur
==
NULL
))
{
taosMemoryFree
(
pCur
);
return
NULL
;
}
if
(
uid
!=
0
)
{
// TODO: move to the specific uid
}
return
pCur
;
#endif
}
/**
* @brief
*
* @param pCur
* @return int64_t smaIndexUid
*/
int64_t
metaSmaCursorNext
(
SMSmaCursor
*
pCur
)
{
// TODO
// ASSERT(0);
// return NULL;
#ifdef META_TDB_SMA_TEST
int
ret
;
void
*
pBuf
;
SSmaIdxKey
*
smaIdxKey
;
ret
=
tdbDbcNext
(
pCur
->
pCur
,
&
pCur
->
pKey
,
&
pCur
->
kLen
,
&
pCur
->
pVal
,
&
pCur
->
vLen
);
if
(
ret
<
0
)
{
return
0
;
}
smaIdxKey
=
pCur
->
pKey
;
return
smaIdxKey
->
smaUid
;
#endif
}
void
metaCloseSmaCursor
(
SMSmaCursor
*
pCur
)
{
// TODO
// ASSERT(0);
#ifdef META_TDB_SMA_TEST
if
(
pCur
)
{
if
(
pCur
->
pCur
)
{
tdbDbcClose
(
pCur
->
pCur
);
}
taosMemoryFree
(
pCur
);
}
#endif
}
static
int
metaEncodeSchema
(
void
**
buf
,
SSchemaWrapper
*
pSW
)
{
int
tlen
=
0
;
SSchema
*
pSchema
;
tlen
+=
taosEncodeFixedU32
(
buf
,
pSW
->
nCols
);
for
(
int
i
=
0
;
i
<
pSW
->
nCols
;
i
++
)
{
pSchema
=
pSW
->
pSchema
+
i
;
tlen
+=
taosEncodeFixedI8
(
buf
,
pSchema
->
type
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pSchema
->
flags
);
tlen
+=
taosEncodeFixedI16
(
buf
,
pSchema
->
colId
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pSchema
->
bytes
);
tlen
+=
taosEncodeString
(
buf
,
pSchema
->
name
);
}
return
tlen
;
}
static
void
*
metaDecodeSchema
(
void
*
buf
,
SSchemaWrapper
*
pSW
)
{
SSchema
*
pSchema
;
buf
=
taosDecodeFixedU32
(
buf
,
&
pSW
->
nCols
);
pSW
->
pSchema
=
(
SSchema
*
)
taosMemoryMalloc
(
sizeof
(
SSchema
)
*
pSW
->
nCols
);
for
(
int
i
=
0
;
i
<
pSW
->
nCols
;
i
++
)
{
pSchema
=
pSW
->
pSchema
+
i
;
buf
=
taosDecodeFixedI8
(
buf
,
&
pSchema
->
type
);
buf
=
taosSkipFixedLen
(
buf
,
sizeof
(
int8_t
));
buf
=
taosDecodeFixedI16
(
buf
,
&
pSchema
->
colId
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pSchema
->
bytes
);
buf
=
taosDecodeStringTo
(
buf
,
pSchema
->
name
);
}
return
buf
;
}
static
int
metaEncodeSchemaEx
(
void
**
buf
,
SSchemaWrapper
*
pSW
)
{
int
tlen
=
0
;
SSchema
*
pSchema
;
tlen
+=
taosEncodeFixedU32
(
buf
,
pSW
->
nCols
);
for
(
int
i
=
0
;
i
<
pSW
->
nCols
;
++
i
)
{
pSchema
=
pSW
->
pSchema
+
i
;
tlen
+=
taosEncodeFixedI8
(
buf
,
pSchema
->
type
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pSchema
->
flags
);
tlen
+=
taosEncodeFixedI16
(
buf
,
pSchema
->
colId
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pSchema
->
bytes
);
tlen
+=
taosEncodeString
(
buf
,
pSchema
->
name
);
}
return
tlen
;
}
static
void
*
metaDecodeSchemaEx
(
void
*
buf
,
SSchemaWrapper
*
pSW
,
bool
isGetEx
)
{
buf
=
taosDecodeFixedU32
(
buf
,
&
pSW
->
nCols
);
if
(
isGetEx
)
{
pSW
->
pSchema
=
(
SSchema
*
)
taosMemoryMalloc
(
sizeof
(
SSchema
)
*
pSW
->
nCols
);
for
(
int
i
=
0
;
i
<
pSW
->
nCols
;
i
++
)
{
SSchema
*
pSchema
=
pSW
->
pSchema
+
i
;
buf
=
taosDecodeFixedI8
(
buf
,
&
pSchema
->
type
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pSchema
->
flags
);
buf
=
taosDecodeFixedI16
(
buf
,
&
pSchema
->
colId
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pSchema
->
bytes
);
buf
=
taosDecodeStringTo
(
buf
,
pSchema
->
name
);
}
}
else
{
pSW
->
pSchema
=
(
SSchema
*
)
taosMemoryMalloc
(
sizeof
(
SSchema
)
*
pSW
->
nCols
);
for
(
int
i
=
0
;
i
<
pSW
->
nCols
;
i
++
)
{
SSchema
*
pSchema
=
pSW
->
pSchema
+
i
;
buf
=
taosDecodeFixedI8
(
buf
,
&
pSchema
->
type
);
buf
=
taosSkipFixedLen
(
buf
,
sizeof
(
int8_t
));
buf
=
taosDecodeFixedI16
(
buf
,
&
pSchema
->
colId
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pSchema
->
bytes
);
buf
=
taosDecodeStringTo
(
buf
,
pSchema
->
name
);
}
}
return
buf
;
}
static
int
metaEncodeTbInfo
(
void
**
buf
,
STbCfg
*
pTbCfg
)
{
int
tsize
=
0
;
tsize
+=
taosEncodeString
(
buf
,
pTbCfg
->
name
);
tsize
+=
taosEncodeFixedU32
(
buf
,
pTbCfg
->
ttl
);
tsize
+=
taosEncodeFixedU32
(
buf
,
pTbCfg
->
keep
);
tsize
+=
taosEncodeFixedU8
(
buf
,
pTbCfg
->
info
);
if
(
pTbCfg
->
type
==
META_SUPER_TABLE
)
{
SSchemaWrapper
sw
=
{.
nCols
=
pTbCfg
->
stbCfg
.
nTagCols
,
.
pSchema
=
pTbCfg
->
stbCfg
.
pTagSchema
};
tsize
+=
metaEncodeSchema
(
buf
,
&
sw
);
}
else
if
(
pTbCfg
->
type
==
META_CHILD_TABLE
)
{
tsize
+=
taosEncodeFixedU64
(
buf
,
pTbCfg
->
ctbCfg
.
suid
);
tsize
+=
tdEncodeKVRow
(
buf
,
pTbCfg
->
ctbCfg
.
pTag
);
}
else
if
(
pTbCfg
->
type
==
META_NORMAL_TABLE
)
{
// TODO
}
else
{
ASSERT
(
0
);
}
return
tsize
;
}
static
void
*
metaDecodeTbInfo
(
void
*
buf
,
STbCfg
*
pTbCfg
)
{
buf
=
taosDecodeString
(
buf
,
&
(
pTbCfg
->
name
));
buf
=
taosDecodeFixedU32
(
buf
,
&
(
pTbCfg
->
ttl
));
buf
=
taosDecodeFixedU32
(
buf
,
&
(
pTbCfg
->
keep
));
buf
=
taosDecodeFixedU8
(
buf
,
&
(
pTbCfg
->
info
));
if
(
pTbCfg
->
type
==
META_SUPER_TABLE
)
{
SSchemaWrapper
sw
;
buf
=
metaDecodeSchema
(
buf
,
&
sw
);
pTbCfg
->
stbCfg
.
nTagCols
=
sw
.
nCols
;
pTbCfg
->
stbCfg
.
pTagSchema
=
sw
.
pSchema
;
}
else
if
(
pTbCfg
->
type
==
META_CHILD_TABLE
)
{
buf
=
taosDecodeFixedU64
(
buf
,
&
(
pTbCfg
->
ctbCfg
.
suid
));
buf
=
tdDecodeKVRow
(
buf
,
&
(
pTbCfg
->
ctbCfg
.
pTag
));
}
else
if
(
pTbCfg
->
type
==
META_NORMAL_TABLE
)
{
// TODO
}
else
{
ASSERT
(
0
);
}
return
buf
;
}
int
metaCommit
(
SMeta
*
pMeta
)
{
TXN
*
pTxn
=
&
pMeta
->
pDB
->
txn
;
// Commit current txn
tdbCommit
(
pMeta
->
pDB
->
pEnv
,
pTxn
);
tdbTxnClose
(
pTxn
);
clearPool
(
pMeta
->
pDB
->
pPool
);
// start a new txn
tdbTxnOpen
(
&
pMeta
->
pDB
->
txn
,
0
,
poolMalloc
,
poolFree
,
pMeta
->
pDB
->
pPool
,
TDB_TXN_WRITE
|
TDB_TXN_READ_UNCOMMITTED
);
tdbBegin
(
pMeta
->
pDB
->
pEnv
,
pTxn
);
return
0
;
}
static
SPoolMem
*
openPool
()
{
SPoolMem
*
pPool
=
(
SPoolMem
*
)
tdbOsMalloc
(
sizeof
(
*
pPool
));
pPool
->
prev
=
pPool
->
next
=
pPool
;
pPool
->
size
=
0
;
return
pPool
;
}
static
void
clearPool
(
SPoolMem
*
pPool
)
{
SPoolMem
*
pMem
;
do
{
pMem
=
pPool
->
next
;
if
(
pMem
==
pPool
)
break
;
pMem
->
next
->
prev
=
pMem
->
prev
;
pMem
->
prev
->
next
=
pMem
->
next
;
pPool
->
size
-=
pMem
->
size
;
tdbOsFree
(
pMem
);
}
while
(
1
);
assert
(
pPool
->
size
==
0
);
}
static
void
closePool
(
SPoolMem
*
pPool
)
{
clearPool
(
pPool
);
tdbOsFree
(
pPool
);
}
static
void
*
poolMalloc
(
void
*
arg
,
size_t
size
)
{
void
*
ptr
=
NULL
;
SPoolMem
*
pPool
=
(
SPoolMem
*
)
arg
;
SPoolMem
*
pMem
;
pMem
=
(
SPoolMem
*
)
tdbOsMalloc
(
sizeof
(
*
pMem
)
+
size
);
if
(
pMem
==
NULL
)
{
assert
(
0
);
}
pMem
->
size
=
sizeof
(
*
pMem
)
+
size
;
pMem
->
next
=
pPool
->
next
;
pMem
->
prev
=
pPool
;
pPool
->
next
->
prev
=
pMem
;
pPool
->
next
=
pMem
;
pPool
->
size
+=
pMem
->
size
;
ptr
=
(
void
*
)(
&
pMem
[
1
]);
return
ptr
;
}
static
void
poolFree
(
void
*
arg
,
void
*
ptr
)
{
SPoolMem
*
pPool
=
(
SPoolMem
*
)
arg
;
SPoolMem
*
pMem
;
pMem
=
&
(((
SPoolMem
*
)
ptr
)[
-
1
]);
pMem
->
next
->
prev
=
pMem
->
prev
;
pMem
->
prev
->
next
=
pMem
->
next
;
pPool
->
size
-=
pMem
->
size
;
tdbOsFree
(
pMem
);
}
#endif
\ No newline at end of file
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
a06bf6e5
...
@@ -33,7 +33,6 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
...
@@ -33,7 +33,6 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
void
*
pBuf
=
NULL
;
void
*
pBuf
=
NULL
;
int32_t
szBuf
=
0
;
int32_t
szBuf
=
0
;
void
*
p
=
NULL
;
void
*
p
=
NULL
;
SCoder
coder
=
{
0
};
SMetaReader
mr
=
{
0
};
SMetaReader
mr
=
{
0
};
// validate req
// validate req
...
@@ -192,7 +191,7 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq) {
...
@@ -192,7 +191,7 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq) {
tb_uid_t
uid
;
tb_uid_t
uid
;
int64_t
tver
;
int64_t
tver
;
SMetaEntry
me
=
{
0
};
SMetaEntry
me
=
{
0
};
S
Coder
coder
=
{
0
};
S
Decoder
coder
=
{
0
};
int8_t
type
;
int8_t
type
;
int64_t
ctime
;
int64_t
ctime
;
tb_uid_t
suid
;
tb_uid_t
suid
;
...
@@ -253,7 +252,7 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq) {
...
@@ -253,7 +252,7 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq) {
// decode entry
// decode entry
void
*
pDataCopy
=
taosMemoryMalloc
(
nData
);
// remove the copy (todo)
void
*
pDataCopy
=
taosMemoryMalloc
(
nData
);
// remove the copy (todo)
memcpy
(
pDataCopy
,
pData
,
nData
);
memcpy
(
pDataCopy
,
pData
,
nData
);
t
CoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
pDataCopy
,
nData
,
TD_DECODER
);
t
DecoderInit
(
&
coder
,
pDataCopy
,
nData
);
ret
=
metaDecodeEntry
(
&
coder
,
&
me
);
ret
=
metaDecodeEntry
(
&
coder
,
&
me
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
ASSERT
(
0
);
ASSERT
(
0
);
...
@@ -272,7 +271,7 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq) {
...
@@ -272,7 +271,7 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq) {
}
}
taosMemoryFree
(
pDataCopy
);
taosMemoryFree
(
pDataCopy
);
t
C
oderClear
(
&
coder
);
t
Dec
oderClear
(
&
coder
);
tdbDbcClose
(
pTbDbc
);
tdbDbcClose
(
pTbDbc
);
if
(
type
==
TSDB_CHILD_TABLE
)
{
if
(
type
==
TSDB_CHILD_TABLE
)
{
...
@@ -309,7 +308,7 @@ static int metaSaveToTbDb(SMeta *pMeta, const SMetaEntry *pME) {
...
@@ -309,7 +308,7 @@ static int metaSaveToTbDb(SMeta *pMeta, const SMetaEntry *pME) {
void
*
pVal
=
NULL
;
void
*
pVal
=
NULL
;
int
kLen
=
0
;
int
kLen
=
0
;
int
vLen
=
0
;
int
vLen
=
0
;
S
Coder
coder
=
{
0
};
S
Encoder
coder
=
{
0
};
// set key and value
// set key and value
tbDbKey
.
version
=
pME
->
version
;
tbDbKey
.
version
=
pME
->
version
;
...
@@ -330,13 +329,13 @@ static int metaSaveToTbDb(SMeta *pMeta, const SMetaEntry *pME) {
...
@@ -330,13 +329,13 @@ static int metaSaveToTbDb(SMeta *pMeta, const SMetaEntry *pME) {
goto
_err
;
goto
_err
;
}
}
t
CoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
pVal
,
vLen
,
TD_ENCODER
);
t
EncoderInit
(
&
coder
,
pVal
,
vLen
);
if
(
metaEncodeEntry
(
&
coder
,
pME
)
<
0
)
{
if
(
metaEncodeEntry
(
&
coder
,
pME
)
<
0
)
{
goto
_err
;
goto
_err
;
}
}
t
C
oderClear
(
&
coder
);
t
Enc
oderClear
(
&
coder
);
// write to table.db
// write to table.db
if
(
tdbDbInsert
(
pMeta
->
pTbDb
,
pKey
,
kLen
,
pVal
,
vLen
,
&
pMeta
->
txn
)
<
0
)
{
if
(
tdbDbInsert
(
pMeta
->
pTbDb
,
pKey
,
kLen
,
pVal
,
vLen
,
&
pMeta
->
txn
)
<
0
)
{
...
@@ -393,7 +392,7 @@ static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pME) {
...
@@ -393,7 +392,7 @@ static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pME) {
}
}
static
int
metaSaveToSkmDb
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pME
)
{
static
int
metaSaveToSkmDb
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pME
)
{
S
Coder
coder
=
{
0
};
S
Encoder
coder
=
{
0
};
void
*
pVal
=
NULL
;
void
*
pVal
=
NULL
;
int
vLen
=
0
;
int
vLen
=
0
;
int
rcode
=
0
;
int
rcode
=
0
;
...
@@ -422,7 +421,7 @@ static int metaSaveToSkmDb(SMeta *pMeta, const SMetaEntry *pME) {
...
@@ -422,7 +421,7 @@ static int metaSaveToSkmDb(SMeta *pMeta, const SMetaEntry *pME) {
goto
_exit
;
goto
_exit
;
}
}
t
CoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
pVal
,
vLen
,
TD_ENCODER
);
t
EncoderInit
(
&
coder
,
pVal
,
vLen
);
tEncodeSSchemaWrapper
(
&
coder
,
pSW
);
tEncodeSSchemaWrapper
(
&
coder
,
pSW
);
if
(
tdbDbInsert
(
pMeta
->
pSkmDb
,
&
skmDbKey
,
sizeof
(
skmDbKey
),
pVal
,
vLen
,
&
pMeta
->
txn
)
<
0
)
{
if
(
tdbDbInsert
(
pMeta
->
pSkmDb
,
&
skmDbKey
,
sizeof
(
skmDbKey
),
pVal
,
vLen
,
&
pMeta
->
txn
)
<
0
)
{
...
@@ -432,7 +431,7 @@ static int metaSaveToSkmDb(SMeta *pMeta, const SMetaEntry *pME) {
...
@@ -432,7 +431,7 @@ static int metaSaveToSkmDb(SMeta *pMeta, const SMetaEntry *pME) {
_exit:
_exit:
taosMemoryFree
(
pVal
);
taosMemoryFree
(
pVal
);
t
C
oderClear
(
&
coder
);
t
Enc
oderClear
(
&
coder
);
return
rcode
;
return
rcode
;
}
}
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
a06bf6e5
...
@@ -910,12 +910,12 @@ int32_t tqProcessTaskDeploy(STQ* pTq, char* msg, int32_t msgLen) {
...
@@ -910,12 +910,12 @@ int32_t tqProcessTaskDeploy(STQ* pTq, char* msg, int32_t msgLen) {
if
(
pTask
==
NULL
)
{
if
(
pTask
==
NULL
)
{
return
-
1
;
return
-
1
;
}
}
S
C
oder
decoder
;
S
Dec
oder
decoder
;
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
(
uint8_t
*
)
msg
,
msgLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
(
uint8_t
*
)
msg
,
msgLen
);
if
(
tDecodeSStreamTask
(
&
decoder
,
pTask
)
<
0
)
{
if
(
tDecodeSStreamTask
(
&
decoder
,
pTask
)
<
0
)
{
ASSERT
(
0
);
ASSERT
(
0
);
}
}
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
// exec
// exec
if
(
tqExpandTask
(
pTq
,
pTask
,
4
)
<
0
)
{
if
(
tqExpandTask
(
pTq
,
pTask
,
4
)
<
0
)
{
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable2.c
浏览文件 @
a06bf6e5
...
@@ -63,6 +63,8 @@ struct SMemSkipListCurosr {
...
@@ -63,6 +63,8 @@ struct SMemSkipListCurosr {
SMemSkipListNode
*
pNodeC
;
SMemSkipListNode
*
pNodeC
;
};
};
#define HASH_BUCKET(SUID, UID, NBUCKET) (TABS((SUID) + (UID)) % (NBUCKET))
#define SL_NODE_SIZE(l) (sizeof(SMemSkipListNode) + sizeof(SMemSkipListNode *) * (l)*2)
#define SL_NODE_SIZE(l) (sizeof(SMemSkipListNode) + sizeof(SMemSkipListNode *) * (l)*2)
#define SL_NODE_HALF_SIZE(l) (sizeof(SMemSkipListNode) + sizeof(SMemSkipListNode *) * (l))
#define SL_NODE_HALF_SIZE(l) (sizeof(SMemSkipListNode) + sizeof(SMemSkipListNode *) * (l))
#define SL_NODE_FORWARD(n, l) ((n)->forwards[l])
#define SL_NODE_FORWARD(n, l) ((n)->forwards[l])
...
@@ -71,6 +73,8 @@ struct SMemSkipListCurosr {
...
@@ -71,6 +73,8 @@ struct SMemSkipListCurosr {
#define SL_HEAD_NODE(sl) ((sl)->pHead)
#define SL_HEAD_NODE(sl) ((sl)->pHead)
#define SL_TAIL_NODE(sl) ((SMemSkipListNode *)&SL_NODE_FORWARD(SL_HEAD_NODE(sl), (sl)->maxLevel))
#define SL_TAIL_NODE(sl) ((SMemSkipListNode *)&SL_NODE_FORWARD(SL_HEAD_NODE(sl), (sl)->maxLevel))
#define SL_HEAD_NODE_FORWARD(n, l) SL_NODE_FORWARD(n, l)
#define SL_TAIL_NODE_BACKWARD(n, l) SL_NODE_FORWARD(n, l)
// SMemTable
// SMemTable
int32_t
tsdbMemTableCreate2
(
STsdb
*
pTsdb
,
SMemTable
**
ppMemTb
)
{
int32_t
tsdbMemTableCreate2
(
STsdb
*
pTsdb
,
SMemTable
**
ppMemTb
)
{
...
@@ -115,19 +119,14 @@ int32_t tsdbInsertData2(SMemTable *pMemTb, int64_t version, const SVSubmitBlk *p
...
@@ -115,19 +119,14 @@ int32_t tsdbInsertData2(SMemTable *pMemTb, int64_t version, const SVSubmitBlk *p
STsdb
*
pTsdb
=
pMemTb
->
pTsdb
;
STsdb
*
pTsdb
=
pMemTb
->
pTsdb
;
SVnode
*
pVnode
=
pTsdb
->
pVnode
;
SVnode
*
pVnode
=
pTsdb
->
pVnode
;
SVBufPool
*
pPool
=
pVnode
->
inUse
;
SVBufPool
*
pPool
=
pVnode
->
inUse
;
int32_t
hash
;
tb_uid_t
suid
=
pSubmitBlk
->
suid
;
int32_t
tlen
;
tb_uid_t
uid
=
pSubmitBlk
->
uid
;
uint8_t
buf
[
16
];
int32_t
iBucket
;
int32_t
rlen
;
const
uint8_t
*
p
;
// search SMemData by hash
SMemSkipListNode
*
pSlNode
;
iBucket
=
HASH_BUCKET
(
suid
,
uid
,
pMemTb
->
nBucket
);
const
STSRow
*
pTSRow
;
for
(
pMemData
=
pMemTb
->
pBuckets
[
iBucket
];
pMemData
;
pMemData
=
pMemData
->
pHashNext
)
{
SMemSkipListCurosr
slc
=
{
0
};
if
(
pMemData
->
suid
==
suid
&&
pMemData
->
uid
==
uid
)
break
;
// search hash
hash
=
(
pSubmitBlk
->
suid
+
pSubmitBlk
->
uid
)
%
pMemTb
->
nBucket
;
for
(
pMemData
=
pMemTb
->
pBuckets
[
hash
];
pMemData
;
pMemData
=
pMemData
->
pHashNext
)
{
if
(
pMemData
->
suid
==
pSubmitBlk
->
suid
&&
pMemData
->
uid
==
pSubmitBlk
->
uid
)
break
;
}
}
// create pMemData if need
// create pMemData if need
...
@@ -143,8 +142,8 @@ int32_t tsdbInsertData2(SMemTable *pMemTb, int64_t version, const SVSubmitBlk *p
...
@@ -143,8 +142,8 @@ int32_t tsdbInsertData2(SMemTable *pMemTb, int64_t version, const SVSubmitBlk *p
}
}
pMemData
->
pHashNext
=
NULL
;
pMemData
->
pHashNext
=
NULL
;
pMemData
->
suid
=
pSubmitBlk
->
suid
;
pMemData
->
suid
=
suid
;
pMemData
->
uid
=
pSubmitBlk
->
uid
;
pMemData
->
uid
=
uid
;
pMemData
->
minKey
=
TSKEY_MAX
;
pMemData
->
minKey
=
TSKEY_MAX
;
pMemData
->
maxKey
=
TSKEY_MIN
;
pMemData
->
maxKey
=
TSKEY_MIN
;
pMemData
->
minVer
=
-
1
;
pMemData
->
minVer
=
-
1
;
...
@@ -159,55 +158,67 @@ int32_t tsdbInsertData2(SMemTable *pMemTb, int64_t version, const SVSubmitBlk *p
...
@@ -159,55 +158,67 @@ int32_t tsdbInsertData2(SMemTable *pMemTb, int64_t version, const SVSubmitBlk *p
pHead
->
level
=
maxLevel
;
pHead
->
level
=
maxLevel
;
pTail
->
level
=
maxLevel
;
pTail
->
level
=
maxLevel
;
for
(
int
iLevel
=
0
;
iLevel
<
maxLevel
;
iLevel
++
)
{
for
(
int
iLevel
=
0
;
iLevel
<
maxLevel
;
iLevel
++
)
{
SL_NODE_FORWARD
(
pHead
,
iLevel
)
=
pTail
;
SL_
HEAD_
NODE_FORWARD
(
pHead
,
iLevel
)
=
pTail
;
SL_
NODE_FOR
WARD
(
pTail
,
iLevel
)
=
pHead
;
SL_
TAIL_NODE_BACK
WARD
(
pTail
,
iLevel
)
=
pHead
;
}
}
// add to MemTable
// add to hash
hash
=
(
pMemData
->
suid
+
pMemData
->
uid
)
%
pMemTb
->
nBucket
;
if
(
pMemTb
->
nHash
>=
pMemTb
->
nBucket
)
{
pMemData
->
pHashNext
=
pMemTb
->
pBuckets
[
hash
];
// rehash (todo)
pMemTb
->
pBuckets
[
hash
]
=
pMemData
;
}
iBucket
=
HASH_BUCKET
(
suid
,
uid
,
pMemTb
->
nBucket
);
pMemData
->
pHashNext
=
pMemTb
->
pBuckets
[
iBucket
];
pMemTb
->
pBuckets
[
iBucket
]
=
pMemData
;
pMemTb
->
nHash
++
;
pMemTb
->
nHash
++
;
// sort organize (todo)
}
}
// loop to insert data to skiplist
// do insert data to SMemData
#if 0
SMemSkipListCurosr
slc
=
{
0
};
tsdbMemSkipListCursorOpen(&slc, &pMemData->sl);
const
uint8_t
*
p
=
pSubmitBlk
->
pData
;
p = pSubmitBlk->pData;
const
uint8_t
*
pt
;
for (;;) {
const
STSRow
*
pRow
;
if (p - (uint8_t *)pSubmitBlk->pData >= pSubmitBlk->nData) break;
uint64_t
szRow
;
SDecoder
decoder
=
{
0
};
const uint8_t *pt = p;
// tCoderInit(&coder, TD_LITTLE_ENDIAN, pSubmitBlk->pData, pSubmitBlk->nData, TD_DECODER);
p = tGetBinary(p, &pTSRow, &rlen);
for
(;;)
{
// if (tDecodeIsEnd(&coder)) break;
// if (tDecodeBinary(&coder, (const uint8_t **)&pRow, &szRow) < 0) {
// terrno = TSDB_CODE_INVALID_MSG;
// return -1;
// }
// check the row (todo)
// check the row (todo)
// move the cursor to position to write (todo)
//
//
move the cursor to position to write (todo)
int32_t c;
//
int32_t c;
tsdbMemSkipListCursorMoveTo(&slc, pTSRow, version, &c);
//
tsdbMemSkipListCursorMoveTo(&slc, pTSRow, version, &c);
ASSERT(c);
//
ASSERT(c);
// encode row
//
//
encode row
int8_t level = tsdbMemSkipListRandLevel(&pMemData->sl);
//
int8_t level = tsdbMemSkipListRandLevel(&pMemData->sl);
int32_t tsize = SL_NODE_SIZE(level) + sizeof(version) + (p - pt);
//
int32_t tsize = SL_NODE_SIZE(level) + sizeof(version) + (p - pt);
pSlNode = vnodeBufPoolMalloc(pPool, tsize);
//
pSlNode = vnodeBufPoolMalloc(pPool, tsize);
pSlNode->level = level;
//
pSlNode->level = level;
uint8_t *pData = SL_NODE_DATA(pSlNode);
//
uint8_t *pData = SL_NODE_DATA(pSlNode);
*(int64_t *)pData = version;
//
*(int64_t *)pData = version;
pData += sizeof(version);
//
pData += sizeof(version);
memcpy(pData, pt, p - pt);
//
memcpy(pData, pt, p - pt);
// insert row
//
//
insert row
tsdbMemSkipListCursorPut(&slc, pSlNode);
//
tsdbMemSkipListCursorPut(&slc, pSlNode);
// update status
// update status
if (p
TSRow->ts < pMemData->minKey) pMemData->minKey = pTS
Row->ts;
if
(
p
Row
->
ts
<
pMemData
->
minKey
)
pMemData
->
minKey
=
p
Row
->
ts
;
if (p
TSRow->ts > pMemData->maxKey) pMemData->maxKey = pTS
Row->ts;
if
(
p
Row
->
ts
>
pMemData
->
maxKey
)
pMemData
->
maxKey
=
p
Row
->
ts
;
}
}
tsdbMemSkipListCursorClose(&slc
);
// tCoderClear(&coder
);
#endif
// tsdbMemSkipListCursorClose(&slc);
// update status
if
(
pMemData
->
minVer
==
-
1
)
pMemData
->
minVer
=
version
;
if
(
pMemData
->
minVer
==
-
1
)
pMemData
->
minVer
=
version
;
if
(
pMemData
->
maxVer
==
-
1
||
pMemData
->
maxVer
<
version
)
pMemData
->
maxVer
=
version
;
if
(
pMemData
->
maxVer
==
-
1
||
pMemData
->
maxVer
<
version
)
pMemData
->
maxVer
=
version
;
...
@@ -218,7 +229,3 @@ int32_t tsdbInsertData2(SMemTable *pMemTb, int64_t version, const SVSubmitBlk *p
...
@@ -218,7 +229,3 @@ int32_t tsdbInsertData2(SMemTable *pMemTb, int64_t version, const SVSubmitBlk *p
return
0
;
return
0
;
}
}
\ No newline at end of file
// SMemData
// SMemSkipList
\ No newline at end of file
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
a06bf6e5
...
@@ -286,7 +286,7 @@ int vnodeProcessSyncReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
...
@@ -286,7 +286,7 @@ int vnodeProcessSyncReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
static
int
vnodeProcessCreateStbReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int
len
,
SRpcMsg
*
pRsp
)
{
static
int
vnodeProcessCreateStbReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int
len
,
SRpcMsg
*
pRsp
)
{
SVCreateStbReq
req
=
{
0
};
SVCreateStbReq
req
=
{
0
};
S
Coder
coder
;
S
Decoder
coder
;
pRsp
->
msgType
=
TDMT_VND_CREATE_STB_RSP
;
pRsp
->
msgType
=
TDMT_VND_CREATE_STB_RSP
;
pRsp
->
code
=
TSDB_CODE_SUCCESS
;
pRsp
->
code
=
TSDB_CODE_SUCCESS
;
...
@@ -294,7 +294,7 @@ static int vnodeProcessCreateStbReq(SVnode *pVnode, int64_t version, void *pReq,
...
@@ -294,7 +294,7 @@ static int vnodeProcessCreateStbReq(SVnode *pVnode, int64_t version, void *pReq,
pRsp
->
contLen
=
0
;
pRsp
->
contLen
=
0
;
// decode and process req
// decode and process req
t
CoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
pReq
,
len
,
TD_DECODER
);
t
DecoderInit
(
&
coder
,
pReq
,
len
);
if
(
tDecodeSVCreateStbReq
(
&
coder
,
&
req
)
<
0
)
{
if
(
tDecodeSVCreateStbReq
(
&
coder
,
&
req
)
<
0
)
{
pRsp
->
code
=
terrno
;
pRsp
->
code
=
terrno
;
...
@@ -308,16 +308,16 @@ static int vnodeProcessCreateStbReq(SVnode *pVnode, int64_t version, void *pReq,
...
@@ -308,16 +308,16 @@ static int vnodeProcessCreateStbReq(SVnode *pVnode, int64_t version, void *pReq,
tsdbRegisterRSma
(
pVnode
->
pTsdb
,
pVnode
->
pMeta
,
&
req
);
tsdbRegisterRSma
(
pVnode
->
pTsdb
,
pVnode
->
pMeta
,
&
req
);
t
C
oderClear
(
&
coder
);
t
Dec
oderClear
(
&
coder
);
return
0
;
return
0
;
_err:
_err:
t
C
oderClear
(
&
coder
);
t
Dec
oderClear
(
&
coder
);
return
-
1
;
return
-
1
;
}
}
static
int
vnodeProcessCreateTbReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int
len
,
SRpcMsg
*
pRsp
)
{
static
int
vnodeProcessCreateTbReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int
len
,
SRpcMsg
*
pRsp
)
{
S
Coder
coder
=
{
0
};
S
Decoder
de
coder
=
{
0
};
int
rcode
=
0
;
int
rcode
=
0
;
SVCreateTbBatchReq
req
=
{
0
};
SVCreateTbBatchReq
req
=
{
0
};
SVCreateTbReq
*
pCreateReq
;
SVCreateTbReq
*
pCreateReq
;
...
@@ -332,8 +332,8 @@ static int vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pReq,
...
@@ -332,8 +332,8 @@ static int vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pReq,
pRsp
->
contLen
=
0
;
pRsp
->
contLen
=
0
;
// decode
// decode
t
CoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
pReq
,
len
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
pReq
,
len
);
if
(
tDecodeSVCreateTbBatchReq
(
&
coder
,
&
req
)
<
0
)
{
if
(
tDecodeSVCreateTbBatchReq
(
&
de
coder
,
&
req
)
<
0
)
{
rcode
=
-
1
;
rcode
=
-
1
;
terrno
=
TSDB_CODE_INVALID_MSG
;
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_exit
;
goto
_exit
;
...
@@ -373,12 +373,13 @@ static int vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pReq,
...
@@ -373,12 +373,13 @@ static int vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pReq,
taosArrayPush
(
rsp
.
pArray
,
&
cRsp
);
taosArrayPush
(
rsp
.
pArray
,
&
cRsp
);
}
}
t
CoderClear
(
&
coder
);
t
DecoderClear
(
&
de
coder
);
tsdbUpdateTbUidList
(
pVnode
->
pTsdb
,
pStore
);
tsdbUpdateTbUidList
(
pVnode
->
pTsdb
,
pStore
);
tsdbUidStoreFree
(
pStore
);
tsdbUidStoreFree
(
pStore
);
// prepare rsp
// prepare rsp
SEncoder
encoder
=
{
0
};
int32_t
ret
=
0
;
int32_t
ret
=
0
;
tEncodeSize
(
tEncodeSVCreateTbBatchRsp
,
&
rsp
,
pRsp
->
contLen
,
ret
);
tEncodeSize
(
tEncodeSVCreateTbBatchRsp
,
&
rsp
,
pRsp
->
contLen
,
ret
);
pRsp
->
pCont
=
rpcMallocCont
(
pRsp
->
contLen
);
pRsp
->
pCont
=
rpcMallocCont
(
pRsp
->
contLen
);
...
@@ -387,12 +388,14 @@ static int vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pReq,
...
@@ -387,12 +388,14 @@ static int vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pReq,
rcode
=
-
1
;
rcode
=
-
1
;
goto
_exit
;
goto
_exit
;
}
}
tCoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
pRsp
->
pCont
,
pRsp
->
contLen
,
TD_ENCODER
);
tEncoderInit
(
&
encoder
,
pRsp
->
pCont
,
pRsp
->
contLen
);
tEncodeSVCreateTbBatchRsp
(
&
coder
,
&
rsp
);
tEncodeSVCreateTbBatchRsp
(
&
encoder
,
&
rsp
);
tEncoderClear
(
&
encoder
);
_exit:
_exit:
taosArrayClear
(
rsp
.
pArray
);
taosArrayClear
(
rsp
.
pArray
);
tCoderClear
(
&
coder
);
tDecoderClear
(
&
decoder
);
tEncoderClear
(
&
encoder
);
return
rcode
;
return
rcode
;
}
}
...
@@ -416,15 +419,15 @@ static int vnodeProcessAlterStbReq(SVnode *pVnode, void *pReq, int32_t len, SRpc
...
@@ -416,15 +419,15 @@ static int vnodeProcessAlterStbReq(SVnode *pVnode, void *pReq, int32_t len, SRpc
static
int
vnodeProcessDropStbReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
)
{
static
int
vnodeProcessDropStbReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
)
{
SVDropStbReq
req
=
{
0
};
SVDropStbReq
req
=
{
0
};
int
rcode
=
TSDB_CODE_SUCCESS
;
int
rcode
=
TSDB_CODE_SUCCESS
;
S
Coder
coder
=
{
0
};
S
Decoder
de
coder
=
{
0
};
pRsp
->
msgType
=
TDMT_VND_CREATE_STB_RSP
;
pRsp
->
msgType
=
TDMT_VND_CREATE_STB_RSP
;
pRsp
->
pCont
=
NULL
;
pRsp
->
pCont
=
NULL
;
pRsp
->
contLen
=
0
;
pRsp
->
contLen
=
0
;
// decode request
// decode request
t
CoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
pReq
,
len
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
pReq
,
len
);
if
(
tDecodeSVDropStbReq
(
&
coder
,
&
req
)
<
0
)
{
if
(
tDecodeSVDropStbReq
(
&
de
coder
,
&
req
)
<
0
)
{
rcode
=
TSDB_CODE_INVALID_MSG
;
rcode
=
TSDB_CODE_INVALID_MSG
;
goto
_exit
;
goto
_exit
;
}
}
...
@@ -438,7 +441,7 @@ static int vnodeProcessDropStbReq(SVnode *pVnode, int64_t version, void *pReq, i
...
@@ -438,7 +441,7 @@ static int vnodeProcessDropStbReq(SVnode *pVnode, int64_t version, void *pReq, i
// return rsp
// return rsp
_exit:
_exit:
pRsp
->
code
=
rcode
;
pRsp
->
code
=
rcode
;
t
CoderClear
(
&
coder
);
t
DecoderClear
(
&
de
coder
);
return
0
;
return
0
;
}
}
...
@@ -451,7 +454,7 @@ static int vnodeProcessAlterTbReq(SVnode *pVnode, void *pReq, int32_t len, SRpcM
...
@@ -451,7 +454,7 @@ static int vnodeProcessAlterTbReq(SVnode *pVnode, void *pReq, int32_t len, SRpcM
static
int
vnodeProcessDropTbReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
)
{
static
int
vnodeProcessDropTbReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
)
{
SVDropTbBatchReq
req
=
{
0
};
SVDropTbBatchReq
req
=
{
0
};
SVDropTbBatchRsp
rsp
=
{
0
};
SVDropTbBatchRsp
rsp
=
{
0
};
S
Coder
coder
=
{
0
};
S
Decoder
de
coder
=
{
0
};
int
ret
;
int
ret
;
pRsp
->
msgType
=
TDMT_VND_DROP_TABLE_RSP
;
pRsp
->
msgType
=
TDMT_VND_DROP_TABLE_RSP
;
...
@@ -460,8 +463,8 @@ static int vnodeProcessDropTbReq(SVnode *pVnode, int64_t version, void *pReq, in
...
@@ -460,8 +463,8 @@ static int vnodeProcessDropTbReq(SVnode *pVnode, int64_t version, void *pReq, in
pRsp
->
code
=
TSDB_CODE_SUCCESS
;
pRsp
->
code
=
TSDB_CODE_SUCCESS
;
// decode req
// decode req
t
CoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
pReq
,
len
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
pReq
,
len
);
ret
=
tDecodeSVDropTbBatchReq
(
&
coder
,
&
req
);
ret
=
tDecodeSVDropTbBatchReq
(
&
de
coder
,
&
req
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
terrno
=
TSDB_CODE_INVALID_MSG
;
pRsp
->
code
=
terrno
;
pRsp
->
code
=
terrno
;
...
@@ -490,7 +493,7 @@ static int vnodeProcessDropTbReq(SVnode *pVnode, int64_t version, void *pReq, in
...
@@ -490,7 +493,7 @@ static int vnodeProcessDropTbReq(SVnode *pVnode, int64_t version, void *pReq, in
}
}
_exit:
_exit:
t
CoderClear
(
&
coder
);
t
DecoderClear
(
&
de
coder
);
// encode rsp (TODO)
// encode rsp (TODO)
return
0
;
return
0
;
}
}
...
@@ -501,7 +504,7 @@ static int vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq, in
...
@@ -501,7 +504,7 @@ static int vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq, in
SSubmitBlk
*
pBlock
;
SSubmitBlk
*
pBlock
;
SSubmitRsp
rsp
=
{
0
};
SSubmitRsp
rsp
=
{
0
};
SVCreateTbReq
createTbReq
=
{
0
};
SVCreateTbReq
createTbReq
=
{
0
};
S
Coder
coder
=
{
0
};
S
Decoder
de
coder
=
{
0
};
int32_t
nRows
;
int32_t
nRows
;
pRsp
->
code
=
0
;
pRsp
->
code
=
0
;
...
@@ -518,17 +521,17 @@ static int vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq, in
...
@@ -518,17 +521,17 @@ static int vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq, in
// create table for auto create table mode
// create table for auto create table mode
if
(
msgIter
.
schemaLen
>
0
)
{
if
(
msgIter
.
schemaLen
>
0
)
{
t
CoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
pBlock
->
data
,
msgIter
.
schemaLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
pBlock
->
data
,
msgIter
.
schemaLen
);
if
(
tDecodeSVCreateTbReq
(
&
coder
,
&
createTbReq
)
<
0
)
{
if
(
tDecodeSVCreateTbReq
(
&
de
coder
,
&
createTbReq
)
<
0
)
{
pRsp
->
code
=
TSDB_CODE_INVALID_MSG
;
pRsp
->
code
=
TSDB_CODE_INVALID_MSG
;
t
CoderClear
(
&
coder
);
t
DecoderClear
(
&
de
coder
);
goto
_exit
;
goto
_exit
;
}
}
if
(
metaCreateTable
(
pVnode
->
pMeta
,
version
,
&
createTbReq
)
<
0
)
{
if
(
metaCreateTable
(
pVnode
->
pMeta
,
version
,
&
createTbReq
)
<
0
)
{
if
(
terrno
!=
TSDB_CODE_TDB_TABLE_ALREADY_EXIST
)
{
if
(
terrno
!=
TSDB_CODE_TDB_TABLE_ALREADY_EXIST
)
{
pRsp
->
code
=
terrno
;
pRsp
->
code
=
terrno
;
t
CoderClear
(
&
coder
);
t
DecoderClear
(
&
de
coder
);
goto
_exit
;
goto
_exit
;
}
}
}
}
...
@@ -540,7 +543,7 @@ static int vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq, in
...
@@ -540,7 +543,7 @@ static int vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq, in
msgIter
.
suid
=
0
;
msgIter
.
suid
=
0
;
}
}
t
CoderClear
(
&
coder
);
t
DecoderClear
(
&
de
coder
);
}
}
if
(
tsdbInsertTableData
(
pVnode
->
pTsdb
,
&
msgIter
,
pBlock
,
&
nRows
)
<
0
)
{
if
(
tsdbInsertTableData
(
pVnode
->
pTsdb
,
&
msgIter
,
pBlock
,
&
nRows
)
<
0
)
{
...
...
source/libs/executor/CMakeLists.txt
浏览文件 @
a06bf6e5
...
@@ -17,6 +17,6 @@ target_include_directories(
...
@@ -17,6 +17,6 @@ target_include_directories(
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
)
#
if(${BUILD_TEST})
if
(
${
BUILD_TEST
}
)
ADD_SUBDIRECTORY
(
test
)
ADD_SUBDIRECTORY
(
test
)
#
endif(${BUILD_TEST})
endif
(
${
BUILD_TEST
}
)
source/libs/monitor/src/monMsg.c
浏览文件 @
a06bf6e5
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
#include "tcoding.h"
#include "tcoding.h"
#include "tencode.h"
#include "tencode.h"
static
int32_t
tEncodeSMonSysInfo
(
S
C
oder
*
encoder
,
const
SMonSysInfo
*
pInfo
)
{
static
int32_t
tEncodeSMonSysInfo
(
S
Enc
oder
*
encoder
,
const
SMonSysInfo
*
pInfo
)
{
if
(
tEncodeDouble
(
encoder
,
pInfo
->
cpu_engine
)
<
0
)
return
-
1
;
if
(
tEncodeDouble
(
encoder
,
pInfo
->
cpu_engine
)
<
0
)
return
-
1
;
if
(
tEncodeDouble
(
encoder
,
pInfo
->
cpu_system
)
<
0
)
return
-
1
;
if
(
tEncodeDouble
(
encoder
,
pInfo
->
cpu_system
)
<
0
)
return
-
1
;
if
(
tEncodeFloat
(
encoder
,
pInfo
->
cpu_cores
)
<
0
)
return
-
1
;
if
(
tEncodeFloat
(
encoder
,
pInfo
->
cpu_cores
)
<
0
)
return
-
1
;
...
@@ -37,7 +37,7 @@ static int32_t tEncodeSMonSysInfo(SCoder *encoder, const SMonSysInfo *pInfo) {
...
@@ -37,7 +37,7 @@ static int32_t tEncodeSMonSysInfo(SCoder *encoder, const SMonSysInfo *pInfo) {
return
0
;
return
0
;
}
}
static
int32_t
tDecodeSMonSysInfo
(
S
C
oder
*
decoder
,
SMonSysInfo
*
pInfo
)
{
static
int32_t
tDecodeSMonSysInfo
(
S
Dec
oder
*
decoder
,
SMonSysInfo
*
pInfo
)
{
if
(
tDecodeDouble
(
decoder
,
&
pInfo
->
cpu_engine
)
<
0
)
return
-
1
;
if
(
tDecodeDouble
(
decoder
,
&
pInfo
->
cpu_engine
)
<
0
)
return
-
1
;
if
(
tDecodeDouble
(
decoder
,
&
pInfo
->
cpu_system
)
<
0
)
return
-
1
;
if
(
tDecodeDouble
(
decoder
,
&
pInfo
->
cpu_system
)
<
0
)
return
-
1
;
if
(
tDecodeFloat
(
decoder
,
&
pInfo
->
cpu_cores
)
<
0
)
return
-
1
;
if
(
tDecodeFloat
(
decoder
,
&
pInfo
->
cpu_cores
)
<
0
)
return
-
1
;
...
@@ -56,7 +56,7 @@ static int32_t tDecodeSMonSysInfo(SCoder *decoder, SMonSysInfo *pInfo) {
...
@@ -56,7 +56,7 @@ static int32_t tDecodeSMonSysInfo(SCoder *decoder, SMonSysInfo *pInfo) {
return
0
;
return
0
;
}
}
int32_t
tEncodeSMonLogs
(
S
C
oder
*
encoder
,
const
SMonLogs
*
pInfo
)
{
int32_t
tEncodeSMonLogs
(
S
Enc
oder
*
encoder
,
const
SMonLogs
*
pInfo
)
{
if
(
tEncodeI32
(
encoder
,
pInfo
->
numOfErrorLogs
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
encoder
,
pInfo
->
numOfErrorLogs
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
encoder
,
pInfo
->
numOfInfoLogs
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
encoder
,
pInfo
->
numOfInfoLogs
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
encoder
,
pInfo
->
numOfDebugLogs
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
encoder
,
pInfo
->
numOfDebugLogs
)
<
0
)
return
-
1
;
...
@@ -71,7 +71,7 @@ int32_t tEncodeSMonLogs(SCoder *encoder, const SMonLogs *pInfo) {
...
@@ -71,7 +71,7 @@ int32_t tEncodeSMonLogs(SCoder *encoder, const SMonLogs *pInfo) {
return
0
;
return
0
;
}
}
static
int32_t
tDecodeSMonLogs
(
S
C
oder
*
decoder
,
SMonLogs
*
pInfo
)
{
static
int32_t
tDecodeSMonLogs
(
S
Dec
oder
*
decoder
,
SMonLogs
*
pInfo
)
{
if
(
tDecodeI32
(
decoder
,
&
pInfo
->
numOfErrorLogs
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
decoder
,
&
pInfo
->
numOfErrorLogs
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
decoder
,
&
pInfo
->
numOfInfoLogs
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
decoder
,
&
pInfo
->
numOfInfoLogs
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
decoder
,
&
pInfo
->
numOfDebugLogs
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
decoder
,
&
pInfo
->
numOfDebugLogs
)
<
0
)
return
-
1
;
...
@@ -96,7 +96,7 @@ static int32_t tDecodeSMonLogs(SCoder *decoder, SMonLogs *pInfo) {
...
@@ -96,7 +96,7 @@ static int32_t tDecodeSMonLogs(SCoder *decoder, SMonLogs *pInfo) {
return
0
;
return
0
;
}
}
int32_t
tEncodeSMonClusterInfo
(
S
C
oder
*
encoder
,
const
SMonClusterInfo
*
pInfo
)
{
int32_t
tEncodeSMonClusterInfo
(
S
Enc
oder
*
encoder
,
const
SMonClusterInfo
*
pInfo
)
{
if
(
tEncodeCStr
(
encoder
,
pInfo
->
first_ep
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
encoder
,
pInfo
->
first_ep
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
encoder
,
pInfo
->
first_ep_dnode_id
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
encoder
,
pInfo
->
first_ep_dnode_id
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
encoder
,
pInfo
->
version
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
encoder
,
pInfo
->
version
)
<
0
)
return
-
1
;
...
@@ -124,7 +124,7 @@ int32_t tEncodeSMonClusterInfo(SCoder *encoder, const SMonClusterInfo *pInfo) {
...
@@ -124,7 +124,7 @@ int32_t tEncodeSMonClusterInfo(SCoder *encoder, const SMonClusterInfo *pInfo) {
return
0
;
return
0
;
}
}
int32_t
tDecodeSMonClusterInfo
(
S
C
oder
*
decoder
,
SMonClusterInfo
*
pInfo
)
{
int32_t
tDecodeSMonClusterInfo
(
S
Dec
oder
*
decoder
,
SMonClusterInfo
*
pInfo
)
{
if
(
tDecodeCStrTo
(
decoder
,
pInfo
->
first_ep
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
decoder
,
pInfo
->
first_ep
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
decoder
,
&
pInfo
->
first_ep_dnode_id
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
decoder
,
&
pInfo
->
first_ep_dnode_id
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
decoder
,
pInfo
->
version
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
decoder
,
pInfo
->
version
)
<
0
)
return
-
1
;
...
@@ -163,7 +163,7 @@ int32_t tDecodeSMonClusterInfo(SCoder *decoder, SMonClusterInfo *pInfo) {
...
@@ -163,7 +163,7 @@ int32_t tDecodeSMonClusterInfo(SCoder *decoder, SMonClusterInfo *pInfo) {
return
0
;
return
0
;
}
}
int32_t
tEncodeSMonVgroupInfo
(
S
C
oder
*
encoder
,
const
SMonVgroupInfo
*
pInfo
)
{
int32_t
tEncodeSMonVgroupInfo
(
S
Enc
oder
*
encoder
,
const
SMonVgroupInfo
*
pInfo
)
{
if
(
tEncodeI32
(
encoder
,
taosArrayGetSize
(
pInfo
->
vgroups
))
<
0
)
return
-
1
;
if
(
tEncodeI32
(
encoder
,
taosArrayGetSize
(
pInfo
->
vgroups
))
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pInfo
->
vgroups
);
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pInfo
->
vgroups
);
++
i
)
{
SMonVgroupDesc
*
pDesc
=
taosArrayGet
(
pInfo
->
vgroups
,
i
);
SMonVgroupDesc
*
pDesc
=
taosArrayGet
(
pInfo
->
vgroups
,
i
);
...
@@ -180,7 +180,7 @@ int32_t tEncodeSMonVgroupInfo(SCoder *encoder, const SMonVgroupInfo *pInfo) {
...
@@ -180,7 +180,7 @@ int32_t tEncodeSMonVgroupInfo(SCoder *encoder, const SMonVgroupInfo *pInfo) {
return
0
;
return
0
;
}
}
int32_t
tDecodeSMonVgroupInfo
(
S
C
oder
*
decoder
,
SMonVgroupInfo
*
pInfo
)
{
int32_t
tDecodeSMonVgroupInfo
(
S
Dec
oder
*
decoder
,
SMonVgroupInfo
*
pInfo
)
{
int32_t
arraySize
=
0
;
int32_t
arraySize
=
0
;
if
(
tDecodeI32
(
decoder
,
&
arraySize
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
decoder
,
&
arraySize
)
<
0
)
return
-
1
;
...
@@ -203,14 +203,14 @@ int32_t tDecodeSMonVgroupInfo(SCoder *decoder, SMonVgroupInfo *pInfo) {
...
@@ -203,14 +203,14 @@ int32_t tDecodeSMonVgroupInfo(SCoder *decoder, SMonVgroupInfo *pInfo) {
return
0
;
return
0
;
}
}
int32_t
tEncodeSMonGrantInfo
(
S
C
oder
*
encoder
,
const
SMonGrantInfo
*
pInfo
)
{
int32_t
tEncodeSMonGrantInfo
(
S
Enc
oder
*
encoder
,
const
SMonGrantInfo
*
pInfo
)
{
if
(
tEncodeI32
(
encoder
,
pInfo
->
expire_time
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
encoder
,
pInfo
->
expire_time
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
encoder
,
pInfo
->
timeseries_used
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
encoder
,
pInfo
->
timeseries_used
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
encoder
,
pInfo
->
timeseries_total
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
encoder
,
pInfo
->
timeseries_total
)
<
0
)
return
-
1
;
return
0
;
return
0
;
}
}
int32_t
tDecodeSMonGrantInfo
(
S
C
oder
*
decoder
,
SMonGrantInfo
*
pInfo
)
{
int32_t
tDecodeSMonGrantInfo
(
S
Dec
oder
*
decoder
,
SMonGrantInfo
*
pInfo
)
{
if
(
tDecodeI32
(
decoder
,
&
pInfo
->
expire_time
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
decoder
,
&
pInfo
->
expire_time
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
decoder
,
&
pInfo
->
timeseries_used
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
decoder
,
&
pInfo
->
timeseries_used
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
decoder
,
&
pInfo
->
timeseries_total
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
decoder
,
&
pInfo
->
timeseries_total
)
<
0
)
return
-
1
;
...
@@ -218,8 +218,8 @@ int32_t tDecodeSMonGrantInfo(SCoder *decoder, SMonGrantInfo *pInfo) {
...
@@ -218,8 +218,8 @@ int32_t tDecodeSMonGrantInfo(SCoder *decoder, SMonGrantInfo *pInfo) {
}
}
int32_t
tSerializeSMonMmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonMmInfo
*
pInfo
)
{
int32_t
tSerializeSMonMmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonMmInfo
*
pInfo
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeSMonClusterInfo
(
&
encoder
,
&
pInfo
->
cluster
)
<
0
)
return
-
1
;
if
(
tEncodeSMonClusterInfo
(
&
encoder
,
&
pInfo
->
cluster
)
<
0
)
return
-
1
;
...
@@ -230,13 +230,13 @@ int32_t tSerializeSMonMmInfo(void *buf, int32_t bufLen, SMonMmInfo *pInfo) {
...
@@ -230,13 +230,13 @@ int32_t tSerializeSMonMmInfo(void *buf, int32_t bufLen, SMonMmInfo *pInfo) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSMonMmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonMmInfo
*
pInfo
)
{
int32_t
tDeserializeSMonMmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonMmInfo
*
pInfo
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeSMonClusterInfo
(
&
decoder
,
&
pInfo
->
cluster
)
<
0
)
return
-
1
;
if
(
tDecodeSMonClusterInfo
(
&
decoder
,
&
pInfo
->
cluster
)
<
0
)
return
-
1
;
...
@@ -246,7 +246,7 @@ int32_t tDeserializeSMonMmInfo(void *buf, int32_t bufLen, SMonMmInfo *pInfo) {
...
@@ -246,7 +246,7 @@ int32_t tDeserializeSMonMmInfo(void *buf, int32_t bufLen, SMonMmInfo *pInfo) {
if
(
tDecodeSMonLogs
(
&
decoder
,
&
pInfo
->
log
)
<
0
)
return
-
1
;
if
(
tDecodeSMonLogs
(
&
decoder
,
&
pInfo
->
log
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -261,7 +261,7 @@ void tFreeSMonMmInfo(SMonMmInfo *pInfo) {
...
@@ -261,7 +261,7 @@ void tFreeSMonMmInfo(SMonMmInfo *pInfo) {
pInfo
->
log
.
logs
=
NULL
;
pInfo
->
log
.
logs
=
NULL
;
}
}
int32_t
tEncodeSMonDiskDesc
(
S
C
oder
*
encoder
,
const
SMonDiskDesc
*
pDesc
)
{
int32_t
tEncodeSMonDiskDesc
(
S
Enc
oder
*
encoder
,
const
SMonDiskDesc
*
pDesc
)
{
if
(
tEncodeCStr
(
encoder
,
pDesc
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
encoder
,
pDesc
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
encoder
,
pDesc
->
level
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
encoder
,
pDesc
->
level
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
encoder
,
pDesc
->
size
.
total
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
encoder
,
pDesc
->
size
.
total
)
<
0
)
return
-
1
;
...
@@ -270,7 +270,7 @@ int32_t tEncodeSMonDiskDesc(SCoder *encoder, const SMonDiskDesc *pDesc) {
...
@@ -270,7 +270,7 @@ int32_t tEncodeSMonDiskDesc(SCoder *encoder, const SMonDiskDesc *pDesc) {
return
0
;
return
0
;
}
}
static
int32_t
tDecodeSMonDiskDesc
(
S
C
oder
*
decoder
,
SMonDiskDesc
*
pDesc
)
{
static
int32_t
tDecodeSMonDiskDesc
(
S
Dec
oder
*
decoder
,
SMonDiskDesc
*
pDesc
)
{
if
(
tDecodeCStrTo
(
decoder
,
pDesc
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
decoder
,
pDesc
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
decoder
,
&
pDesc
->
level
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
decoder
,
&
pDesc
->
level
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
decoder
,
&
pDesc
->
size
.
total
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
decoder
,
&
pDesc
->
size
.
total
)
<
0
)
return
-
1
;
...
@@ -279,7 +279,7 @@ static int32_t tDecodeSMonDiskDesc(SCoder *decoder, SMonDiskDesc *pDesc) {
...
@@ -279,7 +279,7 @@ static int32_t tDecodeSMonDiskDesc(SCoder *decoder, SMonDiskDesc *pDesc) {
return
0
;
return
0
;
}
}
int32_t
tEncodeSMonDiskInfo
(
S
C
oder
*
encoder
,
const
SMonDiskInfo
*
pInfo
)
{
int32_t
tEncodeSMonDiskInfo
(
S
Enc
oder
*
encoder
,
const
SMonDiskInfo
*
pInfo
)
{
if
(
tEncodeI32
(
encoder
,
taosArrayGetSize
(
pInfo
->
datadirs
))
<
0
)
return
-
1
;
if
(
tEncodeI32
(
encoder
,
taosArrayGetSize
(
pInfo
->
datadirs
))
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pInfo
->
datadirs
);
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pInfo
->
datadirs
);
++
i
)
{
SMonDiskDesc
*
pDesc
=
taosArrayGet
(
pInfo
->
datadirs
,
i
);
SMonDiskDesc
*
pDesc
=
taosArrayGet
(
pInfo
->
datadirs
,
i
);
...
@@ -288,7 +288,7 @@ int32_t tEncodeSMonDiskInfo(SCoder *encoder, const SMonDiskInfo *pInfo) {
...
@@ -288,7 +288,7 @@ int32_t tEncodeSMonDiskInfo(SCoder *encoder, const SMonDiskInfo *pInfo) {
return
0
;
return
0
;
}
}
static
int32_t
tDecodeSMonDiskInfo
(
S
C
oder
*
decoder
,
SMonDiskInfo
*
pInfo
)
{
static
int32_t
tDecodeSMonDiskInfo
(
S
Dec
oder
*
decoder
,
SMonDiskInfo
*
pInfo
)
{
int32_t
arraySize
=
0
;
int32_t
arraySize
=
0
;
if
(
tDecodeI32
(
decoder
,
&
arraySize
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
decoder
,
&
arraySize
)
<
0
)
return
-
1
;
...
@@ -304,7 +304,7 @@ static int32_t tDecodeSMonDiskInfo(SCoder *decoder, SMonDiskInfo *pInfo) {
...
@@ -304,7 +304,7 @@ static int32_t tDecodeSMonDiskInfo(SCoder *decoder, SMonDiskInfo *pInfo) {
return
0
;
return
0
;
}
}
int32_t
tEncodeSVnodesStat
(
S
C
oder
*
encoder
,
const
SVnodesStat
*
pStat
)
{
int32_t
tEncodeSVnodesStat
(
S
Enc
oder
*
encoder
,
const
SVnodesStat
*
pStat
)
{
if
(
tEncodeI32
(
encoder
,
pStat
->
openVnodes
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
encoder
,
pStat
->
openVnodes
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
encoder
,
pStat
->
totalVnodes
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
encoder
,
pStat
->
totalVnodes
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
encoder
,
pStat
->
masterNum
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
encoder
,
pStat
->
masterNum
)
<
0
)
return
-
1
;
...
@@ -317,7 +317,7 @@ int32_t tEncodeSVnodesStat(SCoder *encoder, const SVnodesStat *pStat) {
...
@@ -317,7 +317,7 @@ int32_t tEncodeSVnodesStat(SCoder *encoder, const SVnodesStat *pStat) {
return
0
;
return
0
;
}
}
static
int32_t
tDecodeSVnodesStat
(
S
C
oder
*
decoder
,
SVnodesStat
*
pStat
)
{
static
int32_t
tDecodeSVnodesStat
(
S
Dec
oder
*
decoder
,
SVnodesStat
*
pStat
)
{
if
(
tDecodeI32
(
decoder
,
&
pStat
->
openVnodes
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
decoder
,
&
pStat
->
openVnodes
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
decoder
,
&
pStat
->
totalVnodes
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
decoder
,
&
pStat
->
totalVnodes
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
decoder
,
&
pStat
->
masterNum
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
decoder
,
&
pStat
->
masterNum
)
<
0
)
return
-
1
;
...
@@ -331,8 +331,8 @@ static int32_t tDecodeSVnodesStat(SCoder *decoder, SVnodesStat *pStat) {
...
@@ -331,8 +331,8 @@ static int32_t tDecodeSVnodesStat(SCoder *decoder, SVnodesStat *pStat) {
}
}
int32_t
tSerializeSMonVmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonVmInfo
*
pInfo
)
{
int32_t
tSerializeSMonVmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonVmInfo
*
pInfo
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeSMonDiskInfo
(
&
encoder
,
&
pInfo
->
tfs
)
<
0
)
return
-
1
;
if
(
tEncodeSMonDiskInfo
(
&
encoder
,
&
pInfo
->
tfs
)
<
0
)
return
-
1
;
...
@@ -342,13 +342,13 @@ int32_t tSerializeSMonVmInfo(void *buf, int32_t bufLen, SMonVmInfo *pInfo) {
...
@@ -342,13 +342,13 @@ int32_t tSerializeSMonVmInfo(void *buf, int32_t bufLen, SMonVmInfo *pInfo) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSMonVmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonVmInfo
*
pInfo
)
{
int32_t
tDeserializeSMonVmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonVmInfo
*
pInfo
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeSMonDiskInfo
(
&
decoder
,
&
pInfo
->
tfs
)
<
0
)
return
-
1
;
if
(
tDecodeSMonDiskInfo
(
&
decoder
,
&
pInfo
->
tfs
)
<
0
)
return
-
1
;
...
@@ -357,7 +357,7 @@ int32_t tDeserializeSMonVmInfo(void *buf, int32_t bufLen, SMonVmInfo *pInfo) {
...
@@ -357,7 +357,7 @@ int32_t tDeserializeSMonVmInfo(void *buf, int32_t bufLen, SMonVmInfo *pInfo) {
if
(
tDecodeSMonLogs
(
&
decoder
,
&
pInfo
->
log
)
<
0
)
return
-
1
;
if
(
tDecodeSMonLogs
(
&
decoder
,
&
pInfo
->
log
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -369,8 +369,8 @@ void tFreeSMonVmInfo(SMonVmInfo *pInfo) {
...
@@ -369,8 +369,8 @@ void tFreeSMonVmInfo(SMonVmInfo *pInfo) {
}
}
int32_t
tSerializeSMonQmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonQmInfo
*
pInfo
)
{
int32_t
tSerializeSMonQmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonQmInfo
*
pInfo
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeSMonSysInfo
(
&
encoder
,
&
pInfo
->
sys
)
<
0
)
return
-
1
;
if
(
tEncodeSMonSysInfo
(
&
encoder
,
&
pInfo
->
sys
)
<
0
)
return
-
1
;
...
@@ -378,20 +378,20 @@ int32_t tSerializeSMonQmInfo(void *buf, int32_t bufLen, SMonQmInfo *pInfo) {
...
@@ -378,20 +378,20 @@ int32_t tSerializeSMonQmInfo(void *buf, int32_t bufLen, SMonQmInfo *pInfo) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSMonQmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonQmInfo
*
pInfo
)
{
int32_t
tDeserializeSMonQmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonQmInfo
*
pInfo
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeSMonSysInfo
(
&
decoder
,
&
pInfo
->
sys
)
<
0
)
return
-
1
;
if
(
tDecodeSMonSysInfo
(
&
decoder
,
&
pInfo
->
sys
)
<
0
)
return
-
1
;
if
(
tDecodeSMonLogs
(
&
decoder
,
&
pInfo
->
log
)
<
0
)
return
-
1
;
if
(
tDecodeSMonLogs
(
&
decoder
,
&
pInfo
->
log
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -401,8 +401,8 @@ void tFreeSMonQmInfo(SMonQmInfo *pInfo) {
...
@@ -401,8 +401,8 @@ void tFreeSMonQmInfo(SMonQmInfo *pInfo) {
}
}
int32_t
tSerializeSMonSmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonSmInfo
*
pInfo
)
{
int32_t
tSerializeSMonSmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonSmInfo
*
pInfo
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeSMonSysInfo
(
&
encoder
,
&
pInfo
->
sys
)
<
0
)
return
-
1
;
if
(
tEncodeSMonSysInfo
(
&
encoder
,
&
pInfo
->
sys
)
<
0
)
return
-
1
;
...
@@ -410,20 +410,20 @@ int32_t tSerializeSMonSmInfo(void *buf, int32_t bufLen, SMonSmInfo *pInfo) {
...
@@ -410,20 +410,20 @@ int32_t tSerializeSMonSmInfo(void *buf, int32_t bufLen, SMonSmInfo *pInfo) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSMonSmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonSmInfo
*
pInfo
)
{
int32_t
tDeserializeSMonSmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonSmInfo
*
pInfo
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeSMonSysInfo
(
&
decoder
,
&
pInfo
->
sys
)
<
0
)
return
-
1
;
if
(
tDecodeSMonSysInfo
(
&
decoder
,
&
pInfo
->
sys
)
<
0
)
return
-
1
;
if
(
tDecodeSMonLogs
(
&
decoder
,
&
pInfo
->
log
)
<
0
)
return
-
1
;
if
(
tDecodeSMonLogs
(
&
decoder
,
&
pInfo
->
log
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -433,8 +433,8 @@ void tFreeSMonSmInfo(SMonSmInfo *pInfo) {
...
@@ -433,8 +433,8 @@ void tFreeSMonSmInfo(SMonSmInfo *pInfo) {
}
}
int32_t
tSerializeSMonBmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonBmInfo
*
pInfo
)
{
int32_t
tSerializeSMonBmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonBmInfo
*
pInfo
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeSMonSysInfo
(
&
encoder
,
&
pInfo
->
sys
)
<
0
)
return
-
1
;
if
(
tEncodeSMonSysInfo
(
&
encoder
,
&
pInfo
->
sys
)
<
0
)
return
-
1
;
...
@@ -442,20 +442,20 @@ int32_t tSerializeSMonBmInfo(void *buf, int32_t bufLen, SMonBmInfo *pInfo) {
...
@@ -442,20 +442,20 @@ int32_t tSerializeSMonBmInfo(void *buf, int32_t bufLen, SMonBmInfo *pInfo) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSMonBmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonBmInfo
*
pInfo
)
{
int32_t
tDeserializeSMonBmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonBmInfo
*
pInfo
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeSMonSysInfo
(
&
decoder
,
&
pInfo
->
sys
)
<
0
)
return
-
1
;
if
(
tDecodeSMonSysInfo
(
&
decoder
,
&
pInfo
->
sys
)
<
0
)
return
-
1
;
if
(
tDecodeSMonLogs
(
&
decoder
,
&
pInfo
->
log
)
<
0
)
return
-
1
;
if
(
tDecodeSMonLogs
(
&
decoder
,
&
pInfo
->
log
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -465,8 +465,8 @@ void tFreeSMonBmInfo(SMonBmInfo *pInfo) {
...
@@ -465,8 +465,8 @@ void tFreeSMonBmInfo(SMonBmInfo *pInfo) {
}
}
int32_t
tSerializeSMonVloadInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonVloadInfo
*
pInfo
)
{
int32_t
tSerializeSMonVloadInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonVloadInfo
*
pInfo
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
taosArrayGetSize
(
pInfo
->
pVloads
))
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
taosArrayGetSize
(
pInfo
->
pVloads
))
<
0
)
return
-
1
;
...
@@ -488,13 +488,13 @@ int32_t tSerializeSMonVloadInfo(void *buf, int32_t bufLen, SMonVloadInfo *pInfo)
...
@@ -488,13 +488,13 @@ int32_t tSerializeSMonVloadInfo(void *buf, int32_t bufLen, SMonVloadInfo *pInfo)
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSMonVloadInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonVloadInfo
*
pInfo
)
{
int32_t
tDeserializeSMonVloadInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonVloadInfo
*
pInfo
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
...
@@ -522,7 +522,7 @@ int32_t tDeserializeSMonVloadInfo(void *buf, int32_t bufLen, SMonVloadInfo *pInf
...
@@ -522,7 +522,7 @@ int32_t tDeserializeSMonVloadInfo(void *buf, int32_t bufLen, SMonVloadInfo *pInf
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
...
@@ -532,8 +532,8 @@ void tFreeSMonVloadInfo(SMonVloadInfo *pInfo) {
...
@@ -532,8 +532,8 @@ void tFreeSMonVloadInfo(SMonVloadInfo *pInfo) {
}
}
int32_t
tSerializeSMonMloadInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonMloadInfo
*
pInfo
)
{
int32_t
tSerializeSMonMloadInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonMloadInfo
*
pInfo
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pInfo
->
isMnode
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pInfo
->
isMnode
)
<
0
)
return
-
1
;
...
@@ -541,19 +541,19 @@ int32_t tSerializeSMonMloadInfo(void *buf, int32_t bufLen, SMonMloadInfo *pInfo)
...
@@ -541,19 +541,19 @@ int32_t tSerializeSMonMloadInfo(void *buf, int32_t bufLen, SMonMloadInfo *pInfo)
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSMonMloadInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonMloadInfo
*
pInfo
)
{
int32_t
tDeserializeSMonMloadInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonMloadInfo
*
pInfo
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pInfo
->
isMnode
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pInfo
->
isMnode
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pInfo
->
load
.
syncState
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pInfo
->
load
.
syncState
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
\ No newline at end of file
source/libs/parser/src/parInsertData.c
浏览文件 @
a06bf6e5
...
@@ -156,7 +156,7 @@ static int32_t createDataBlock(size_t defaultSize, int32_t rowSize, int32_t star
...
@@ -156,7 +156,7 @@ static int32_t createDataBlock(size_t defaultSize, int32_t rowSize, int32_t star
}
}
int32_t
buildCreateTbMsg
(
STableDataBlocks
*
pBlocks
,
SVCreateTbReq
*
pCreateTbReq
)
{
int32_t
buildCreateTbMsg
(
STableDataBlocks
*
pBlocks
,
SVCreateTbReq
*
pCreateTbReq
)
{
S
C
oder
coder
=
{
0
};
S
Enc
oder
coder
=
{
0
};
char
*
pBuf
;
char
*
pBuf
;
int32_t
len
;
int32_t
len
;
...
@@ -176,9 +176,9 @@ int32_t buildCreateTbMsg(STableDataBlocks* pBlocks, SVCreateTbReq* pCreateTbReq)
...
@@ -176,9 +176,9 @@ int32_t buildCreateTbMsg(STableDataBlocks* pBlocks, SVCreateTbReq* pCreateTbReq)
pBuf
=
pBlocks
->
pData
+
pBlocks
->
size
;
pBuf
=
pBlocks
->
pData
+
pBlocks
->
size
;
t
CoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
pBuf
,
len
,
TD_ENCODER
);
t
EncoderInit
(
&
coder
,
pBuf
,
len
);
tEncodeSVCreateTbReq
(
&
coder
,
pCreateTbReq
);
tEncodeSVCreateTbReq
(
&
coder
,
pCreateTbReq
);
t
C
oderClear
(
&
coder
);
t
Enc
oderClear
(
&
coder
);
pBlocks
->
size
+=
len
;
pBlocks
->
size
+=
len
;
pBlocks
->
createTbReqLen
=
len
;
pBlocks
->
createTbReqLen
=
len
;
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
a06bf6e5
...
@@ -3558,7 +3558,7 @@ static int32_t buildNormalTableBatchReq(int32_t acctId, const SCreateTableStmt*
...
@@ -3558,7 +3558,7 @@ static int32_t buildNormalTableBatchReq(int32_t acctId, const SCreateTableStmt*
static
int32_t
serializeVgroupCreateTableBatch
(
SVgroupCreateTableBatch
*
pTbBatch
,
SArray
*
pBufArray
)
{
static
int32_t
serializeVgroupCreateTableBatch
(
SVgroupCreateTableBatch
*
pTbBatch
,
SArray
*
pBufArray
)
{
int
tlen
;
int
tlen
;
S
C
oder
coder
=
{
0
};
S
Enc
oder
coder
=
{
0
};
int32_t
ret
=
0
;
int32_t
ret
=
0
;
tEncodeSize
(
tEncodeSVCreateTbBatchReq
,
&
pTbBatch
->
req
,
tlen
,
ret
);
tEncodeSize
(
tEncodeSVCreateTbBatchReq
,
&
pTbBatch
->
req
,
tlen
,
ret
);
...
@@ -3571,9 +3571,9 @@ static int32_t serializeVgroupCreateTableBatch(SVgroupCreateTableBatch* pTbBatch
...
@@ -3571,9 +3571,9 @@ static int32_t serializeVgroupCreateTableBatch(SVgroupCreateTableBatch* pTbBatch
((
SMsgHead
*
)
buf
)
->
contLen
=
htonl
(
tlen
);
((
SMsgHead
*
)
buf
)
->
contLen
=
htonl
(
tlen
);
void
*
pBuf
=
POINTER_SHIFT
(
buf
,
sizeof
(
SMsgHead
));
void
*
pBuf
=
POINTER_SHIFT
(
buf
,
sizeof
(
SMsgHead
));
t
CoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
pBuf
,
tlen
-
sizeof
(
SMsgHead
),
TD_ENCODER
);
t
EncoderInit
(
&
coder
,
pBuf
,
tlen
-
sizeof
(
SMsgHead
)
);
tEncodeSVCreateTbBatchReq
(
&
coder
,
&
pTbBatch
->
req
);
tEncodeSVCreateTbBatchReq
(
&
coder
,
&
pTbBatch
->
req
);
t
C
oderClear
(
&
coder
);
t
Enc
oderClear
(
&
coder
);
SVgDataBlocks
*
pVgData
=
taosMemoryCalloc
(
1
,
sizeof
(
SVgDataBlocks
));
SVgDataBlocks
*
pVgData
=
taosMemoryCalloc
(
1
,
sizeof
(
SVgDataBlocks
));
if
(
NULL
==
pVgData
)
{
if
(
NULL
==
pVgData
)
{
...
@@ -3958,7 +3958,7 @@ static void destroyDropTbReqBatch(SVgroupDropTableBatch* pTbBatch) { taosArrayDe
...
@@ -3958,7 +3958,7 @@ static void destroyDropTbReqBatch(SVgroupDropTableBatch* pTbBatch) { taosArrayDe
static
int32_t
serializeVgroupDropTableBatch
(
SVgroupDropTableBatch
*
pTbBatch
,
SArray
*
pBufArray
)
{
static
int32_t
serializeVgroupDropTableBatch
(
SVgroupDropTableBatch
*
pTbBatch
,
SArray
*
pBufArray
)
{
int
tlen
;
int
tlen
;
S
C
oder
coder
=
{
0
};
S
Enc
oder
coder
=
{
0
};
int32_t
ret
=
0
;
int32_t
ret
=
0
;
tEncodeSize
(
tEncodeSVDropTbBatchReq
,
&
pTbBatch
->
req
,
tlen
,
ret
);
tEncodeSize
(
tEncodeSVDropTbBatchReq
,
&
pTbBatch
->
req
,
tlen
,
ret
);
...
@@ -3971,9 +3971,9 @@ static int32_t serializeVgroupDropTableBatch(SVgroupDropTableBatch* pTbBatch, SA
...
@@ -3971,9 +3971,9 @@ static int32_t serializeVgroupDropTableBatch(SVgroupDropTableBatch* pTbBatch, SA
((
SMsgHead
*
)
buf
)
->
contLen
=
htonl
(
tlen
);
((
SMsgHead
*
)
buf
)
->
contLen
=
htonl
(
tlen
);
void
*
pBuf
=
POINTER_SHIFT
(
buf
,
sizeof
(
SMsgHead
));
void
*
pBuf
=
POINTER_SHIFT
(
buf
,
sizeof
(
SMsgHead
));
t
CoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
pBuf
,
tlen
-
sizeof
(
SMsgHead
),
TD_ENCODER
);
t
EncoderInit
(
&
coder
,
pBuf
,
tlen
-
sizeof
(
SMsgHead
)
);
tEncodeSVDropTbBatchReq
(
&
coder
,
&
pTbBatch
->
req
);
tEncodeSVDropTbBatchReq
(
&
coder
,
&
pTbBatch
->
req
);
t
C
oderClear
(
&
coder
);
t
Enc
oderClear
(
&
coder
);
SVgDataBlocks
*
pVgData
=
taosMemoryCalloc
(
1
,
sizeof
(
SVgDataBlocks
));
SVgDataBlocks
*
pVgData
=
taosMemoryCalloc
(
1
,
sizeof
(
SVgDataBlocks
));
if
(
NULL
==
pVgData
)
{
if
(
NULL
==
pVgData
)
{
...
...
source/libs/scheduler/src/scheduler.c
浏览文件 @
a06bf6e5
...
@@ -1085,21 +1085,21 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch
...
@@ -1085,21 +1085,21 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch
case
TDMT_VND_CREATE_TABLE_RSP
:
{
case
TDMT_VND_CREATE_TABLE_RSP
:
{
SVCreateTbBatchRsp
batchRsp
=
{
0
};
SVCreateTbBatchRsp
batchRsp
=
{
0
};
if
(
msg
)
{
if
(
msg
)
{
S
C
oder
coder
=
{
0
};
S
Dec
oder
coder
=
{
0
};
t
CoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
msg
,
msgSize
,
TD_DECODER
);
t
DecoderInit
(
&
coder
,
msg
,
msgSize
);
code
=
tDecodeSVCreateTbBatchRsp
(
&
coder
,
&
batchRsp
);
code
=
tDecodeSVCreateTbBatchRsp
(
&
coder
,
&
batchRsp
);
if
(
TSDB_CODE_SUCCESS
==
code
&&
batchRsp
.
nRsps
>
0
)
{
if
(
TSDB_CODE_SUCCESS
==
code
&&
batchRsp
.
nRsps
>
0
)
{
for
(
int32_t
i
=
0
;
i
<
batchRsp
.
nRsps
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
batchRsp
.
nRsps
;
++
i
)
{
SVCreateTbRsp
*
rsp
=
batchRsp
.
pRsps
+
i
;
SVCreateTbRsp
*
rsp
=
batchRsp
.
pRsps
+
i
;
if
(
NEED_CLIENT_HANDLE_ERROR
(
rsp
->
code
))
{
if
(
NEED_CLIENT_HANDLE_ERROR
(
rsp
->
code
))
{
t
C
oderClear
(
&
coder
);
t
Dec
oderClear
(
&
coder
);
SCH_ERR_JRET
(
rsp
->
code
);
SCH_ERR_JRET
(
rsp
->
code
);
}
else
if
(
TSDB_CODE_SUCCESS
!=
rsp
->
code
)
{
}
else
if
(
TSDB_CODE_SUCCESS
!=
rsp
->
code
)
{
code
=
rsp
->
code
;
code
=
rsp
->
code
;
}
}
}
}
}
}
t
C
oderClear
(
&
coder
);
t
Dec
oderClear
(
&
coder
);
SCH_ERR_JRET
(
code
);
SCH_ERR_JRET
(
code
);
}
}
...
@@ -1110,21 +1110,21 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch
...
@@ -1110,21 +1110,21 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch
case
TDMT_VND_DROP_TABLE_RSP
:
{
case
TDMT_VND_DROP_TABLE_RSP
:
{
SVDropTbBatchRsp
batchRsp
=
{
0
};
SVDropTbBatchRsp
batchRsp
=
{
0
};
if
(
msg
)
{
if
(
msg
)
{
S
C
oder
coder
=
{
0
};
S
Dec
oder
coder
=
{
0
};
t
CoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
msg
,
msgSize
,
TD_DECODER
);
t
DecoderInit
(
&
coder
,
msg
,
msgSize
);
code
=
tDecodeSVDropTbBatchRsp
(
&
coder
,
&
batchRsp
);
code
=
tDecodeSVDropTbBatchRsp
(
&
coder
,
&
batchRsp
);
if
(
TSDB_CODE_SUCCESS
==
code
&&
batchRsp
.
nRsps
>
0
)
{
if
(
TSDB_CODE_SUCCESS
==
code
&&
batchRsp
.
nRsps
>
0
)
{
for
(
int32_t
i
=
0
;
i
<
batchRsp
.
nRsps
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
batchRsp
.
nRsps
;
++
i
)
{
SVDropTbRsp
*
rsp
=
batchRsp
.
pRsps
+
i
;
SVDropTbRsp
*
rsp
=
batchRsp
.
pRsps
+
i
;
if
(
NEED_CLIENT_HANDLE_ERROR
(
rsp
->
code
))
{
if
(
NEED_CLIENT_HANDLE_ERROR
(
rsp
->
code
))
{
t
C
oderClear
(
&
coder
);
t
Dec
oderClear
(
&
coder
);
SCH_ERR_JRET
(
rsp
->
code
);
SCH_ERR_JRET
(
rsp
->
code
);
}
else
if
(
TSDB_CODE_SUCCESS
!=
rsp
->
code
)
{
}
else
if
(
TSDB_CODE_SUCCESS
!=
rsp
->
code
)
{
code
=
rsp
->
code
;
code
=
rsp
->
code
;
}
}
}
}
}
}
t
C
oderClear
(
&
coder
);
t
Dec
oderClear
(
&
coder
);
SCH_ERR_JRET
(
code
);
SCH_ERR_JRET
(
code
);
}
}
...
...
source/libs/stream/src/tstream.c
浏览文件 @
a06bf6e5
...
@@ -256,7 +256,7 @@ SStreamTask* tNewSStreamTask(int64_t streamId) {
...
@@ -256,7 +256,7 @@ SStreamTask* tNewSStreamTask(int64_t streamId) {
return
pTask
;
return
pTask
;
}
}
int32_t
tEncodeSStreamTask
(
S
C
oder
*
pEncoder
,
const
SStreamTask
*
pTask
)
{
int32_t
tEncodeSStreamTask
(
S
Enc
oder
*
pEncoder
,
const
SStreamTask
*
pTask
)
{
/*if (tStartEncode(pEncoder) < 0) return -1;*/
/*if (tStartEncode(pEncoder) < 0) return -1;*/
if
(
tEncodeI64
(
pEncoder
,
pTask
->
streamId
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pTask
->
streamId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pTask
->
taskId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pTask
->
taskId
)
<
0
)
return
-
1
;
...
@@ -301,7 +301,7 @@ int32_t tEncodeSStreamTask(SCoder* pEncoder, const SStreamTask* pTask) {
...
@@ -301,7 +301,7 @@ int32_t tEncodeSStreamTask(SCoder* pEncoder, const SStreamTask* pTask) {
return
pEncoder
->
pos
;
return
pEncoder
->
pos
;
}
}
int32_t
tDecodeSStreamTask
(
S
C
oder
*
pDecoder
,
SStreamTask
*
pTask
)
{
int32_t
tDecodeSStreamTask
(
S
Dec
oder
*
pDecoder
,
SStreamTask
*
pTask
)
{
/*if (tStartDecode(pDecoder) < 0) return -1;*/
/*if (tStartDecode(pDecoder) < 0) return -1;*/
if
(
tDecodeI64
(
pDecoder
,
&
pTask
->
streamId
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pTask
->
streamId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pTask
->
taskId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pTask
->
taskId
)
<
0
)
return
-
1
;
...
...
source/libs/sync/src/syncMessage.c
浏览文件 @
a06bf6e5
...
@@ -331,8 +331,8 @@ SyncPing* syncPingDeserialize2(const char* buf, uint32_t len) {
...
@@ -331,8 +331,8 @@ SyncPing* syncPingDeserialize2(const char* buf, uint32_t len) {
}
}
int32_t
syncPingSerialize3
(
const
SyncPing
*
pMsg
,
char
*
buf
,
int32_t
bufLen
)
{
int32_t
syncPingSerialize3
(
const
SyncPing
*
pMsg
,
char
*
buf
,
int32_t
bufLen
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
{
if
(
tStartEncode
(
&
encoder
)
<
0
)
{
return
-
1
;
return
-
1
;
}
}
...
@@ -367,13 +367,13 @@ int32_t syncPingSerialize3(const SyncPing* pMsg, char* buf, int32_t bufLen) {
...
@@ -367,13 +367,13 @@ int32_t syncPingSerialize3(const SyncPing* pMsg, char* buf, int32_t bufLen) {
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
SyncPing
*
syncPingDeserialize3
(
void
*
buf
,
int32_t
bufLen
)
{
SyncPing
*
syncPingDeserialize3
(
void
*
buf
,
int32_t
bufLen
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
{
if
(
tStartDecode
(
&
decoder
)
<
0
)
{
return
NULL
;
return
NULL
;
}
}
...
@@ -409,16 +409,16 @@ SyncPing* syncPingDeserialize3(void* buf, int32_t bufLen) {
...
@@ -409,16 +409,16 @@ SyncPing* syncPingDeserialize3(void* buf, int32_t bufLen) {
if
(
tDecodeU32
(
&
decoder
,
&
pMsg
->
dataLen
)
<
0
)
{
if
(
tDecodeU32
(
&
decoder
,
&
pMsg
->
dataLen
)
<
0
)
{
return
NULL
;
return
NULL
;
}
}
uint
64
_t
len
;
uint
32
_t
len
;
char
*
data
=
NULL
;
char
*
data
=
NULL
;
if
(
tDecodeBinary
(
&
decoder
,
(
const
void
**
)(
&
data
),
&
len
)
<
0
)
{
if
(
tDecodeBinary
(
&
decoder
,
(
const
uint8_t
**
)(
&
data
),
&
len
)
<
0
)
{
return
NULL
;
return
NULL
;
}
}
assert
(
len
=
pMsg
->
dataLen
);
assert
(
len
=
pMsg
->
dataLen
);
memcpy
(
pMsg
->
data
,
data
,
len
);
memcpy
(
pMsg
->
data
,
data
,
len
);
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
pMsg
;
return
pMsg
;
}
}
...
@@ -590,8 +590,8 @@ SyncPingReply* syncPingReplyDeserialize2(const char* buf, uint32_t len) {
...
@@ -590,8 +590,8 @@ SyncPingReply* syncPingReplyDeserialize2(const char* buf, uint32_t len) {
}
}
int32_t
syncPingReplySerialize3
(
const
SyncPingReply
*
pMsg
,
char
*
buf
,
int32_t
bufLen
)
{
int32_t
syncPingReplySerialize3
(
const
SyncPingReply
*
pMsg
,
char
*
buf
,
int32_t
bufLen
)
{
S
C
oder
encoder
=
{
0
};
S
Enc
oder
encoder
=
{
0
};
t
CoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
t
EncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
{
if
(
tStartEncode
(
&
encoder
)
<
0
)
{
return
-
1
;
return
-
1
;
}
}
...
@@ -626,13 +626,13 @@ int32_t syncPingReplySerialize3(const SyncPingReply* pMsg, char* buf, int32_t bu
...
@@ -626,13 +626,13 @@ int32_t syncPingReplySerialize3(const SyncPingReply* pMsg, char* buf, int32_t bu
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
t
C
oderClear
(
&
encoder
);
t
Enc
oderClear
(
&
encoder
);
return
tlen
;
return
tlen
;
}
}
SyncPingReply
*
syncPingReplyDeserialize3
(
void
*
buf
,
int32_t
bufLen
)
{
SyncPingReply
*
syncPingReplyDeserialize3
(
void
*
buf
,
int32_t
bufLen
)
{
S
C
oder
decoder
=
{
0
};
S
Dec
oder
decoder
=
{
0
};
t
CoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
t
DecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
{
if
(
tStartDecode
(
&
decoder
)
<
0
)
{
return
NULL
;
return
NULL
;
}
}
...
@@ -668,16 +668,16 @@ SyncPingReply* syncPingReplyDeserialize3(void* buf, int32_t bufLen) {
...
@@ -668,16 +668,16 @@ SyncPingReply* syncPingReplyDeserialize3(void* buf, int32_t bufLen) {
if
(
tDecodeU32
(
&
decoder
,
&
pMsg
->
dataLen
)
<
0
)
{
if
(
tDecodeU32
(
&
decoder
,
&
pMsg
->
dataLen
)
<
0
)
{
return
NULL
;
return
NULL
;
}
}
uint
64
_t
len
;
uint
32
_t
len
;
char
*
data
=
NULL
;
char
*
data
=
NULL
;
if
(
tDecodeBinary
(
&
decoder
,
(
const
void
**
)(
&
data
),
&
len
)
<
0
)
{
if
(
tDecodeBinary
(
&
decoder
,
(
const
uint8_t
**
)(
&
data
),
&
len
)
<
0
)
{
return
NULL
;
return
NULL
;
}
}
assert
(
len
=
pMsg
->
dataLen
);
assert
(
len
=
pMsg
->
dataLen
);
memcpy
(
pMsg
->
data
,
data
,
len
);
memcpy
(
pMsg
->
data
,
data
,
len
);
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
t
C
oderClear
(
&
decoder
);
t
Dec
oderClear
(
&
decoder
);
return
pMsg
;
return
pMsg
;
}
}
...
...
source/util/src/tencode.c
浏览文件 @
a06bf6e5
...
@@ -21,48 +21,60 @@ static_assert(sizeof(float) == sizeof(uint32_t), "sizeof(float) must equal to si
...
@@ -21,48 +21,60 @@ static_assert(sizeof(float) == sizeof(uint32_t), "sizeof(float) must equal to si
static_assert
(
sizeof
(
double
)
==
sizeof
(
uint64_t
),
"sizeof(double) must equal to sizeof(uint64_t)"
);
static_assert
(
sizeof
(
double
)
==
sizeof
(
uint64_t
),
"sizeof(double) must equal to sizeof(uint64_t)"
);
#endif
#endif
void
tCoderInit
(
SCoder
*
pCoder
,
td_endian_t
endian
,
uint8_t
*
data
,
int32_t
size
,
td_coder_t
type
)
{
struct
SEncoderNode
{
if
(
type
==
TD_ENCODER
)
{
SEncoderNode
*
pNext
;
uint8_t
*
data
;
uint32_t
size
;
uint32_t
pos
;
};
struct
SDecoderNode
{
SDecoderNode
*
pNext
;
const
uint8_t
*
data
;
uint32_t
size
;
uint32_t
pos
;
};
void
tEncoderInit
(
SEncoder
*
pEncoder
,
uint8_t
*
data
,
uint32_t
size
)
{
if
(
data
==
NULL
)
size
=
0
;
if
(
data
==
NULL
)
size
=
0
;
}
else
{
pEncoder
->
data
=
data
;
ASSERT
(
data
&&
size
>
0
);
pEncoder
->
size
=
size
;
}
pEncoder
->
pos
=
0
;
pEncoder
->
mList
=
NULL
;
pCoder
->
type
=
type
;
pEncoder
->
eStack
=
NULL
;
pCoder
->
endian
=
endian
;
pCoder
->
data
=
data
;
pCoder
->
size
=
size
;
pCoder
->
pos
=
0
;
pCoder
->
mList
=
NULL
;
TD_SLIST_INIT
(
&
(
pCoder
->
stack
));
}
}
void
tCoderClear
(
SCoder
*
pCoder
)
{
void
tEncoderClear
(
SEncoder
*
pCoder
)
{
SCoderMem
*
pMem
;
for
(
SCoderMem
*
pMem
=
pCoder
->
mList
;
pMem
;
pMem
=
pCoder
->
mList
)
{
// clear memory
for
(
pMem
=
pCoder
->
mList
;
pMem
;
pMem
=
pCoder
->
mList
)
{
pCoder
->
mList
=
pMem
->
next
;
pCoder
->
mList
=
pMem
->
next
;
taosMemoryFree
(
pMem
);
taosMemoryFree
(
pMem
);
}
}
memset
(
pCoder
,
0
,
sizeof
(
*
pCoder
));
}
void
tDecoderInit
(
SDecoder
*
pDecoder
,
const
uint8_t
*
data
,
uint32_t
size
)
{
pDecoder
->
data
=
data
;
pDecoder
->
size
=
size
;
pDecoder
->
pos
=
0
;
pDecoder
->
mList
=
NULL
;
pDecoder
->
dStack
=
NULL
;
}
struct
SCoderNode
*
pNode
;
void
tDecoderClear
(
SDecoder
*
pCoder
)
{
for
(;;)
{
for
(
SCoderMem
*
pMem
=
pCoder
->
mList
;
pMem
;
pMem
=
pCoder
->
mList
)
{
pNode
=
TD_SLIST_HEAD
(
&
(
pCoder
->
stack
));
pCoder
->
mList
=
pMem
->
next
;
if
(
pNode
==
NULL
)
break
;
taosMemoryFree
(
pMem
);
TD_SLIST_POP
(
&
(
pCoder
->
stack
));
taosMemoryFree
(
pNode
);
}
}
memset
(
pCoder
,
0
,
sizeof
(
*
pCoder
));
}
}
int32_t
tStartEncode
(
S
C
oder
*
pCoder
)
{
int32_t
tStartEncode
(
S
Enc
oder
*
pCoder
)
{
struct
SC
oderNode
*
pNode
;
SEnc
oderNode
*
pNode
;
ASSERT
(
pCoder
->
type
==
TD_ENCODER
);
if
(
pCoder
->
data
)
{
if
(
pCoder
->
data
)
{
if
(
pCoder
->
size
-
pCoder
->
pos
<
sizeof
(
int32_t
))
return
-
1
;
if
(
pCoder
->
size
-
pCoder
->
pos
<
sizeof
(
int32_t
))
return
-
1
;
pNode
=
t
aosMemoryMalloc
(
sizeof
(
*
pNode
));
pNode
=
t
EncoderMalloc
(
pCoder
,
sizeof
(
*
pNode
));
if
(
pNode
==
NULL
)
return
-
1
;
if
(
pNode
==
NULL
)
return
-
1
;
pNode
->
data
=
pCoder
->
data
;
pNode
->
data
=
pCoder
->
data
;
...
@@ -73,22 +85,23 @@ int32_t tStartEncode(SCoder* pCoder) {
...
@@ -73,22 +85,23 @@ int32_t tStartEncode(SCoder* pCoder) {
pCoder
->
pos
=
0
;
pCoder
->
pos
=
0
;
pCoder
->
size
=
pNode
->
size
-
pNode
->
pos
-
sizeof
(
int32_t
);
pCoder
->
size
=
pNode
->
size
-
pNode
->
pos
-
sizeof
(
int32_t
);
TD_SLIST_PUSH
(
&
(
pCoder
->
stack
),
pNode
);
pNode
->
pNext
=
pCoder
->
eStack
;
pCoder
->
eStack
=
pNode
;
}
else
{
}
else
{
pCoder
->
pos
+=
sizeof
(
int32_t
);
pCoder
->
pos
+=
sizeof
(
int32_t
);
}
}
return
0
;
return
0
;
}
}
void
tEndEncode
(
S
C
oder
*
pCoder
)
{
void
tEndEncode
(
S
Enc
oder
*
pCoder
)
{
struct
SC
oderNode
*
pNode
;
SEnc
oderNode
*
pNode
;
int32_t
len
;
int32_t
len
;
ASSERT
(
pCoder
->
type
==
TD_ENCODER
);
if
(
pCoder
->
data
)
{
if
(
pCoder
->
data
)
{
pNode
=
TD_SLIST_HEAD
(
&
(
pCoder
->
stack
))
;
pNode
=
pCoder
->
eStack
;
ASSERT
(
pNode
);
ASSERT
(
pNode
);
TD_SLIST_POP
(
&
(
pCoder
->
stack
))
;
pCoder
->
eStack
=
pNode
->
pNext
;
len
=
pCoder
->
pos
;
len
=
pCoder
->
pos
;
...
@@ -99,19 +112,16 @@ void tEndEncode(SCoder* pCoder) {
...
@@ -99,19 +112,16 @@ void tEndEncode(SCoder* pCoder) {
tEncodeI32
(
pCoder
,
len
);
tEncodeI32
(
pCoder
,
len
);
TD_CODER_MOVE_POS
(
pCoder
,
len
);
TD_CODER_MOVE_POS
(
pCoder
,
len
);
taosMemoryFree
(
pNode
);
}
}
}
}
int32_t
tStartDecode
(
SCoder
*
pCoder
)
{
int32_t
tStartDecode
(
SDecoder
*
pCoder
)
{
SDecoderNode
*
pNode
;
int32_t
len
;
int32_t
len
;
struct
SCoderNode
*
pNode
;
ASSERT
(
pCoder
->
type
==
TD_DECODER
);
if
(
tDecodeI32
(
pCoder
,
&
len
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pCoder
,
&
len
)
<
0
)
return
-
1
;
pNode
=
t
aosMemoryMalloc
(
sizeof
(
*
pNode
));
pNode
=
t
DecoderMalloc
(
pCoder
,
sizeof
(
*
pNode
));
if
(
pNode
==
NULL
)
return
-
1
;
if
(
pNode
==
NULL
)
return
-
1
;
pNode
->
data
=
pCoder
->
data
;
pNode
->
data
=
pCoder
->
data
;
...
@@ -122,23 +132,20 @@ int32_t tStartDecode(SCoder* pCoder) {
...
@@ -122,23 +132,20 @@ int32_t tStartDecode(SCoder* pCoder) {
pCoder
->
size
=
len
;
pCoder
->
size
=
len
;
pCoder
->
pos
=
0
;
pCoder
->
pos
=
0
;
TD_SLIST_PUSH
(
&
(
pCoder
->
stack
),
pNode
);
pNode
->
pNext
=
pCoder
->
dStack
;
pCoder
->
dStack
=
pNode
;
return
0
;
return
0
;
}
}
void
tEndDecode
(
SCoder
*
pCoder
)
{
void
tEndDecode
(
SDecoder
*
pCoder
)
{
struct
SCoderNode
*
pNode
;
SDecoderNode
*
pNode
;
ASSERT
(
pCoder
->
type
==
TD_DECODER
);
pNode
=
TD_SLIST_HEAD
(
&
(
pCoder
->
stack
))
;
pNode
=
pCoder
->
dStack
;
ASSERT
(
pNode
);
ASSERT
(
pNode
);
TD_SLIST_POP
(
&
(
pCoder
->
stack
))
;
pCoder
->
dStack
=
pNode
->
pNext
;
pCoder
->
data
=
pNode
->
data
;
pCoder
->
data
=
pNode
->
data
;
pCoder
->
pos
=
pCoder
->
size
+
pNode
->
pos
;
pCoder
->
pos
=
pCoder
->
size
+
pNode
->
pos
;
pCoder
->
size
=
pNode
->
size
;
pCoder
->
size
=
pNode
->
size
;
taosMemoryFree
(
pNode
);
}
}
source/util/test/CMakeLists.txt
浏览文件 @
a06bf6e5
...
@@ -41,9 +41,9 @@ target_sources(freelistTest
...
@@ -41,9 +41,9 @@ target_sources(freelistTest
)
)
target_link_libraries
(
freelistTest os util gtest gtest_main
)
target_link_libraries
(
freelistTest os util gtest gtest_main
)
# encodeTest
#
#
encodeTest
add_executable
(
encodeTest
"encodeTest.cpp"
)
#
add_executable(encodeTest "encodeTest.cpp")
target_link_libraries
(
encodeTest os util gtest gtest_main
)
#
target_link_libraries(encodeTest os util gtest gtest_main)
# queueTest
# queueTest
add_executable
(
procTest
"procTest.cpp"
)
add_executable
(
procTest
"procTest.cpp"
)
...
...
source/util/test/encodeTest.cpp
浏览文件 @
a06bf6e5
...
@@ -12,46 +12,47 @@
...
@@ -12,46 +12,47 @@
#define BUF_SIZE 64
#define BUF_SIZE 64
td_endian_t
endian_arr
[
2
]
=
{
TD_LITTLE_ENDIAN
,
TD_BIG_ENDIAN
};
td_endian_t
endian_arr
[
2
]
=
{
TD_LITTLE_ENDIAN
,
TD_BIG_ENDIAN
};
static
int32_t
encode
(
S
C
oder
*
pCoder
,
int8_t
val
)
{
return
tEncodeI8
(
pCoder
,
val
);
}
static
int32_t
encode
(
S
Enc
oder
*
pCoder
,
int8_t
val
)
{
return
tEncodeI8
(
pCoder
,
val
);
}
static
int32_t
encode
(
S
C
oder
*
pCoder
,
uint8_t
val
)
{
return
tEncodeU8
(
pCoder
,
val
);
}
static
int32_t
encode
(
S
Enc
oder
*
pCoder
,
uint8_t
val
)
{
return
tEncodeU8
(
pCoder
,
val
);
}
static
int32_t
encode
(
S
C
oder
*
pCoder
,
int16_t
val
)
{
return
tEncodeI16
(
pCoder
,
val
);
}
static
int32_t
encode
(
S
Enc
oder
*
pCoder
,
int16_t
val
)
{
return
tEncodeI16
(
pCoder
,
val
);
}
static
int32_t
encode
(
S
C
oder
*
pCoder
,
uint16_t
val
)
{
return
tEncodeU16
(
pCoder
,
val
);
}
static
int32_t
encode
(
S
Enc
oder
*
pCoder
,
uint16_t
val
)
{
return
tEncodeU16
(
pCoder
,
val
);
}
static
int32_t
encode
(
S
C
oder
*
pCoder
,
int32_t
val
)
{
return
tEncodeI32
(
pCoder
,
val
);
}
static
int32_t
encode
(
S
Enc
oder
*
pCoder
,
int32_t
val
)
{
return
tEncodeI32
(
pCoder
,
val
);
}
static
int32_t
encode
(
S
C
oder
*
pCoder
,
uint32_t
val
)
{
return
tEncodeU32
(
pCoder
,
val
);
}
static
int32_t
encode
(
S
Enc
oder
*
pCoder
,
uint32_t
val
)
{
return
tEncodeU32
(
pCoder
,
val
);
}
static
int32_t
encode
(
S
C
oder
*
pCoder
,
int64_t
val
)
{
return
tEncodeI64
(
pCoder
,
val
);
}
static
int32_t
encode
(
S
Enc
oder
*
pCoder
,
int64_t
val
)
{
return
tEncodeI64
(
pCoder
,
val
);
}
static
int32_t
encode
(
S
C
oder
*
pCoder
,
uint64_t
val
)
{
return
tEncodeU64
(
pCoder
,
val
);
}
static
int32_t
encode
(
S
Enc
oder
*
pCoder
,
uint64_t
val
)
{
return
tEncodeU64
(
pCoder
,
val
);
}
static
int32_t
decode
(
S
C
oder
*
pCoder
,
int8_t
*
val
)
{
return
tDecodeI8
(
pCoder
,
val
);
}
static
int32_t
decode
(
S
Dec
oder
*
pCoder
,
int8_t
*
val
)
{
return
tDecodeI8
(
pCoder
,
val
);
}
static
int32_t
decode
(
S
C
oder
*
pCoder
,
uint8_t
*
val
)
{
return
tDecodeU8
(
pCoder
,
val
);
}
static
int32_t
decode
(
S
Dec
oder
*
pCoder
,
uint8_t
*
val
)
{
return
tDecodeU8
(
pCoder
,
val
);
}
static
int32_t
decode
(
S
C
oder
*
pCoder
,
int16_t
*
val
)
{
return
tDecodeI16
(
pCoder
,
val
);
}
static
int32_t
decode
(
S
Dec
oder
*
pCoder
,
int16_t
*
val
)
{
return
tDecodeI16
(
pCoder
,
val
);
}
static
int32_t
decode
(
S
C
oder
*
pCoder
,
uint16_t
*
val
)
{
return
tDecodeU16
(
pCoder
,
val
);
}
static
int32_t
decode
(
S
Dec
oder
*
pCoder
,
uint16_t
*
val
)
{
return
tDecodeU16
(
pCoder
,
val
);
}
static
int32_t
decode
(
S
C
oder
*
pCoder
,
int32_t
*
val
)
{
return
tDecodeI32
(
pCoder
,
val
);
}
static
int32_t
decode
(
S
Dec
oder
*
pCoder
,
int32_t
*
val
)
{
return
tDecodeI32
(
pCoder
,
val
);
}
static
int32_t
decode
(
S
C
oder
*
pCoder
,
uint32_t
*
val
)
{
return
tDecodeU32
(
pCoder
,
val
);
}
static
int32_t
decode
(
S
Dec
oder
*
pCoder
,
uint32_t
*
val
)
{
return
tDecodeU32
(
pCoder
,
val
);
}
static
int32_t
decode
(
S
C
oder
*
pCoder
,
int64_t
*
val
)
{
return
tDecodeI64
(
pCoder
,
val
);
}
static
int32_t
decode
(
S
Dec
oder
*
pCoder
,
int64_t
*
val
)
{
return
tDecodeI64
(
pCoder
,
val
);
}
static
int32_t
decode
(
S
C
oder
*
pCoder
,
uint64_t
*
val
)
{
return
tDecodeU64
(
pCoder
,
val
);
}
static
int32_t
decode
(
S
Dec
oder
*
pCoder
,
uint64_t
*
val
)
{
return
tDecodeU64
(
pCoder
,
val
);
}
static
int32_t
encodev
(
S
C
oder
*
pCoder
,
int8_t
val
)
{
return
tEncodeI8
(
pCoder
,
val
);
}
static
int32_t
encodev
(
S
Enc
oder
*
pCoder
,
int8_t
val
)
{
return
tEncodeI8
(
pCoder
,
val
);
}
static
int32_t
encodev
(
S
C
oder
*
pCoder
,
uint8_t
val
)
{
return
tEncodeU8
(
pCoder
,
val
);
}
static
int32_t
encodev
(
S
Enc
oder
*
pCoder
,
uint8_t
val
)
{
return
tEncodeU8
(
pCoder
,
val
);
}
static
int32_t
encodev
(
S
C
oder
*
pCoder
,
int16_t
val
)
{
return
tEncodeI16v
(
pCoder
,
val
);
}
static
int32_t
encodev
(
S
Enc
oder
*
pCoder
,
int16_t
val
)
{
return
tEncodeI16v
(
pCoder
,
val
);
}
static
int32_t
encodev
(
S
C
oder
*
pCoder
,
uint16_t
val
)
{
return
tEncodeU16v
(
pCoder
,
val
);
}
static
int32_t
encodev
(
S
Enc
oder
*
pCoder
,
uint16_t
val
)
{
return
tEncodeU16v
(
pCoder
,
val
);
}
static
int32_t
encodev
(
S
C
oder
*
pCoder
,
int32_t
val
)
{
return
tEncodeI32v
(
pCoder
,
val
);
}
static
int32_t
encodev
(
S
Enc
oder
*
pCoder
,
int32_t
val
)
{
return
tEncodeI32v
(
pCoder
,
val
);
}
static
int32_t
encodev
(
S
C
oder
*
pCoder
,
uint32_t
val
)
{
return
tEncodeU32v
(
pCoder
,
val
);
}
static
int32_t
encodev
(
S
Enc
oder
*
pCoder
,
uint32_t
val
)
{
return
tEncodeU32v
(
pCoder
,
val
);
}
static
int32_t
encodev
(
S
C
oder
*
pCoder
,
int64_t
val
)
{
return
tEncodeI64v
(
pCoder
,
val
);
}
static
int32_t
encodev
(
S
Enc
oder
*
pCoder
,
int64_t
val
)
{
return
tEncodeI64v
(
pCoder
,
val
);
}
static
int32_t
encodev
(
S
C
oder
*
pCoder
,
uint64_t
val
)
{
return
tEncodeU64v
(
pCoder
,
val
);
}
static
int32_t
encodev
(
S
Enc
oder
*
pCoder
,
uint64_t
val
)
{
return
tEncodeU64v
(
pCoder
,
val
);
}
static
int32_t
decodev
(
S
C
oder
*
pCoder
,
int8_t
*
val
)
{
return
tDecodeI8
(
pCoder
,
val
);
}
static
int32_t
decodev
(
S
Dec
oder
*
pCoder
,
int8_t
*
val
)
{
return
tDecodeI8
(
pCoder
,
val
);
}
static
int32_t
decodev
(
S
C
oder
*
pCoder
,
uint8_t
*
val
)
{
return
tDecodeU8
(
pCoder
,
val
);
}
static
int32_t
decodev
(
S
Dec
oder
*
pCoder
,
uint8_t
*
val
)
{
return
tDecodeU8
(
pCoder
,
val
);
}
static
int32_t
decodev
(
S
C
oder
*
pCoder
,
int16_t
*
val
)
{
return
tDecodeI16v
(
pCoder
,
val
);
}
static
int32_t
decodev
(
S
Dec
oder
*
pCoder
,
int16_t
*
val
)
{
return
tDecodeI16v
(
pCoder
,
val
);
}
static
int32_t
decodev
(
S
C
oder
*
pCoder
,
uint16_t
*
val
)
{
return
tDecodeU16v
(
pCoder
,
val
);
}
static
int32_t
decodev
(
S
Dec
oder
*
pCoder
,
uint16_t
*
val
)
{
return
tDecodeU16v
(
pCoder
,
val
);
}
static
int32_t
decodev
(
S
C
oder
*
pCoder
,
int32_t
*
val
)
{
return
tDecodeI32v
(
pCoder
,
val
);
}
static
int32_t
decodev
(
S
Dec
oder
*
pCoder
,
int32_t
*
val
)
{
return
tDecodeI32v
(
pCoder
,
val
);
}
static
int32_t
decodev
(
S
C
oder
*
pCoder
,
uint32_t
*
val
)
{
return
tDecodeU32v
(
pCoder
,
val
);
}
static
int32_t
decodev
(
S
Dec
oder
*
pCoder
,
uint32_t
*
val
)
{
return
tDecodeU32v
(
pCoder
,
val
);
}
static
int32_t
decodev
(
S
C
oder
*
pCoder
,
int64_t
*
val
)
{
return
tDecodeI64v
(
pCoder
,
val
);
}
static
int32_t
decodev
(
S
Dec
oder
*
pCoder
,
int64_t
*
val
)
{
return
tDecodeI64v
(
pCoder
,
val
);
}
static
int32_t
decodev
(
S
C
oder
*
pCoder
,
uint64_t
*
val
)
{
return
tDecodeU64v
(
pCoder
,
val
);
}
static
int32_t
decodev
(
S
Dec
oder
*
pCoder
,
uint64_t
*
val
)
{
return
tDecodeU64v
(
pCoder
,
val
);
}
template
<
typename
T
>
template
<
typename
T
>
static
void
simple_encode_decode_func
(
bool
var_len
)
{
static
void
simple_encode_decode_func
(
bool
var_len
)
{
uint8_t
buf
[
BUF_SIZE
];
uint8_t
buf
[
BUF_SIZE
];
SCoder
coder
;
SEncoder
encoder
=
{
0
};
SDecoder
decoder
=
{
0
};
T
min_val
,
max_val
;
T
min_val
,
max_val
;
T
step
=
1
;
T
step
=
1
;
...
@@ -95,51 +96,51 @@ static void simple_encode_decode_func(bool var_len) {
...
@@ -95,51 +96,51 @@ static void simple_encode_decode_func(bool var_len) {
// Encode NULL
// Encode NULL
for
(
td_endian_t
endian
:
endian_arr
)
{
for
(
td_endian_t
endian
:
endian_arr
)
{
t
CoderInit
(
&
coder
,
endian
,
NULL
,
0
,
TD_ENCODER
);
t
EncoderInit
(
&
en
coder
,
endian
,
NULL
,
0
,
TD_ENCODER
);
if
(
var_len
)
{
if
(
var_len
)
{
GTEST_ASSERT_EQ
(
encodev
(
&
coder
,
i
),
0
);
GTEST_ASSERT_EQ
(
encodev
(
&
en
coder
,
i
),
0
);
}
else
{
}
else
{
GTEST_ASSERT_EQ
(
encode
(
&
coder
,
i
),
0
);
GTEST_ASSERT_EQ
(
encode
(
&
en
coder
,
i
),
0
);
GTEST_ASSERT_EQ
(
coder
.
pos
,
sizeof
(
T
));
GTEST_ASSERT_EQ
(
en
coder
.
pos
,
sizeof
(
T
));
}
}
tCoderClear
(
&
coder
);
tCoderClear
(
&
en
coder
);
}
}
// Encode and decode
// Encode and decode
for
(
td_endian_t
e_endian
:
endian_arr
)
{
for
(
td_endian_t
e_endian
:
endian_arr
)
{
for
(
td_endian_t
d_endian
:
endian_arr
)
{
for
(
td_endian_t
d_endian
:
endian_arr
)
{
// Encode
// Encode
tCoderInit
(
&
coder
,
e_endian
,
buf
,
BUF_SIZE
,
TD_ENCODER
);
tCoderInit
(
&
en
coder
,
e_endian
,
buf
,
BUF_SIZE
,
TD_ENCODER
);
if
(
var_len
)
{
if
(
var_len
)
{
GTEST_ASSERT_EQ
(
encodev
(
&
coder
,
i
),
0
);
GTEST_ASSERT_EQ
(
encodev
(
&
en
coder
,
i
),
0
);
}
else
{
}
else
{
GTEST_ASSERT_EQ
(
encode
(
&
coder
,
i
),
0
);
GTEST_ASSERT_EQ
(
encode
(
&
en
coder
,
i
),
0
);
GTEST_ASSERT_EQ
(
coder
.
pos
,
sizeof
(
T
));
GTEST_ASSERT_EQ
(
en
coder
.
pos
,
sizeof
(
T
));
}
}
int32_t
epos
=
coder
.
pos
;
int32_t
epos
=
en
coder
.
pos
;
tCoderClear
(
&
coder
);
tCoderClear
(
&
en
coder
);
// Decode
// Decode
tCoderInit
(
&
coder
,
d_endian
,
buf
,
BUF_SIZE
,
TD_DECODER
);
tCoderInit
(
&
en
coder
,
d_endian
,
buf
,
BUF_SIZE
,
TD_DECODER
);
if
(
var_len
)
{
if
(
var_len
)
{
GTEST_ASSERT_EQ
(
decodev
(
&
coder
,
&
dval
),
0
);
GTEST_ASSERT_EQ
(
decodev
(
&
en
coder
,
&
dval
),
0
);
}
else
{
}
else
{
GTEST_ASSERT_EQ
(
decode
(
&
coder
,
&
dval
),
0
);
GTEST_ASSERT_EQ
(
decode
(
&
en
coder
,
&
dval
),
0
);
GTEST_ASSERT_EQ
(
coder
.
pos
,
sizeof
(
T
));
GTEST_ASSERT_EQ
(
en
coder
.
pos
,
sizeof
(
T
));
}
}
GTEST_ASSERT_EQ
(
coder
.
pos
,
epos
);
GTEST_ASSERT_EQ
(
en
coder
.
pos
,
epos
);
if
(
typeid
(
T
)
==
typeid
(
int8_t
)
||
typeid
(
T
)
==
typeid
(
uint8_t
)
||
e_endian
==
d_endian
)
{
if
(
typeid
(
T
)
==
typeid
(
int8_t
)
||
typeid
(
T
)
==
typeid
(
uint8_t
)
||
e_endian
==
d_endian
)
{
GTEST_ASSERT_EQ
(
i
,
dval
);
GTEST_ASSERT_EQ
(
i
,
dval
);
}
}
tCoderClear
(
&
coder
);
tCoderClear
(
&
en
coder
);
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录