提交 6d69cedd 编写于 作者: H Hongze Cheng

more

上级 2ae35c34
...@@ -27,6 +27,10 @@ extern "C" { ...@@ -27,6 +27,10 @@ extern "C" {
typedef uint64_t tb_uid_t; typedef uint64_t tb_uid_t;
typedef struct SMeta SMeta; typedef struct SMeta SMeta;
#define META_SUPER_TABLE 0
#define META_CHILD_TABLE 1
#define META_NORMAL_TABLE 2
typedef struct SMetaCfg { typedef struct SMetaCfg {
/// LRU cache size /// LRU cache size
uint64_t lruSize; uint64_t lruSize;
...@@ -37,6 +41,8 @@ typedef struct STbCfg { ...@@ -37,6 +41,8 @@ typedef struct STbCfg {
char *name; char *name;
/// time to live of the table /// time to live of the table
uint32_t ttl; uint32_t ttl;
/// keep time of this table
uint32_t keep;
/// type of table /// type of table
uint8_t type; uint8_t type;
union { union {
...@@ -76,15 +82,30 @@ int metaCommit(SMeta *pMeta); ...@@ -76,15 +82,30 @@ int metaCommit(SMeta *pMeta);
void metaOptionsInit(SMetaCfg *pOptions); void metaOptionsInit(SMetaCfg *pOptions);
void metaOptionsClear(SMetaCfg *pOptions); void metaOptionsClear(SMetaCfg *pOptions);
// STableOpts // STbCfg
// #define META_TABLE_OPTS_DECLARE(name) STableOpts name = {0} #define META_INIT_STB_CFG(NAME, TTL, KEEP, SUID, PSCHEMA, PTAGSCHEMA) \
// void metaNormalTableOptsInit(STbCfg *pTbOptions, const char *name, const STSchema *pSchema); { \
// void metaSuperTableOptsInit(STbCfg *pTbOptions, const char *name, tb_uid_t uid, const STSchema *pSchema, .name = (NAME), .ttl = (TTL), .keep = (KEEP), .type = META_SUPER_TABLE, .stbCfg = { \
// const STSchema *pTagSchema); .suid = (SUID), \
// void metaChildTableOptsInit(STbCfg *pTbOptions, const char *name, tb_uid_t suid, const SKVRow tags); .pSchema = (PSCHEMA), \
// void metaTableOptsClear(STbCfg *pTbOptions); .pTagSchema = (PTAGSCHEMA) \
// uint64_t metaEncodeTbOptions(void **pBuf, STbCfg *pTbOptions); } \
// STbCfg * metaDecodeTbOptions(void *pBuf, size_t size, bool endian); }
#define META_INIT_CTB_CFG(NAME, TTL, KEEP, SUID, PTAG) \
{ \
.name = (NAME), .ttl = (TTL), .keep = (KEEP), .type = META_CHILD_TABLE, .ctbCfg = {.suid = (SUID), .pTag = PTAG } \
}
#define META_INIT_NTB_CFG(NAME, TTL, KEEP, SUID, PSCHEMA) \
{ \
.name = (NAME), .ttl = (TTL), .keep = (KEEP), .type = META_NORMAL_TABLE, .ntbCfg = {.pSchema = (PSCHEMA) } \
}
#define META_CLEAR_TB_CFG(pTbCfg)
int metaEncodeTbCfg(void **pBuf, STbCfg *pTbCfg);
void *metaDecodeTbCfg(void *pBuf, STbCfg **pTbCfg);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -130,6 +130,16 @@ void vnodeOptionsInit(SVnodeCfg *pOptions); ...@@ -130,6 +130,16 @@ void vnodeOptionsInit(SVnodeCfg *pOptions);
*/ */
void vnodeOptionsClear(SVnodeCfg *pOptions); void vnodeOptionsClear(SVnodeCfg *pOptions);
/* ------------------------ REQUESTS ------------------------ */
// Create table request
typedef STbCfg SVCreateTableReq;
typedef struct {
int err;
char info[];
} SVCreateTableRsp;
/* ------------------------ FOR COMPILE ------------------------ */ /* ------------------------ FOR COMPILE ------------------------ */
#if 1 #if 1
......
...@@ -22,7 +22,7 @@ int vnodeProcessWMsgs(SVnode *pVnode, SArray *pMsgs) { ...@@ -22,7 +22,7 @@ int vnodeProcessWMsgs(SVnode *pVnode, SArray *pMsgs) {
for (size_t i = 0; i < taosArrayGetSize(pMsgs); i++) { for (size_t i = 0; i < taosArrayGetSize(pMsgs); i++) {
pReq = taosArrayGet(pMsgs, i); pReq = taosArrayGet(pMsgs, i);
vnodeApplyWMsg(pVnode, pReq, pRsp); vnodeApplyWMsg(pVnode, pReq, &pRsp);
} }
return 0; return 0;
......
...@@ -11,3 +11,14 @@ TEST(vnodeApiTest, vnodeOpen_vnodeClose_test) { ...@@ -11,3 +11,14 @@ TEST(vnodeApiTest, vnodeOpen_vnodeClose_test) {
// Close the vnode // Close the vnode
vnodeClose(pVnode); vnodeClose(pVnode);
} }
TEST(vnodeApiTest, vnode_process_create_table) {
STSchema * pSchema = NULL;
STSchema * pTagSchema = NULL;
char stname[15];
SVCreateTableReq pReq = META_INIT_STB_CFG(stname, UINT32_MAX, UINT32_MAX, 0, pSchema, pTagSchema);
int k = 10;
META_CLEAR_TB_CFG(pReq);
}
...@@ -46,4 +46,13 @@ size_t metaEncodeTbObjFromTbOptions(const STbCfg *pTbOptions, void *pBuf, size_t ...@@ -46,4 +46,13 @@ size_t metaEncodeTbObjFromTbOptions(const STbCfg *pTbOptions, void *pBuf, size_t
} }
return tlen; return tlen;
}
int metaEncodeTbCfg(void **pBuf, STbCfg *pTbCfg) {
// TODO
return 0;
}
void *metaDecodeTbCfg(void *pBuf, STbCfg **pTbCfg) {
// TODO
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册