[feeature][raft]refactor sync interface
This commit is contained in:
parent
048329e95e
commit
d5510988c2
|
@ -24,7 +24,7 @@ extern "C" {
|
||||||
#include "taosdef.h"
|
#include "taosdef.h"
|
||||||
#include "wal.h"
|
#include "wal.h"
|
||||||
|
|
||||||
typedef uint32_t SyncNodeId;
|
typedef int64_t SyncNodeId;
|
||||||
typedef int32_t SyncGroupId;
|
typedef int32_t SyncGroupId;
|
||||||
typedef int64_t SyncIndex;
|
typedef int64_t SyncIndex;
|
||||||
typedef uint64_t SSyncTerm;
|
typedef uint64_t SSyncTerm;
|
||||||
|
@ -41,7 +41,6 @@ typedef struct {
|
||||||
} SSyncBuffer;
|
} SSyncBuffer;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SyncNodeId nodeId; // node ID assigned by TDengine
|
|
||||||
uint16_t nodePort; // node sync Port
|
uint16_t nodePort; // node sync Port
|
||||||
char nodeFqdn[TSDB_FQDN_LEN]; // node FQDN
|
char nodeFqdn[TSDB_FQDN_LEN]; // node FQDN
|
||||||
} SNodeInfo;
|
} SNodeInfo;
|
||||||
|
@ -55,7 +54,7 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t selfIndex;
|
int32_t selfIndex;
|
||||||
int nNode;
|
int nNode;
|
||||||
SyncNodeId* nodeId;
|
SNodeInfo* node;
|
||||||
ESyncRole* role;
|
ESyncRole* role;
|
||||||
} SNodesRole;
|
} SNodesRole;
|
||||||
|
|
||||||
|
@ -86,7 +85,7 @@ typedef struct SSyncFSM {
|
||||||
} SSyncFSM;
|
} SSyncFSM;
|
||||||
|
|
||||||
typedef struct SSyncServerState {
|
typedef struct SSyncServerState {
|
||||||
SyncNodeId voteFor;
|
SNodeInfo voteFor;
|
||||||
SSyncTerm term;
|
SSyncTerm term;
|
||||||
} SSyncServerState;
|
} SSyncServerState;
|
||||||
|
|
||||||
|
@ -107,8 +106,8 @@ typedef struct {
|
||||||
|
|
||||||
twalh walHandle;
|
twalh walHandle;
|
||||||
|
|
||||||
SyncIndex snapshotIndex; // initial version
|
SyncIndex snapshotIndex;
|
||||||
SSyncCluster syncCfg; // configuration from mgmt
|
SSyncCluster syncCfg;
|
||||||
|
|
||||||
SSyncFSM fsm;
|
SSyncFSM fsm;
|
||||||
|
|
||||||
|
@ -123,7 +122,11 @@ void syncStop(SyncNodeId);
|
||||||
|
|
||||||
int32_t syncPropose(SyncNodeId nodeId, SSyncBuffer buffer, void *pData, bool isWeak);
|
int32_t syncPropose(SyncNodeId nodeId, SSyncBuffer buffer, void *pData, bool isWeak);
|
||||||
|
|
||||||
extern int32_t raftDebugFlag;
|
int32_t syncAddNode(SyncNodeId nodeId, const SNodeInfo *pNode);
|
||||||
|
|
||||||
|
int32_t syncRemoveNode(SyncNodeId nodeId, const SNodeInfo *pNode);
|
||||||
|
|
||||||
|
extern int32_t syncDebugFlag;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue