integrate nuraft
This commit is contained in:
parent
6538f86e5f
commit
e26fbd80fd
|
@ -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(
|
||||||
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"
|
||||||
|
|
|
@ -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 ""
|
||||||
|
)
|
|
@ -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);
|
||||||
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 @@
|
||||||
|
|
||||||
#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) {
|
|
||||||
/* TODO */
|
|
||||||
return 0;
|
|
||||||
}
|
|
Loading…
Reference in New Issue