提交 7f4551db 编写于 作者: H Hongze Cheng

refact

上级 e7b97be7
......@@ -20,6 +20,41 @@
extern "C" {
#endif
typedef struct tkv_db_s tkv_db_t;
typedef struct {
/* data */
} tkv_key_t;
typedef struct {
bool pinned;
int64_t ref; // TODO: use util library
// TODO: add a RW latch here
void *pObj;
} tkv_obj_t;
typedef int (*tkv_key_comp_fn_t)(const tkv_key_t *, const tkv_key_t *);
typedef void (*tkv_get_key_fn_t)(const tkv_obj_t *, tkv_key_t *);
typedef int (*tkv_obj_encode_fn_t)(void **buf, void *pObj);
typedef void *(*tkv_obj_decode_fn_t)(void *buf, void **pObj);
typedef struct {
uint64_t memLimit : 63;
tkv_get_key_fn_t getKey;
tkv_obj_encode_fn_t encode;
tkv_obj_decode_fn_t decode;
} tkv_db_option_t;
tkv_db_t * tkvOpenDB(char *dir, tkv_db_option_t *);
int tkvCloseDB(tkv_db_t *);
int tkvPut(tkv_db_t *, tkv_obj_t *);
int tkvPutBatch(tkv_db_t *, tkv_obj_t **, int);
tkv_obj_t *tkvGet(tkv_key_t *);
int tkvGetBatch(tkv_db_t *, tkv_key_t **, int, tkv_obj_t **);
int tkvCommit(tkv_db_t *, void * /*TODO*/);
#ifdef __cplusplus
}
#endif
......
......@@ -16,12 +16,17 @@
#ifndef _TD_META_H_
#define _TD_META_H_
#include "taosMsg.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct SMeta SMeta;
int metaCreateTable(SMeta *pMeta, SCreateTableReq *pReq);
int metaDropTable(SMeta *pMeta, SDropTableReq *pReq);
int metaAlterTable(SMeta *pMeta, SAlterTableReq *pReq);
int metaCommit(SMeta *pMeta);
#ifdef __cplusplus
......
......@@ -4,4 +4,8 @@ target_include_directories(
meta
PUBLIC "${CMAKE_SOURCE_DIR}/include/server/vnode/meta"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
)
target_link_libraries(
meta
PUBLIC common
)
\ No newline at end of file
......@@ -20,6 +20,10 @@
extern "C" {
#endif
struct {
tkv_db_t db;
} SMeta;
#ifdef __cplusplus
}
#endif
......
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "meta.h"
int metaCreateTable(SMeta *pMeta, SCreateTableReq *pReq) {
// TODO
return 0;
}
int metaDropTable(SMeta *pMeta, SDropTableReq *pReq) {
// TODO
return 0;
}
int metaAlterTable(SMeta *pMeta, SAlterTableReq *pReq) {
// TODO
return 0;
}
int metaCommit(SMeta *pMeta) {
// TODO
return 0;
}
\ No newline at end of file
......@@ -18,7 +18,6 @@
int vnodeProcessSubmitReq(SVnode *pVnode, SSubmitReq *pReq, SSubmitRsp *pRsp) {
// TODO: Check inputs
#if 1
void *pMem = NULL;
if ((pMem = amalloc(pVnode->allocator, REQ_SIZE(pReq))) == NULL) {
// No more memory to allocate, schedule an async commit
......@@ -47,8 +46,6 @@ int vnodeProcessSubmitReq(SVnode *pVnode, SSubmitReq *pReq, SSubmitRsp *pRsp) {
// TODO: handler error
}
#endif
return 0;
}
......@@ -62,7 +59,7 @@ int vnodeProcessDropTableReq(SVnode *pVnode, SDropTableReq *pReq, SDropTableRsp
return 0;
}
int vnodeProcessAlterTableReq(SVnode *pVnode, SDropTableReq *pReq, SDropTableRsp *pRsp) {
int vnodeProcessAlterTableReq(SVnode *pVnode, SAlterTableReq *pReq, SAlterTableRsp *pRsp) {
// TODO
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册