Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6035f030
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
You need to sign in or sign up before continuing.
提交
6035f030
编写于
4月 20, 2022
作者:
M
Minghao Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sync integration add SyncApplyMsg
上级
704671d2
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
60 addition
and
1 deletion
+60
-1
include/libs/sync/syncTools.h
include/libs/sync/syncTools.h
+32
-1
source/libs/sync/src/syncMessage.c
source/libs/sync/src/syncMessage.c
+28
-0
未找到文件。
include/libs/sync/syncTools.h
浏览文件 @
6035f030
...
...
@@ -363,6 +363,37 @@ void syncAppendEntriesReplyPrint2(char* s, const SyncAppendEntriesReply* pMsg);
void
syncAppendEntriesReplyLog
(
const
SyncAppendEntriesReply
*
pMsg
);
void
syncAppendEntriesReplyLog2
(
char
*
s
,
const
SyncAppendEntriesReply
*
pMsg
);
// ---------------------------------------------
typedef
struct
SyncApplyMsg
{
uint32_t
bytes
;
int32_t
vgId
;
uint32_t
msgType
;
// user SyncApplyMsg msgType
uint32_t
originalRpcType
;
// user RpcMsg msgType
SFsmCbMeta
fsmMeta
;
uint32_t
dataLen
;
// user RpcMsg.contLen
char
data
[];
// user RpcMsg.pCont
}
SyncApplyMsg
;
SyncApplyMsg
*
syncApplyMsgBuild
(
uint32_t
dataLen
);
SyncApplyMsg
*
syncApplyMsgBuild2
(
const
SRpcMsg
*
pOriginalRpcMsg
,
int32_t
vgId
,
SFsmCbMeta
*
pMeta
);
void
syncApplyMsgDestroy
(
SyncApplyMsg
*
pMsg
);
void
syncApplyMsgSerialize
(
const
SyncApplyMsg
*
pMsg
,
char
*
buf
,
uint32_t
bufLen
);
void
syncApplyMsgDeserialize
(
const
char
*
buf
,
uint32_t
len
,
SyncApplyMsg
*
pMsg
);
char
*
syncApplyMsgSerialize2
(
const
SyncApplyMsg
*
pMsg
,
uint32_t
*
len
);
SyncApplyMsg
*
syncApplyMsgDeserialize2
(
const
char
*
buf
,
uint32_t
len
);
void
syncApplyMsg2RpcMsg
(
const
SyncApplyMsg
*
pMsg
,
SRpcMsg
*
pRpcMsg
);
// SyncApplyMsg to SRpcMsg, put it into ApplyQ
void
syncApplyMsgFromRpcMsg
(
const
SRpcMsg
*
pRpcMsg
,
SyncApplyMsg
*
pMsg
);
// get SRpcMsg from ApplyQ, to SyncApplyMsg
void
syncApplyMsg2OriginalRpcMsg
(
const
SyncApplyMsg
*
pMsg
,
SRpcMsg
*
pOriginalRpcMsg
);
// SyncApplyMsg to OriginalRpcMsg
SyncApplyMsg
*
syncApplyMsgFromRpcMsg2
(
const
SRpcMsg
*
pRpcMsg
);
cJSON
*
syncApplyMsg2Json
(
const
SyncApplyMsg
*
pMsg
);
char
*
syncApplyMsg2Str
(
const
SyncApplyMsg
*
pMsg
);
// for debug ----------------------
void
syncApplyMsgPrint
(
const
SyncApplyMsg
*
pMsg
);
void
syncApplyMsgPrint2
(
char
*
s
,
const
SyncApplyMsg
*
pMsg
);
void
ssyncApplyMsgLog
(
const
SyncApplyMsg
*
pMsg
);
void
syncApplyMsgLog2
(
char
*
s
,
const
SyncApplyMsg
*
pMsg
);
// on message ----------------------
int32_t
syncNodeOnPingCb
(
SSyncNode
*
ths
,
SyncPing
*
pMsg
);
int32_t
syncNodeOnPingReplyCb
(
SSyncNode
*
ths
,
SyncPingReply
*
pMsg
);
...
...
@@ -373,7 +404,7 @@ int32_t syncNodeOnRequestVoteReplyCb(SSyncNode* ths, SyncRequestVoteReply* pMsg)
int32_t
syncNodeOnAppendEntriesCb
(
SSyncNode
*
ths
,
SyncAppendEntries
*
pMsg
);
int32_t
syncNodeOnAppendEntriesReplyCb
(
SSyncNode
*
ths
,
SyncAppendEntriesReply
*
pMsg
);
//---------------------
//
------------------------
---------------------
#ifdef __cplusplus
}
...
...
source/libs/sync/src/syncMessage.c
浏览文件 @
6035f030
...
...
@@ -1531,3 +1531,31 @@ void syncAppendEntriesReplyLog2(char* s, const SyncAppendEntriesReply* pMsg) {
sTrace
(
"syncAppendEntriesReplyLog2 | len:%lu | %s | %s"
,
strlen
(
serialized
),
s
,
serialized
);
taosMemoryFree
(
serialized
);
}
// ---- message process SyncApplyMsg----
SyncApplyMsg
*
syncApplyMsgBuild
(
uint32_t
dataLen
)
{
return
NULL
;
}
SyncApplyMsg
*
syncApplyMsgBuild2
(
const
SRpcMsg
*
pOriginalRpcMsg
,
int32_t
vgId
,
SFsmCbMeta
*
pMeta
)
{
return
NULL
;
}
void
syncApplyMsgDestroy
(
SyncApplyMsg
*
pMsg
)
{}
void
syncApplyMsgSerialize
(
const
SyncApplyMsg
*
pMsg
,
char
*
buf
,
uint32_t
bufLen
)
{}
void
syncApplyMsgDeserialize
(
const
char
*
buf
,
uint32_t
len
,
SyncApplyMsg
*
pMsg
)
{}
char
*
syncApplyMsgSerialize2
(
const
SyncApplyMsg
*
pMsg
,
uint32_t
*
len
)
{
return
NULL
;
}
SyncApplyMsg
*
syncApplyMsgDeserialize2
(
const
char
*
buf
,
uint32_t
len
)
{
return
NULL
;
}
// SyncApplyMsg to SRpcMsg, put it into ApplyQ
void
syncApplyMsg2RpcMsg
(
const
SyncApplyMsg
*
pMsg
,
SRpcMsg
*
pRpcMsg
)
{}
// get SRpcMsg from ApplyQ, to SyncApplyMsg
void
syncApplyMsgFromRpcMsg
(
const
SRpcMsg
*
pRpcMsg
,
SyncApplyMsg
*
pMsg
)
{}
// SyncApplyMsg to OriginalRpcMsg
void
syncApplyMsg2OriginalRpcMsg
(
const
SyncApplyMsg
*
pMsg
,
SRpcMsg
*
pOriginalRpcMsg
)
{}
SyncApplyMsg
*
syncApplyMsgFromRpcMsg2
(
const
SRpcMsg
*
pRpcMsg
)
{
return
NULL
;
}
cJSON
*
syncApplyMsg2Json
(
const
SyncApplyMsg
*
pMsg
)
{
return
NULL
;
}
char
*
syncApplyMsg2Str
(
const
SyncApplyMsg
*
pMsg
)
{
return
NULL
;
}
// for debug ----------------------
void
syncApplyMsgPrint
(
const
SyncApplyMsg
*
pMsg
)
{}
void
syncApplyMsgPrint2
(
char
*
s
,
const
SyncApplyMsg
*
pMsg
)
{}
void
ssyncApplyMsgLog
(
const
SyncApplyMsg
*
pMsg
)
{}
void
syncApplyMsgLog2
(
char
*
s
,
const
SyncApplyMsg
*
pMsg
)
{}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录