refactor: modify FpSnapshotRead, FpSnapshotApply
This commit is contained in:
parent
cb20717ce6
commit
0a5412f33d
|
@ -98,8 +98,17 @@ typedef struct SSyncFSM {
|
|||
|
||||
void (*FpRestoreFinishCb)(struct SSyncFSM* pFsm);
|
||||
int32_t (*FpGetSnapshot)(struct SSyncFSM* pFsm, SSnapshot* pSnapshot);
|
||||
void* (*FpSnapshotRead)(struct SSyncFSM* pFsm, const SSnapshot* snapshot, void* iter, char** ppBuf, int32_t* len);
|
||||
int32_t (*FpSnapshotApply)(struct SSyncFSM* pFsm, const SSnapshot* snapshot, char* pBuf, int32_t len);
|
||||
|
||||
// if (*ppIter == NULL)
|
||||
// *ppIter = new iter;
|
||||
// else
|
||||
// *ppIter.next();
|
||||
//
|
||||
// if success, return 0. else return error code
|
||||
int32_t (*FpSnapshotRead)(struct SSyncFSM* pFsm, const SSnapshot* pSnapshot, void** ppIter, char** ppBuf, int32_t* len);
|
||||
|
||||
// apply data into fsm
|
||||
int32_t (*FpSnapshotApply)(struct SSyncFSM* pFsm, const SSnapshot* pSnapshot, char* pBuf, int32_t len);
|
||||
|
||||
void (*FpReConfigCb)(struct SSyncFSM* pFsm, SSyncCfg newCfg, SReConfigCbMeta cbMeta);
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ void mndRestoreFinish(struct SSyncFSM *pFsm) {
|
|||
pMnode->syncMgmt.restored = true;
|
||||
}
|
||||
|
||||
void* mndSnapshotRead(struct SSyncFSM* pFsm, const SSnapshot* snapshot, void* iter, char** ppBuf, int32_t* len) {
|
||||
int32_t mndSnapshotRead(struct SSyncFSM* pFsm, const SSnapshot* pSnapshot, void** ppIter, char** ppBuf, int32_t* len) {
|
||||
/*
|
||||
SMnode *pMnode = pFsm->data;
|
||||
SSdbIter *pIter;
|
||||
|
@ -68,10 +68,10 @@ void* mndSnapshotRead(struct SSyncFSM* pFsm, const SSnapshot* snapshot, void* it
|
|||
return pIter;
|
||||
*/
|
||||
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t mndSnapshotApply(struct SSyncFSM* pFsm, const SSnapshot* snapshot, char* pBuf, int32_t len) {
|
||||
int32_t mndSnapshotApply(struct SSyncFSM* pFsm, const SSnapshot* pSnapshot, char* pBuf, int32_t len) {
|
||||
SMnode *pMnode = pFsm->data;
|
||||
sdbWrite(pMnode->pSdb, (SSdbRaw*)pBuf);
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue