Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
353feec1
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
353feec1
编写于
2月 16, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
serialize topic msg
上级
abd6b98b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
52 addition
and
33 deletion
+52
-33
include/common/tmsg.h
include/common/tmsg.h
+5
-29
include/common/tmsgdef.h
include/common/tmsgdef.h
+1
-1
source/client/src/tmq.c
source/client/src/tmq.c
+2
-2
source/common/src/tmsg.c
source/common/src/tmsg.c
+43
-0
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+1
-1
未找到文件。
include/common/tmsg.h
浏览文件 @
353feec1
...
...
@@ -1118,39 +1118,15 @@ typedef struct {
char
*
logicalPlan
;
}
SMCreateTopicReq
;
static
FORCE_INLINE
int
tSerializeSMCreateTopicReq
(
void
**
buf
,
const
SMCreateTopicReq
*
pReq
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeFixedI8
(
buf
,
pReq
->
igExists
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
name
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
sql
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
physicalPlan
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
logicalPlan
);
return
tlen
;
}
static
FORCE_INLINE
void
*
tDeserializeSCMCreateTopicReq
(
void
*
buf
,
SMCreateTopicReq
*
pReq
)
{
buf
=
taosDecodeFixedI8
(
buf
,
&
(
pReq
->
igExists
));
buf
=
taosDecodeString
(
buf
,
&
(
pReq
->
name
));
buf
=
taosDecodeString
(
buf
,
&
(
pReq
->
sql
));
buf
=
taosDecodeString
(
buf
,
&
(
pReq
->
physicalPlan
));
buf
=
taosDecodeString
(
buf
,
&
(
pReq
->
logicalPlan
));
return
buf
;
}
int32_t
tSerializeMCreateTopicReq
(
void
**
buf
,
const
SMCreateTopicReq
*
pReq
);
void
*
tDeserializeSMCreateTopicReq
(
void
*
buf
,
SMCreateTopicReq
*
pReq
);
typedef
struct
{
int64_t
topicId
;
}
S
C
MCreateTopicRsp
;
}
SMCreateTopicRsp
;
static
FORCE_INLINE
int
tSerializeSCMCreateTopicRsp
(
void
**
buf
,
const
SCMCreateTopicRsp
*
pRsp
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeFixedI64
(
buf
,
pRsp
->
topicId
);
return
tlen
;
}
static
FORCE_INLINE
void
*
tDeserializeSCMCreateTopicRsp
(
void
*
buf
,
SCMCreateTopicRsp
*
pRsp
)
{
buf
=
taosDecodeFixedI64
(
buf
,
&
pRsp
->
topicId
);
return
buf
;
}
int32_t
tSerializeSMCreateTopicRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SMCreateTopicRsp
*
pRsp
);
int32_t
tDeserializeSMCreateTopicRsp
(
void
*
buf
,
int32_t
bufLen
,
SMCreateTopicRsp
*
pRsp
);
typedef
struct
{
int32_t
topicNum
;
...
...
include/common/tmsgdef.h
浏览文件 @
353feec1
...
...
@@ -137,7 +137,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_MND_TRANS
,
"mnode-trans"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GRANT
,
"mnode-grant"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_AUTH
,
"mnode-auth"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_TOPIC
,
"mnode-create-topic"
,
SMCreateTopicReq
,
S
C
MCreateTopicRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_TOPIC
,
"mnode-create-topic"
,
SMCreateTopicReq
,
SMCreateTopicRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_TOPIC
,
"mnode-alter-topic"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_TOPIC
,
"mnode-drop-topic"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SUBSCRIBE
,
"mnode-subscribe"
,
SCMSubscribeReq
,
SCMSubscribeRsp
)
...
...
source/client/src/tmq.c
浏览文件 @
353feec1
...
...
@@ -368,14 +368,14 @@ TAOS_RES* tmq_create_topic(TAOS* taos, const char* topicName, const char* sql, i
.
logicalPlan
=
(
char
*
)
"no logic plan"
,
};
int
tlen
=
tSerialize
S
MCreateTopicReq
(
NULL
,
&
req
);
int
tlen
=
tSerializeMCreateTopicReq
(
NULL
,
&
req
);
void
*
buf
=
malloc
(
tlen
);
if
(
buf
==
NULL
)
{
goto
_return
;
}
void
*
abuf
=
buf
;
tSerialize
S
MCreateTopicReq
(
&
abuf
,
&
req
);
tSerializeMCreateTopicReq
(
&
abuf
,
&
req
);
/*printf("formatted: %s\n", dagStr);*/
pRequest
->
body
.
requestMsg
=
(
SDataBuf
){.
pData
=
buf
,
.
len
=
tlen
};
...
...
source/common/src/tmsg.c
浏览文件 @
353feec1
...
...
@@ -1816,3 +1816,46 @@ int32_t tDeserializeSMDropTopicReq(void *buf, int32_t bufLen, SMDropTopicReq *pR
return
0
;
}
int32_t
tSerializeMCreateTopicReq
(
void
**
buf
,
const
SMCreateTopicReq
*
pReq
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI8
(
buf
,
pReq
->
igExists
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
name
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
sql
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
physicalPlan
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
logicalPlan
);
return
tlen
;
}
void
*
tDeserializeSMCreateTopicReq
(
void
*
buf
,
SMCreateTopicReq
*
pReq
)
{
buf
=
taosDecodeFixedI8
(
buf
,
&
(
pReq
->
igExists
));
buf
=
taosDecodeString
(
buf
,
&
(
pReq
->
name
));
buf
=
taosDecodeString
(
buf
,
&
(
pReq
->
sql
));
buf
=
taosDecodeString
(
buf
,
&
(
pReq
->
physicalPlan
));
buf
=
taosDecodeString
(
buf
,
&
(
pReq
->
logicalPlan
));
return
buf
;
}
int32_t
tSerializeSMCreateTopicRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SMCreateTopicRsp
*
pRsp
)
{
SCoder
encoder
=
{
0
};
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pRsp
->
topicId
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tCoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSMCreateTopicRsp
(
void
*
buf
,
int32_t
bufLen
,
SMCreateTopicRsp
*
pRsp
)
{
SCoder
decoder
=
{
0
};
tCoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pRsp
->
topicId
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tCoderClear
(
&
decoder
);
return
0
;
}
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
353feec1
...
...
@@ -265,7 +265,7 @@ static int32_t mndProcessCreateTopicReq(SMnodeMsg *pReq) {
char
*
msgStr
=
pReq
->
rpcMsg
.
pCont
;
SMCreateTopicReq
createTopicReq
=
{
0
};
tDeserializeS
C
MCreateTopicReq
(
msgStr
,
&
createTopicReq
);
tDeserializeSMCreateTopicReq
(
msgStr
,
&
createTopicReq
);
mDebug
(
"topic:%s, start to create, sql:%s"
,
createTopicReq
.
name
,
createTopicReq
.
sql
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录