diff --git a/source/libs/sync/inc/syncMessage.h b/source/libs/sync/inc/syncMessage.h index f41a42346838e3e9ba77a164dba2b0021f6ce509..dcd8f7c74e9c59855056e372fe74000e44ab7a6c 100644 --- a/source/libs/sync/inc/syncMessage.h +++ b/source/libs/sync/inc/syncMessage.h @@ -24,8 +24,7 @@ extern "C" { #include #include #include "cJSON.h" -#include "sync.h" -#include "syncRaftEntry.h" +#include "syncInt.h" #include "taosdef.h" // encode as uint32 diff --git a/source/libs/sync/inc/syncRaftEntry.h b/source/libs/sync/inc/syncRaftEntry.h index 9cc05d44a931e28fabd115669ba0855a4e6e4f6d..53cf64702259de09e471f358dfc694311ffbf975 100644 --- a/source/libs/sync/inc/syncRaftEntry.h +++ b/source/libs/sync/inc/syncRaftEntry.h @@ -24,19 +24,24 @@ extern "C" { #include #include #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 diff --git a/source/libs/sync/inc/syncRaftLog.h b/source/libs/sync/inc/syncRaftLog.h index 8205f19d91f6f4d1851fa4dd81c00d7f042a6ba3..634d06903c9d946c1dc8a3adf40c808cd1162a15 100644 --- a/source/libs/sync/inc/syncRaftLog.h +++ b/source/libs/sync/inc/syncRaftLog.h @@ -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); diff --git a/source/libs/sync/src/syncRaftEntry.c b/source/libs/sync/src/syncRaftEntry.c index e525d3c7c26366aa5f64eb596ee0ad3e92ad9340..fff4f1b50bd3a0495e3b81857cbb1543735cfb99 100644 --- a/source/libs/sync/src/syncRaftEntry.c +++ b/source/libs/sync/src/syncRaftEntry.c @@ -14,3 +14,7 @@ */ #include "syncRaftEntry.h" + +SSyncRaftEntry* syncEntryBuild(SyncClientRequest* pMsg, SyncTerm term, SyncIndex index) {} + +void syncEntryDestory(SSyncRaftEntry* pEntry) {} \ No newline at end of file diff --git a/source/libs/sync/src/syncRaftLog.c b/source/libs/sync/src/syncRaftLog.c index d9b053b42d7a5e4a01a9afb67bdb55df9884ab01..c4e1feb374ac311b9ca59ac177c6c6146d06bfd9 100644 --- a/source/libs/sync/src/syncRaftLog.c +++ b/source/libs/sync/src/syncRaftLog.c @@ -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) {}