sync refactor
This commit is contained in:
parent
c462ef61e3
commit
3dfb9bb022
|
@ -24,8 +24,7 @@ extern "C" {
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "cJSON.h"
|
||||
#include "sync.h"
|
||||
#include "syncRaftEntry.h"
|
||||
#include "syncInt.h"
|
||||
#include "taosdef.h"
|
||||
|
||||
// encode as uint32
|
||||
|
|
|
@ -24,19 +24,24 @@ extern "C" {
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "syncInt.h"
|
||||
#include "syncMessage.h"
|
||||
#include "taosdef.h"
|
||||
|
||||
typedef struct SSyncRaftEntry {
|
||||
uint32_t bytes;
|
||||
uint32_t msgType;
|
||||
uint32_t originalRpcType;
|
||||
uint64_t seqNum;
|
||||
bool isWeak;
|
||||
SyncTerm term;
|
||||
SyncIndex index;
|
||||
int8_t flag;
|
||||
uint32_t dataLen;
|
||||
char data[];
|
||||
|
||||
} SSyncRaftEntry;
|
||||
|
||||
SSyncRaftEntry* syncEntryBuild(SyncClientRequest* pMsg, SyncTerm term, SyncIndex index);
|
||||
void syncEntryDestory(SSyncRaftEntry* pEntry);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -37,10 +37,10 @@ SSyncLogStore* logStoreCreate(SSyncNode* pSyncNode);
|
|||
void logStoreDestory(SSyncLogStore* pLogStore);
|
||||
|
||||
// append one log entry
|
||||
int32_t logStoreAppendEntry(SSyncLogStore* pLogStore, SRpcMsg* pEntry);
|
||||
int32_t logStoreAppendEntry(SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry);
|
||||
|
||||
// get one log entry, user need to free pEntry->pCont
|
||||
int32_t logStoreGetEntry(SSyncLogStore* pLogStore, SyncIndex index, SRpcMsg* pEntry);
|
||||
int32_t logStoreGetEntry(SSyncLogStore* pLogStore, SyncIndex index, SSyncRaftEntry* pEntry);
|
||||
|
||||
// truncate log with index, entries after the given index (>=index) will be deleted
|
||||
int32_t logStoreTruncate(SSyncLogStore* pLogStore, SyncIndex fromIndex);
|
||||
|
|
|
@ -14,3 +14,7 @@
|
|||
*/
|
||||
|
||||
#include "syncRaftEntry.h"
|
||||
|
||||
SSyncRaftEntry* syncEntryBuild(SyncClientRequest* pMsg, SyncTerm term, SyncIndex index) {}
|
||||
|
||||
void syncEntryDestory(SSyncRaftEntry* pEntry) {}
|
|
@ -44,10 +44,10 @@ void logStoreDestory(SSyncLogStore* pLogStore) {
|
|||
}
|
||||
|
||||
// append one log entry
|
||||
int32_t logStoreAppendEntry(SSyncLogStore* pLogStore, SRpcMsg* pEntry) {}
|
||||
int32_t logStoreAppendEntry(SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry) {}
|
||||
|
||||
// get one log entry, user need to free pEntry->pCont
|
||||
int32_t logStoreGetEntry(SSyncLogStore* pLogStore, SyncIndex index, SRpcMsg* pEntry) {}
|
||||
int32_t logStoreGetEntry(SSyncLogStore* pLogStore, SyncIndex index, SSyncRaftEntry* pEntry) {}
|
||||
|
||||
// truncate log with index, entries after the given index (>=index) will be deleted
|
||||
int32_t logStoreTruncate(SSyncLogStore* pLogStore, SyncIndex fromIndex) {}
|
||||
|
|
Loading…
Reference in New Issue