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

more

上级 e5cd0915
......@@ -68,9 +68,11 @@ typedef struct SVnodeCfg {
/**
* @brief Initialize the vnode module
*
* @param nthreads number of commit threads. 0 for no threads and
* a schedule queue should be given (TODO)
* @return int 0 for success and -1 for failure
*/
int vnodeInit();
int vnodeInit(uint16_t nthreads);
/**
* @brief clear a vnode
......
......@@ -22,6 +22,9 @@
extern "C" {
#endif
int vnodeInitCommit(uint16_t nthreads);
void vnodeClearCommit();
#define vnodeShouldCommit vnodeBufPoolIsFull
int vnodeAsyncCommit(SVnode *pVnode);
......
......@@ -18,6 +18,15 @@
static int vnodeStartCommit(SVnode *pVnode);
static int vnodeEndCommit(SVnode *pVnode);
int vnodeInitCommit(uint16_t nthreads) {
// TODO
return 0;
}
void vnodeClearCommit() {
// TODO
}
int vnodeAsyncCommit(SVnode *pVnode) {
#if 0
if (vnodeStartCommit(pVnode) < 0) {
......
......@@ -24,7 +24,7 @@ static void vnodeCloseImpl(SVnode *pVnode);
TD_DEF_MOD_INIT_FLAG(vnode);
TD_DEF_MOD_CLEAR_FLAG(vnode);
int vnodeInit() {
int vnodeInit(uint16_t nthreads) {
if (TD_CHECK_AND_SET_MODE_INIT(vnode) == TD_MOD_INITIALIZED) {
return 0;
}
......@@ -33,6 +33,10 @@ int vnodeInit() {
return -1;
}
if (vnodeInitCommit(nthreads) < 0) {
return -1;
}
return 0;
}
......@@ -42,6 +46,8 @@ void vnodeClear() {
}
walCleanUp();
vnodeClearCommit();
}
SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg) {
......
......@@ -92,7 +92,7 @@ TEST(vnodeApiTest, test_create_table_encode_and_decode_function) {
#endif
TEST(vnodeApiTest, vnodeOpen_vnodeClose_test) {
GTEST_ASSERT_GE(vnodeInit(), 0);
GTEST_ASSERT_GE(vnodeInit(2), 0);
// Create and open a vnode
SVnode *pVnode = vnodeOpen("vnode1", NULL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册