提交 e26fbd80 编写于 作者: H Hongze Cheng

integrate nuraft

上级 6538f86e
...@@ -50,6 +50,11 @@ if(${BUILD_WITH_LUCENE}) ...@@ -50,6 +50,11 @@ if(${BUILD_WITH_LUCENE})
cat("${CMAKE_SUPPORT_DIR}/lucene_CMakeLists.txt.in" ${DEPS_TMP_FILE}) cat("${CMAKE_SUPPORT_DIR}/lucene_CMakeLists.txt.in" ${DEPS_TMP_FILE})
endif(${BUILD_WITH_LUCENE}) 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 ## download dependencies
configure_file(${DEPS_TMP_FILE} "${CMAKE_SOURCE_DIR}/deps/deps-download/CMakeLists.txt") configure_file(${DEPS_TMP_FILE} "${CMAKE_SOURCE_DIR}/deps/deps-download/CMakeLists.txt")
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
......
...@@ -25,6 +25,12 @@ option( ...@@ -25,6 +25,12 @@ option(
OFF OFF
) )
option(
BUILD_WITH_NURAFT
"If build with NuRaft"
OFF
)
option( option(
BUILD_DEPENDENCY_TESTS BUILD_DEPENDENCY_TESTS
"If build dependency tests" "If build dependency tests"
......
# 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 ""
)
\ No newline at end of file
...@@ -67,6 +67,12 @@ if(${BUILD_WITH_LUCENE}) ...@@ -67,6 +67,12 @@ if(${BUILD_WITH_LUCENE})
add_subdirectory(lucene) add_subdirectory(lucene)
endif(${BUILD_WITH_LUCENE}) endif(${BUILD_WITH_LUCENE})
# NuRaft
if(${BUILD_WITH_NURAFT})
add_subdirectory(nuraft)
endif(${BUILD_WITH_NURAFT})
# ================================================================================================ # ================================================================================================
# DEPENDENCY TEST # DEPENDENCY TEST
# ================================================================================================ # ================================================================================================
......
...@@ -31,7 +31,7 @@ SVnode *vnodeOpen(const char *path, const SVnodeOptions *pVnodeOptions); ...@@ -31,7 +31,7 @@ SVnode *vnodeOpen(const char *path, const SVnodeOptions *pVnodeOptions);
void vnodeClose(SVnode *pVnode); void vnodeClose(SVnode *pVnode);
void vnodeDestroy(const char *path); void vnodeDestroy(const char *path);
int vnodeProcessWriteReqs(SVnode *pVnode, SReqBatch *pReqBatch); 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 vnodeProcessReadReq(SVnode *pVnode, SRequest *pReq);
int vnodeProcessSyncReq(SVnode *pVnode, SRequest *pReq); int vnodeProcessSyncReq(SVnode *pVnode, SRequest *pReq);
......
...@@ -15,36 +15,14 @@ ...@@ -15,36 +15,14 @@
#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 vnodeApplyWriteRequest(SVnode *pVnode, const SRequest *pRequest) {
SReqBatchIter rbIter; /* TODO */
tdInitRBIter(&rbIter, pReqBatch);
for (;;) {
const SRequest *pReq = tdRBIterNext(&rbIter);
if (pReq == NULL) {
break;
}
if (vnodeApplyWriteRequest(pVnode, pReq) < 0) {
// TODO
}
}
tdClearRBIter(&rbIter);
return 0; return 0;
} }
/* ------------------------ STATIC METHODS ------------------------ */ /* ------------------------ STATIC METHODS ------------------------ */
static int vnodeApplyWriteRequest(SVnode *pVnode, const SRequest *pRequest) { \ No newline at end of file
/* TODO */
return 0;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册