提交 523ba0ab 编写于 作者: H Hongze Cheng

refact

上级 1cc52364
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_META_DB_H_
#define _TD_META_DB_H_
#include "meta.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct SMetaDB SMetaDB;
int metaOpenDB(SMeta *pMeta);
void metaCloseDB(SMeta *pMeta);
int metaSaveTableToDB(SMeta *pMeta, STbCfg *pTbCfg);
int metaRemoveTableFromDb(SMeta *pMeta, tb_uid_t uid);
#ifdef __cplusplus
}
#endif
#endif /*_TD_META_DB_H_*/
\ No newline at end of file
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include "mallocator.h" #include "mallocator.h"
#include "meta.h" #include "meta.h"
#include "metaDB.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
...@@ -27,6 +26,13 @@ extern "C" { ...@@ -27,6 +26,13 @@ extern "C" {
typedef struct SMetaCache SMetaCache; typedef struct SMetaCache SMetaCache;
typedef struct SMetaIdx SMetaIdx; typedef struct SMetaIdx SMetaIdx;
typedef struct SMetaDB SMetaDB;
// SMetaDB
int metaOpenDB(SMeta* pMeta);
void metaCloseDB(SMeta* pMeta);
int metaSaveTableToDB(SMeta* pMeta, STbCfg* pTbCfg);
int metaRemoveTableFromDb(SMeta* pMeta, tb_uid_t uid);
// SMetaCache // SMetaCache
int metaOpenCache(SMeta* pMeta); int metaOpenCache(SMeta* pMeta);
...@@ -35,7 +41,7 @@ void metaCloseCache(SMeta* pMeta); ...@@ -35,7 +41,7 @@ void metaCloseCache(SMeta* pMeta);
// SMetaCfg // SMetaCfg
extern const SMetaCfg defaultMetaOptions; extern const SMetaCfg defaultMetaOptions;
// int metaValidateOptions(const SMetaCfg*); // int metaValidateOptions(const SMetaCfg*);
void metaOptionsCopy(SMetaCfg* pDest, const SMetaCfg* pSrc); void metaOptionsCopy(SMetaCfg* pDest, const SMetaCfg* pSrc);
// SMetaIdx // SMetaIdx
int metaOpenIdx(SMeta* pMeta); int metaOpenIdx(SMeta* pMeta);
...@@ -49,12 +55,12 @@ typedef struct STbUidGenerator { ...@@ -49,12 +55,12 @@ typedef struct STbUidGenerator {
} STbUidGenerator; } STbUidGenerator;
// STableUidGenerator // STableUidGenerator
int metaOpenUidGnrt(SMeta *pMeta); int metaOpenUidGnrt(SMeta* pMeta);
void metaCloseUidGnrt(SMeta *pMeta); void metaCloseUidGnrt(SMeta* pMeta);
// tb_uid_t // tb_uid_t
#define IVLD_TB_UID 0 #define IVLD_TB_UID 0
tb_uid_t metaGenerateUid(SMeta *pMeta); tb_uid_t metaGenerateUid(SMeta* pMeta);
struct SMeta { struct SMeta {
char* path; char* path;
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _TD_VND_H_ #ifndef _TD_VNODE_DEF_H_
#define _TD_VND_H_ #define _TD_VNODE_DEF_H_
#include "mallocator.h" #include "mallocator.h"
// #include "sync.h" // #include "sync.h"
...@@ -176,4 +176,4 @@ bool vmaIsFull(SVMemAllocator* pVMA); ...@@ -176,4 +176,4 @@ bool vmaIsFull(SVMemAllocator* pVMA);
} }
#endif #endif
#endif /*_TD_VND_H_*/ #endif /*_TD_VNODE_DEF_H_*/
\ No newline at end of file \ No newline at end of file
...@@ -30,11 +30,11 @@ SMeta *metaOpen(const char *path, const SMetaCfg *pMetaCfg, SMemAllocatorFactory ...@@ -30,11 +30,11 @@ SMeta *metaOpen(const char *path, const SMetaCfg *pMetaCfg, SMemAllocatorFactory
pMetaCfg = &defaultMetaOptions; pMetaCfg = &defaultMetaOptions;
} }
// Validate the options // // Validate the options
if (metaValidateOptions(pMetaCfg) < 0) { // if (metaValidateOptions(pMetaCfg) < 0) {
// TODO: deal with error // // TODO: deal with error
return NULL; // return NULL;
} // }
// Allocate handle // Allocate handle
pMeta = metaNew(path, pMetaCfg, pMAF); pMeta = metaNew(path, pMetaCfg, pMAF);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册