This commit is contained in:
Hongze Cheng 2021-11-08 10:58:46 +08:00
parent 8b608cd3b7
commit 6538f86e5f
2 changed files with 40 additions and 0 deletions

View File

@ -20,10 +20,26 @@
extern "C" { extern "C" {
#endif #endif
/* ------------------------ TYPES EXPOSED ------------------------ */
typedef struct SRequest SRequest; typedef struct SRequest SRequest;
typedef struct SReqBatch SReqBatch; typedef struct SReqBatch SReqBatch;
typedef struct SReqBatchIter SReqBatchIter; typedef struct SReqBatchIter SReqBatchIter;
// SRequest
// SReqBatch
// SReqBatchIter
void tdInitRBIter(SReqBatchIter *pIter, SReqBatch *pReqBatch);
const SRequest *tdRBIterNext(SReqBatchIter *pIter);
void tdClearRBIter(SReqBatchIter *pIter);
/* ------------------------ TYPES DEFINITION ------------------------ */
struct SReqBatchIter {
int iReq;
SReqBatch *pReqBatch;
};
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -15,12 +15,36 @@
#include "vnodeDef.h" #include "vnodeDef.h"
static int vnodeApplyWriteRequest(SVnode *pVnode, const SRequest *pRequest);
int vnodeProcessWriteReqs(SVnode *pVnode, SReqBatch *pReqBatch) { int vnodeProcessWriteReqs(SVnode *pVnode, SReqBatch *pReqBatch) {
/* TODO */ /* TODO */
return 0; return 0;
} }
int vnodeApplyWriteReqs(SVnode *pVnode, SReqBatch *pReqBatch) { int vnodeApplyWriteReqs(SVnode *pVnode, SReqBatch *pReqBatch) {
SReqBatchIter rbIter;
tdInitRBIter(&rbIter, pReqBatch);
for (;;) {
const SRequest *pReq = tdRBIterNext(&rbIter);
if (pReq == NULL) {
break;
}
if (vnodeApplyWriteRequest(pVnode, pReq) < 0) {
// TODO
}
}
tdClearRBIter(&rbIter);
return 0;
}
/* ------------------------ STATIC METHODS ------------------------ */
static int vnodeApplyWriteRequest(SVnode *pVnode, const SRequest *pRequest) {
/* TODO */ /* TODO */
return 0; return 0;
} }