sync refactor
This commit is contained in:
parent
944bb33156
commit
1c3113686e
|
@ -35,6 +35,7 @@ typedef enum {
|
|||
TAOS_SYNC_STATE_FOLLOWER = 100,
|
||||
TAOS_SYNC_STATE_CANDIDATE = 101,
|
||||
TAOS_SYNC_STATE_LEADER = 102,
|
||||
TAOS_SYNC_STATE_ERROR = 103,
|
||||
} ESyncState;
|
||||
|
||||
typedef struct SSyncBuffer {
|
||||
|
@ -160,7 +161,6 @@ int32_t syncReconfig(int64_t rid, const SSyncCfg* pSyncCfg);
|
|||
int32_t syncPropose(int64_t rid, const SRpcMsg* pMsg, bool isWeak); // use this function
|
||||
int32_t syncForwardToPeer(int64_t rid, const SRpcMsg* pMsg, bool isWeak); // just for compatibility
|
||||
ESyncState syncGetMyRole(int64_t rid);
|
||||
void syncGetNodesRole(int64_t rid, SNodesRole* pNodeRole);
|
||||
|
||||
extern int32_t sDebugFlag;
|
||||
|
||||
|
|
|
@ -136,13 +136,14 @@ int32_t syncForwardToPeer(int64_t rid, const SRpcMsg* pMsg, bool isWeak) {
|
|||
}
|
||||
|
||||
ESyncState syncGetMyRole(int64_t rid) {
|
||||
// todo : get pointer from rid
|
||||
SSyncNode* pSyncNode = NULL;
|
||||
SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
|
||||
if (pSyncNode == NULL) {
|
||||
return TAOS_SYNC_STATE_ERROR;
|
||||
}
|
||||
assert(rid == pSyncNode->rid);
|
||||
return pSyncNode->state;
|
||||
}
|
||||
|
||||
void syncGetNodesRole(int64_t rid, SNodesRole* pNodeRole) {}
|
||||
|
||||
// open/close --------------
|
||||
SSyncNode* syncNodeOpen(const SSyncInfo* pSyncInfo) {
|
||||
SSyncNode* pSyncNode = (SSyncNode*)malloc(sizeof(SSyncNode));
|
||||
|
|
Loading…
Reference in New Issue