refact
This commit is contained in:
parent
8c3f060a9d
commit
a4b3bf6c1e
|
@ -16,15 +16,14 @@
|
|||
#ifndef _TD_TSDB_H_
|
||||
#define _TD_TSDB_H_
|
||||
|
||||
#include "impl/tsdbImpl.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// TYPES EXPOSED
|
||||
typedef struct STsdb STsdb;
|
||||
typedef struct STsdbOptions STsdbOptions;
|
||||
typedef struct STsdb STsdb;
|
||||
typedef struct STsdbOptions STsdbOptions;
|
||||
typedef struct STsdbMemAllocator STsdbMemAllocator;
|
||||
|
||||
// STsdb
|
||||
STsdb *tsdbOpen(const char *path, const STsdbOptions *);
|
||||
|
@ -35,6 +34,12 @@ void tsdbRemove(const char *path);
|
|||
int tsdbOptionsInit(STsdbOptions *);
|
||||
void tsdbOptionsClear(STsdbOptions *);
|
||||
|
||||
/* ------------------------ STRUCT DEFINITIONS ------------------------ */
|
||||
struct STsdbOptions {
|
||||
uint64_t lruCacheSize;
|
||||
/* TODO */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "mallocator.h"
|
||||
#include "sync.h"
|
||||
#include "tlockfree.h"
|
||||
#include "wal.h"
|
||||
|
||||
#include "vnode.h"
|
||||
#include "vnodeAllocatorPool.h"
|
||||
|
@ -41,6 +42,7 @@ struct SVnode {
|
|||
SMeta* pMeta;
|
||||
STsdb* pTsdb;
|
||||
STQ* pTq;
|
||||
SWal* pWal;
|
||||
SVnodeSync* pSync;
|
||||
SVnodeFS* pFs;
|
||||
};
|
||||
|
|
|
@ -16,10 +16,16 @@
|
|||
#ifndef _TD_VNODE_MEM_ALLOCATOR_H_
|
||||
#define _TD_VNODE_MEM_ALLOCATOR_H_
|
||||
|
||||
#include "mallocator.h"
|
||||
#include "vnode.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
SMemAllocator *vnodeCreateMemAllocator(SVnode *pVnode);
|
||||
void vnodeDestroyMemAllocator(SMemAllocator *pma);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -15,6 +15,17 @@
|
|||
|
||||
#include "vnodeDef.h"
|
||||
|
||||
SMemAllocator *vnodeCreateMemAllocator(SVnode *pVnode) {
|
||||
SMemAllocator *pma = NULL;
|
||||
/* TODO */
|
||||
return pma;
|
||||
}
|
||||
|
||||
void vnodeDestroyMemAllocator(SMemAllocator *pma) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
#if 0
|
||||
#define VNODE_HEAP_ALLOCATOR 0
|
||||
#define VNODE_ARENA_ALLOCATOR 1
|
||||
|
||||
|
@ -97,4 +108,6 @@ void vnodeUnrefMemAllocator(SMemAllocator *pma) {
|
|||
|
||||
/* ------------------------ Heap Allocator IMPL ------------------------ */
|
||||
|
||||
/* ------------------------ Arena Allocator IMPL ------------------------ */
|
||||
/* ------------------------ Arena Allocator IMPL ------------------------ */
|
||||
|
||||
#endif
|
|
@ -16,7 +16,10 @@
|
|||
#ifndef _TD_TSDB_DEF_H_
|
||||
#define _TD_TSDB_DEF_H_
|
||||
|
||||
#include "mallocator.h"
|
||||
|
||||
#include "tsdb.h"
|
||||
#include "tsdbMemTable.h"
|
||||
#include "tsdbOptions.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -24,8 +27,9 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
struct STsdb {
|
||||
char * path;
|
||||
STsdbOptions options;
|
||||
char * path;
|
||||
STsdbOptions options;
|
||||
STsdbMemAllocator *pTMA;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -13,22 +13,17 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _TD_TSDB_IMPL_H_
|
||||
#define _TD_TSDB_IMPL_H_
|
||||
|
||||
#include "os.h"
|
||||
#ifndef _TD_TSDB_MEM_TABLE_H_
|
||||
#define _TD_TSDB_MEM_TABLE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct STsdbOptions {
|
||||
size_t lruCacheSize;
|
||||
/* TODO */
|
||||
};
|
||||
typedef struct SMemTable SMemTable;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_TD_TSDB_IMPL_H_*/
|
||||
#endif /*_TD_TSDB_MEM_TABLE_H_*/
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
Loading…
Reference in New Issue