refact
This commit is contained in:
parent
5469e93829
commit
36d3adc23f
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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_CACHE_H_
|
||||
#define _TD_META_CACHE_H_
|
||||
|
||||
#include "meta.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int metaOpenCache(SMeta *pMeta);
|
||||
void metaCloseCache(SMeta *pMeta);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_TD_META_CACHE_H_*/
|
|
@ -17,20 +17,11 @@
|
|||
#define _TD_META_DB_H_
|
||||
|
||||
#include "meta.h"
|
||||
// #include "tkv.h"
|
||||
|
||||
#include "rocksdb/c.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct SMetaDB {
|
||||
rocksdb_t * pDB;
|
||||
rocksdb_t * pIdx;
|
||||
rocksdb_cache_t *pCache;
|
||||
} SMetaDB;
|
||||
|
||||
int metaOpenDB(SMeta *pMeta);
|
||||
void metaCloseDB(SMeta *pMeta);
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
#ifndef _TD_META_DEF_H_
|
||||
#define _TD_META_DEF_H_
|
||||
|
||||
#include "metaDB.h"
|
||||
#include "rocksdb/c.h"
|
||||
|
||||
#include "metaTbUid.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -24,10 +25,12 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
struct SMeta {
|
||||
char* path; // path of current meta
|
||||
SMetaOptions options; // meta option
|
||||
SMetaDB metaDB; // meta DB for real storage engine
|
||||
STbUidGenerator uidGnrt; // meta table UID generator
|
||||
char * path; // path of current meta
|
||||
SMetaOptions options; // meta option
|
||||
rocksdb_t * pDB;
|
||||
rocksdb_t * pIdx;
|
||||
rocksdb_cache_t *pCache;
|
||||
STbUidGenerator uidGnrt; // meta table UID generator
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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_IDX_H_
|
||||
#define _TD_META_IDX_H_
|
||||
|
||||
#include "meta.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int metaOpenIdx(SMeta *pMeta);
|
||||
void metaCloseIdx(SMeta *pMeta);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_TD_META_IDX_H_*/
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include "meta.h"
|
||||
#include "metaDef.h"
|
||||
|
||||
int metaOpenCache(SMeta *pMeta) {
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
void metaCloseCache(SMeta *pMeta) {
|
||||
// TODO
|
||||
}
|
|
@ -17,6 +17,7 @@
|
|||
#include "metaDef.h"
|
||||
|
||||
int metaOpenDB(SMeta *pMeta) {
|
||||
#if 0
|
||||
char * err = NULL;
|
||||
rocksdb_options_t *dbOptions;
|
||||
rocksdb_options_t *idxOptions;
|
||||
|
@ -69,10 +70,12 @@ int metaOpenDB(SMeta *pMeta) {
|
|||
|
||||
rocksdb_options_destroy(idxOptions);
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
void metaCloseDB(SMeta *pMeta) { /* TODO */
|
||||
#if 0
|
||||
// Close index DB
|
||||
if (pMeta->metaDB.pIdx) {
|
||||
rocksdb_close(pMeta->metaDB.pIdx);
|
||||
|
@ -87,4 +90,5 @@ void metaCloseDB(SMeta *pMeta) { /* TODO */
|
|||
if (pMeta->metaDB.pCache) {
|
||||
rocksdb_cache_destroy(pMeta->metaDB.pCache);
|
||||
}
|
||||
#endif
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include "metaIdx.h"
|
||||
|
||||
int metaOpenIdx(SMeta *pMeta) {
|
||||
/* TODO */
|
||||
return 0;
|
||||
}
|
||||
|
||||
void metaCloseIdx(SMeta *pMeta) { /* TODO */ }
|
Loading…
Reference in New Issue