提交 8f9329ea 编写于 作者: H Hongze Cheng

refact

上级 553af66a
...@@ -51,31 +51,6 @@ int metaCommit(SMeta *pMeta); ...@@ -51,31 +51,6 @@ int metaCommit(SMeta *pMeta);
void metaOptionsInit(SMetaCfg *pMetaCfg); void metaOptionsInit(SMetaCfg *pMetaCfg);
void metaOptionsClear(SMetaCfg *pMetaCfg); void metaOptionsClear(SMetaCfg *pMetaCfg);
// STbCfg
#define META_INIT_STB_CFG(NAME, TTL, KEEP, SUID, PSCHEMA, PTAGSCHEMA) \
{ \
.name = (NAME), .ttl = (TTL), .keep = (KEEP), .type = META_SUPER_TABLE, .stbCfg = { \
.suid = (SUID), \
.pSchema = (PSCHEMA), \
.pTagSchema = (PTAGSCHEMA) \
} \
}
#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
} }
#endif #endif
......
...@@ -46,58 +46,4 @@ size_t metaEncodeTbObjFromTbOptions(const STbCfg *pTbOptions, void *pBuf, size_t ...@@ -46,58 +46,4 @@ size_t metaEncodeTbObjFromTbOptions(const STbCfg *pTbOptions, void *pBuf, size_t
} }
return tlen; return tlen;
}
int metaEncodeTbCfg(void **pBuf, STbCfg *pTbCfg) {
int tsize = 0;
tsize += taosEncodeString(pBuf, pTbCfg->name);
tsize += taosEncodeFixedU32(pBuf, pTbCfg->ttl);
tsize += taosEncodeFixedU32(pBuf, pTbCfg->keep);
tsize += taosEncodeFixedU8(pBuf, pTbCfg->type);
switch (pTbCfg->type) {
case META_SUPER_TABLE:
tsize += taosEncodeFixedU64(pBuf, pTbCfg->stbCfg.suid);
tsize += tdEncodeSchema(pBuf, pTbCfg->stbCfg.pSchema);
tsize += tdEncodeSchema(pBuf, pTbCfg->stbCfg.pTagSchema);
break;
case META_CHILD_TABLE:
tsize += taosEncodeFixedU64(pBuf, pTbCfg->ctbCfg.suid);
tsize += tdEncodeKVRow(pBuf, pTbCfg->ctbCfg.pTag);
break;
case META_NORMAL_TABLE:
tsize += tdEncodeSchema(pBuf, pTbCfg->ntbCfg.pSchema);
break;
default:
break;
}
return tsize;
}
void *metaDecodeTbCfg(void *pBuf, STbCfg *pTbCfg) {
pBuf = taosDecodeString(pBuf, &(pTbCfg->name));
pBuf = taosDecodeFixedU32(pBuf, &(pTbCfg->ttl));
pBuf = taosDecodeFixedU32(pBuf, &(pTbCfg->keep));
pBuf = taosDecodeFixedU8(pBuf, &(pTbCfg->type));
switch (pTbCfg->type) {
case META_SUPER_TABLE:
pBuf = taosDecodeFixedU64(pBuf, &(pTbCfg->stbCfg.suid));
pBuf = tdDecodeSchema(pBuf, &(pTbCfg->stbCfg.pSchema));
pBuf = tdDecodeSchema(pBuf, &(pTbCfg->stbCfg.pTagSchema));
break;
case META_CHILD_TABLE:
pBuf = taosDecodeFixedU64(pBuf, &(pTbCfg->ctbCfg.suid));
pBuf = tdDecodeKVRow(pBuf, &(pTbCfg->ctbCfg.pTag));
break;
case META_NORMAL_TABLE:
pBuf = tdDecodeSchema(pBuf, &(pTbCfg->ntbCfg.pSchema));
break;
default:
break;
}
return pBuf;
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册