integrate nuraft

This commit is contained in:
Hongze Cheng 2021-11-08 11:43:39 +08:00
parent 6538f86e5f
commit e26fbd80fd
6 changed files with 33 additions and 26 deletions

View File

@ -50,6 +50,11 @@ if(${BUILD_WITH_LUCENE})
cat("${CMAKE_SUPPORT_DIR}/lucene_CMakeLists.txt.in" ${DEPS_TMP_FILE})
endif(${BUILD_WITH_LUCENE})
## NuRaft
if(${BUILD_WITH_NURAFT})
cat("${CMAKE_SUPPORT_DIR}/nuraft_CMakeLists.txt.in" ${DEPS_TMP_FILE})
endif(${BUILD_WITH_NURAFT})
## download dependencies
configure_file(${DEPS_TMP_FILE} "${CMAKE_SOURCE_DIR}/deps/deps-download/CMakeLists.txt")
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .

View File

@ -25,6 +25,12 @@ option(
OFF
)
option(
BUILD_WITH_NURAFT
"If build with NuRaft"
OFF
)
option(
BUILD_DEPENDENCY_TESTS
"If build dependency tests"

View File

@ -0,0 +1,12 @@
# NuRaft
ExternalProject_Add(NuRaft
GIT_REPOSITORY https://github.com/eBay/NuRaft.git
GIT_TAG v1.3.0
SOURCE_DIR "${CMAKE_SOURCE_DIR}/deps/nuraft"
BINARY_DIR "${CMAKE_SOURCE_DIR}/deps/nuraft"
CONFIGURE_COMMAND "./prepare.sh"
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)

6
deps/CMakeLists.txt vendored
View File

@ -67,6 +67,12 @@ if(${BUILD_WITH_LUCENE})
add_subdirectory(lucene)
endif(${BUILD_WITH_LUCENE})
# NuRaft
if(${BUILD_WITH_NURAFT})
add_subdirectory(nuraft)
endif(${BUILD_WITH_NURAFT})
# ================================================================================================
# DEPENDENCY TEST
# ================================================================================================

View File

@ -31,7 +31,7 @@ SVnode *vnodeOpen(const char *path, const SVnodeOptions *pVnodeOptions);
void vnodeClose(SVnode *pVnode);
void vnodeDestroy(const char *path);
int vnodeProcessWriteReqs(SVnode *pVnode, SReqBatch *pReqBatch);
int vnodeApplyWriteReqs(SVnode *pVnode, SReqBatch *pReqBatch);
int vnodeApplyWriteRequest(SVnode *pVnode, const SRequest *pRequest);
int vnodeProcessReadReq(SVnode *pVnode, SRequest *pReq);
int vnodeProcessSyncReq(SVnode *pVnode, SRequest *pReq);

View File

@ -15,36 +15,14 @@
#include "vnodeDef.h"
static int vnodeApplyWriteRequest(SVnode *pVnode, const SRequest *pRequest);
int vnodeProcessWriteReqs(SVnode *pVnode, SReqBatch *pReqBatch) {
/* TODO */
return 0;
}
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);
int vnodeApplyWriteRequest(SVnode *pVnode, const SRequest *pRequest) {
/* TODO */
return 0;
}
/* ------------------------ STATIC METHODS ------------------------ */
static int vnodeApplyWriteRequest(SVnode *pVnode, const SRequest *pRequest) {
/* TODO */
return 0;
}
/* ------------------------ STATIC METHODS ------------------------ */