未验证 提交 cf0ad02d 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #8427 from taosdata/feature/raft-interface

[feeature][raft]refactor sync interface
......@@ -24,10 +24,10 @@ extern "C" {
#include "taosdef.h"
#include "wal.h"
typedef uint32_t SyncNodeId;
typedef int32_t SyncGroupId;
typedef int64_t SyncIndex;
typedef uint64_t SyncTerm;
typedef int64_t SyncNodeId;
typedef int32_t SyncGroupId;
typedef int64_t SyncIndex;
typedef uint64_t SSyncTerm;
typedef enum {
TAOS_SYNC_ROLE_FOLLOWER = 0,
......@@ -41,9 +41,8 @@ typedef struct {
} SSyncBuffer;
typedef struct {
SyncNodeId nodeId; // node ID assigned by TDengine
uint16_t nodePort; // node sync Port
char nodeFqdn[TSDB_FQDN_LEN]; // node FQDN
uint16_t nodePort; // node sync Port
char nodeFqdn[TSDB_FQDN_LEN]; // node FQDN
} SNodeInfo;
typedef struct {
......@@ -53,9 +52,9 @@ typedef struct {
} SSyncCluster;
typedef struct {
int32_t selfIndex;
int nNode;
SyncNodeId* nodeId;
int32_t selfIndex;
int nNode;
SNodeInfo* node;
ESyncRole* role;
} SNodesRole;
......@@ -85,8 +84,8 @@ typedef struct SSyncFSM {
} SSyncFSM;
typedef struct SSyncServerState {
SyncNodeId voteFor;
SyncTerm term;
SNodeInfo voteFor;
SSyncTerm term;
} SSyncServerState;
typedef struct SStateManager {
......@@ -106,8 +105,8 @@ typedef struct {
twalh walHandle;
SyncIndex snapshotIndex; // initial version
SSyncCluster syncCfg; // configuration from mgmt
SyncIndex snapshotIndex;
SSyncCluster syncCfg;
SSyncFSM fsm;
......@@ -122,7 +121,11 @@ void syncStop(SyncNodeId);
int32_t syncPropose(SyncNodeId nodeId, SSyncBuffer buffer, void* pData, bool isWeak);
extern int32_t syncDebugFlag;
int32_t syncAddNode(SyncNodeId nodeId, const SNodeInfo *pNode);
int32_t syncRemoveNode(SyncNodeId nodeId, const SNodeInfo *pNode);
extern int32_t syncDebugFlag;
#ifdef __cplusplus
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册