sync refactor
This commit is contained in:
parent
ce71ba91bf
commit
3c9875e955
|
@ -88,16 +88,19 @@ typedef struct SSyncFSM {
|
||||||
|
|
||||||
} SSyncFSM;
|
} SSyncFSM;
|
||||||
|
|
||||||
|
struct SSyncRaftEntry;
|
||||||
|
typedef struct SSyncRaftEntry SSyncRaftEntry;
|
||||||
|
|
||||||
// abstract definition of log store in raft
|
// abstract definition of log store in raft
|
||||||
// SWal implements it
|
// SWal implements it
|
||||||
typedef struct SSyncLogStore {
|
typedef struct SSyncLogStore {
|
||||||
void* data;
|
void* data;
|
||||||
|
|
||||||
// append one log entry
|
// append one log entry
|
||||||
int32_t (*appendEntry)(struct SSyncLogStore* pLogStore, SRpcMsg* pEntry);
|
int32_t (*appendEntry)(struct SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry);
|
||||||
|
|
||||||
// get one log entry, user need to free pEntry->pCont
|
// get one log entry, user need to free pEntry->pCont
|
||||||
int32_t (*getEntry)(struct SSyncLogStore* pLogStore, SyncIndex index, SRpcMsg* pEntry);
|
SSyncRaftEntry* (*getEntry)(struct SSyncLogStore* pLogStore, SyncIndex index);
|
||||||
|
|
||||||
// truncate log with index, entries after the given index (>=index) will be deleted
|
// truncate log with index, entries after the given index (>=index) will be deleted
|
||||||
int32_t (*truncate)(struct SSyncLogStore* pLogStore, SyncIndex fromIndex);
|
int32_t (*truncate)(struct SSyncLogStore* pLogStore, SyncIndex fromIndex);
|
||||||
|
|
Loading…
Reference in New Issue