提交 483809b3 编写于 作者: H Hongze Cheng

more

上级 8f9329ea
......@@ -18,8 +18,8 @@
#include "mallocator.h"
#include "os.h"
#include "trow.h"
#include "tmsg.h"
#include "trow.h"
#ifdef __cplusplus
extern "C" {
......@@ -47,6 +47,9 @@ int metaCreateTable(SMeta *pMeta, STbCfg *pTbCfg);
int metaDropTable(SMeta *pMeta, tb_uid_t uid);
int metaCommit(SMeta *pMeta);
// For Query
int metaGetTableInfo(SMeta *pMeta, const char *tbname, STableMetaMsg **ppMsg);
// Options
void metaOptionsInit(SMetaCfg *pMetaCfg);
void metaOptionsClear(SMetaCfg *pMetaCfg);
......
......@@ -35,6 +35,8 @@ typedef int8_t td_mode_flag_t;
#define TD_CHECK_AND_SET_MOD_CLEAR(FLAG) atomic_val_compare_exchange_8((FLAG), TD_MOD_UNCLEARD, TD_MOD_CLEARD)
#define TD_IS_NULL(PTR) ((PTR) == NULL)
#ifdef __cplusplus
}
#endif
......
......@@ -32,6 +32,22 @@ int vnodeProcessFetchReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
static int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
STableInfoMsg *pReq = (STableInfoMsg *)(pMsg->pCont);
STableMetaMsg *pRspMsg;
int ret;
if (metaGetTableInfo(pVnode->pMeta, pReq->tableFname, &pRspMsg) < 0) {
return -1;
}
*pRsp = malloc(sizeof(SRpcMsg));
if (TD_IS_NULL(*pRsp)) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
free(pMsg);
return -1;
}
// TODO
(*pRsp)->pCont = pRspMsg;
return 0;
}
\ No newline at end of file
......@@ -428,4 +428,20 @@ static void metaClearTbCfg(STbCfg *pTbCfg) {
} else if (pTbCfg->type == META_CHILD_TABLE) {
tfree(pTbCfg->ctbCfg.pTag);
}
}
/* ------------------------ FOR QUERY ------------------------ */
int metaGetTableInfo(SMeta *pMeta, const char *tbname, STableMetaMsg **ppMsg) {
DBT key = {0};
DBT value = {0};
SMetaDB *pMetaDB = pMeta->pDB;
key.data = tbname;
key.size = strlen(tbname) + 1;
pMetaDB->pNameIdx->get(pMetaDB->pNameIdx, NULL, &key, &value, 0);
// TODO: construct the message body
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.
先完成此消息的编辑!
想要评论请 注册