From b8aa420e3a959ca8b494b894667f6d2f34f3e871 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Mon, 7 Mar 2022 16:46:17 +0800 Subject: [PATCH] sync refactor --- source/libs/sync/inc/syncIO.h | 6 +++--- source/libs/sync/inc/syncInt.h | 6 +++--- source/libs/sync/src/syncMain.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/source/libs/sync/inc/syncIO.h b/source/libs/sync/inc/syncIO.h index 160fefd086..a948de8ac1 100644 --- a/source/libs/sync/inc/syncIO.h +++ b/source/libs/sync/inc/syncIO.h @@ -31,11 +31,11 @@ extern "C" { typedef struct SSyncIO { STaosQueue *pMsgQ; - STaosQset * pQset; + STaosQset *pQset; pthread_t consumerTid; - void * serverRpc; - void * clientRpc; + void *serverRpc; + void *clientRpc; SEpSet myAddr; void *ioTimerTickQ; diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h index bce03059a0..b8c7eb60e7 100644 --- a/source/libs/sync/inc/syncInt.h +++ b/source/libs/sync/inc/syncInt.h @@ -192,9 +192,9 @@ void syncNodeClose(SSyncNode* pSyncNode); int32_t syncNodeSendMsgById(const SRaftId* destRaftId, SSyncNode* pSyncNode, SRpcMsg* pMsg); int32_t syncNodeSendMsgByInfo(const SNodeInfo* nodeInfo, SSyncNode* pSyncNode, SRpcMsg* pMsg); int32_t syncNodePing(SSyncNode* pSyncNode, const SRaftId* destRaftId, SyncPing* pMsg); -void syncNodePingAll(SSyncNode* pSyncNode); -void syncNodePingPeers(SSyncNode* pSyncNode); -void syncNodePingSelf(SSyncNode* pSyncNode); +int32_t syncNodePingAll(SSyncNode* pSyncNode); +int32_t syncNodePingPeers(SSyncNode* pSyncNode); +int32_t syncNodePingSelf(SSyncNode* pSyncNode); int32_t syncNodeStartPingTimer(SSyncNode* pSyncNode); int32_t syncNodeStopPingTimer(SSyncNode* pSyncNode); diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index cac2b6953d..ef30254557 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -177,7 +177,7 @@ int32_t syncNodePing(SSyncNode* pSyncNode, const SRaftId* destRaftId, SyncPing* return ret; } -void syncNodePingAll(SSyncNode* pSyncNode) { +int32_t syncNodePingAll(SSyncNode* pSyncNode) { sTrace("syncNodePingAll pSyncNode:%p ", pSyncNode); int32_t ret = 0; for (int i = 0; i < pSyncNode->syncCfg.replicaNum; ++i) { @@ -190,7 +190,7 @@ void syncNodePingAll(SSyncNode* pSyncNode) { } } -void syncNodePingPeers(SSyncNode* pSyncNode) { +int32_t syncNodePingPeers(SSyncNode* pSyncNode) { int32_t ret = 0; for (int i = 0; i < pSyncNode->peersNum; ++i) { SRaftId destId; @@ -202,7 +202,7 @@ void syncNodePingPeers(SSyncNode* pSyncNode) { } } -void syncNodePingSelf(SSyncNode* pSyncNode) { +int32_t syncNodePingSelf(SSyncNode* pSyncNode) { int32_t ret; SyncPing* pMsg = syncPingBuild3(&pSyncNode->raftId, &pSyncNode->raftId); ret = syncNodePing(pSyncNode, &pMsg->destId, pMsg); -- GitLab