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

more

上级 5f0cf0ac
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "mallocator.h" #include "mallocator.h"
#include "os.h" #include "os.h"
#include "trow.h" #include "trow.h"
#include "tmsg.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
...@@ -36,39 +37,7 @@ typedef struct SMetaCfg { ...@@ -36,39 +37,7 @@ typedef struct SMetaCfg {
uint64_t lruSize; uint64_t lruSize;
} SMetaCfg; } SMetaCfg;
typedef struct STbCfg { typedef SVCreateTbReq STbCfg;
/// name of the table
char *name;
/// time to live of the table
uint32_t ttl;
/// keep time of this table
uint32_t keep;
/// type of table
uint8_t type;
union {
/// super table configurations
struct {
/// super table UID
tb_uid_t suid;
/// row schema
STSchema *pSchema;
/// tag schema
STSchema *pTagSchema;
} stbCfg;
/// normal table configuration
struct {
/// row schema
STSchema *pSchema;
} ntbCfg;
/// child table configuration
struct {
/// super table UID
tb_uid_t suid;
SKVRow pTag;
} ctbCfg;
};
} STbCfg;
// SMeta operations // SMeta operations
SMeta *metaOpen(const char *path, const SMetaCfg *pMetaCfg, SMemAllocatorFactory *pMAF); SMeta *metaOpen(const char *path, const SMetaCfg *pMetaCfg, SMemAllocatorFactory *pMAF);
......
...@@ -20,5 +20,5 @@ target_link_libraries( ...@@ -20,5 +20,5 @@ target_link_libraries(
# test # test
if(${BUILD_TEST}) if(${BUILD_TEST})
add_subdirectory(test) # add_subdirectory(test)
endif(${BUILD_TEST}) endif(${BUILD_TEST})
...@@ -52,6 +52,7 @@ int vnodeProcessWMsgs(SVnode *pVnode, SArray *pMsgs) { ...@@ -52,6 +52,7 @@ int vnodeProcessWMsgs(SVnode *pVnode, SArray *pMsgs) {
int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
SVnodeReq vReq; SVnodeReq vReq;
SVCreateTbReq vCreateTbReq;
void * ptr = vnodeMalloc(pVnode, pMsg->contLen); void * ptr = vnodeMalloc(pVnode, pMsg->contLen);
if (ptr == NULL) { if (ptr == NULL) {
// TODO: handle error // TODO: handle error
...@@ -62,17 +63,15 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { ...@@ -62,17 +63,15 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
// todo: change the interface here // todo: change the interface here
uint64_t ver; uint64_t ver;
taosDecodeFixedU64(pMsg->pCont, &ver); taosDecodeFixedU64(POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)), &ver);
if (tqPushMsg(pVnode->pTq, ptr, ver) < 0) { if (tqPushMsg(pVnode->pTq, ptr, ver) < 0) {
// TODO: handle error // TODO: handle error
} }
vnodeParseReq(pMsg->pCont, &vReq, pMsg->msgType);
switch (pMsg->msgType) { switch (pMsg->msgType) {
case TDMT_VND_CREATE_STB: case TDMT_VND_CREATE_STB:
case TDMT_MND_CREATE_TABLE: tDeserializeSVCreateTbReq(POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)), &vCreateTbReq);
if (metaCreateTable(pVnode->pMeta, &(vReq.ctReq)) < 0) { if (metaCreateTable(pVnode->pMeta, &(vCreateTbReq)) < 0) {
// TODO: handle error // TODO: handle error
} }
...@@ -90,6 +89,7 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { ...@@ -90,6 +89,7 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
} }
break; break;
default: default:
ASSERT(0);
break; break;
} }
......
...@@ -22,11 +22,11 @@ ...@@ -22,11 +22,11 @@
extern "C" { extern "C" {
#endif #endif
#define META_SUPER_TABLE 0 #define META_SUPER_TABLE TD_SUPER_TABLE
#define META_CHILD_TABLE 1 #define META_CHILD_TABLE TD_CHILD_TABLE
#define META_NORMAL_TABLE 2 #define META_NORMAL_TABLE TD_NORMAL_TABLE
int metaValidateTbOptions(SMeta *pMeta, const STbCfg *); int metaValidateTbCfg(SMeta *pMeta, const STbCfg *);
size_t metaEncodeTbObjFromTbOptions(const STbCfg *, void *pBuf, size_t bsize); size_t metaEncodeTbObjFromTbOptions(const STbCfg *, void *pBuf, size_t bsize);
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
int metaCreateTable(SMeta *pMeta, STbCfg *pTbCfg) { int metaCreateTable(SMeta *pMeta, STbCfg *pTbCfg) {
// Validate the tbOptions // Validate the tbOptions
if (metaValidateTbOptions(pMeta, pTbCfg) < 0) { if (metaValidateTbCfg(pMeta, pTbCfg) < 0) {
// TODO: handle error // TODO: handle error
return -1; return -1;
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "metaDef.h" #include "metaDef.h"
#include "tcoding.h" #include "tcoding.h"
int metaValidateTbOptions(SMeta *pMeta, const STbCfg *pTbOptions) { int metaValidateTbCfg(SMeta *pMeta, const STbCfg *pTbOptions) {
// TODO // TODO
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册