more
This commit is contained in:
parent
8f9329eaca
commit
483809b3e8
|
@ -18,8 +18,8 @@
|
||||||
|
|
||||||
#include "mallocator.h"
|
#include "mallocator.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "trow.h"
|
|
||||||
#include "tmsg.h"
|
#include "tmsg.h"
|
||||||
|
#include "trow.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -47,6 +47,9 @@ int metaCreateTable(SMeta *pMeta, STbCfg *pTbCfg);
|
||||||
int metaDropTable(SMeta *pMeta, tb_uid_t uid);
|
int metaDropTable(SMeta *pMeta, tb_uid_t uid);
|
||||||
int metaCommit(SMeta *pMeta);
|
int metaCommit(SMeta *pMeta);
|
||||||
|
|
||||||
|
// For Query
|
||||||
|
int metaGetTableInfo(SMeta *pMeta, const char *tbname, STableMetaMsg **ppMsg);
|
||||||
|
|
||||||
// Options
|
// Options
|
||||||
void metaOptionsInit(SMetaCfg *pMetaCfg);
|
void metaOptionsInit(SMetaCfg *pMetaCfg);
|
||||||
void metaOptionsClear(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_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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -32,6 +32,22 @@ int vnodeProcessFetchReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
|
||||||
|
|
||||||
static int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
|
static int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
|
||||||
STableInfoMsg *pReq = (STableInfoMsg *)(pMsg->pCont);
|
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
|
// TODO
|
||||||
|
(*pRsp)->pCont = pRspMsg;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
|
@ -428,4 +428,20 @@ static void metaClearTbCfg(STbCfg *pTbCfg) {
|
||||||
} else if (pTbCfg->type == META_CHILD_TABLE) {
|
} else if (pTbCfg->type == META_CHILD_TABLE) {
|
||||||
tfree(pTbCfg->ctbCfg.pTag);
|
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;
|
||||||
}
|
}
|
Loading…
Reference in New Issue