This commit is contained in:
Hongze Cheng 2021-11-10 21:25:55 +08:00
parent 8c3f060a9d
commit a4b3bf6c1e
7 changed files with 55 additions and 16 deletions

View File

@ -16,15 +16,14 @@
#ifndef _TD_TSDB_H_ #ifndef _TD_TSDB_H_
#define _TD_TSDB_H_ #define _TD_TSDB_H_
#include "impl/tsdbImpl.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
// TYPES EXPOSED // TYPES EXPOSED
typedef struct STsdb STsdb; typedef struct STsdb STsdb;
typedef struct STsdbOptions STsdbOptions; typedef struct STsdbOptions STsdbOptions;
typedef struct STsdbMemAllocator STsdbMemAllocator;
// STsdb // STsdb
STsdb *tsdbOpen(const char *path, const STsdbOptions *); STsdb *tsdbOpen(const char *path, const STsdbOptions *);
@ -35,6 +34,12 @@ void tsdbRemove(const char *path);
int tsdbOptionsInit(STsdbOptions *); int tsdbOptionsInit(STsdbOptions *);
void tsdbOptionsClear(STsdbOptions *); void tsdbOptionsClear(STsdbOptions *);
/* ------------------------ STRUCT DEFINITIONS ------------------------ */
struct STsdbOptions {
uint64_t lruCacheSize;
/* TODO */
};
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -19,6 +19,7 @@
#include "mallocator.h" #include "mallocator.h"
#include "sync.h" #include "sync.h"
#include "tlockfree.h" #include "tlockfree.h"
#include "wal.h"
#include "vnode.h" #include "vnode.h"
#include "vnodeAllocatorPool.h" #include "vnodeAllocatorPool.h"
@ -41,6 +42,7 @@ struct SVnode {
SMeta* pMeta; SMeta* pMeta;
STsdb* pTsdb; STsdb* pTsdb;
STQ* pTq; STQ* pTq;
SWal* pWal;
SVnodeSync* pSync; SVnodeSync* pSync;
SVnodeFS* pFs; SVnodeFS* pFs;
}; };

View File

@ -16,10 +16,16 @@
#ifndef _TD_VNODE_MEM_ALLOCATOR_H_ #ifndef _TD_VNODE_MEM_ALLOCATOR_H_
#define _TD_VNODE_MEM_ALLOCATOR_H_ #define _TD_VNODE_MEM_ALLOCATOR_H_
#include "mallocator.h"
#include "vnode.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
SMemAllocator *vnodeCreateMemAllocator(SVnode *pVnode);
void vnodeDestroyMemAllocator(SMemAllocator *pma);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -15,6 +15,17 @@
#include "vnodeDef.h" #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_HEAP_ALLOCATOR 0
#define VNODE_ARENA_ALLOCATOR 1 #define VNODE_ARENA_ALLOCATOR 1
@ -97,4 +108,6 @@ void vnodeUnrefMemAllocator(SMemAllocator *pma) {
/* ------------------------ Heap Allocator IMPL ------------------------ */ /* ------------------------ Heap Allocator IMPL ------------------------ */
/* ------------------------ Arena Allocator IMPL ------------------------ */ /* ------------------------ Arena Allocator IMPL ------------------------ */
#endif

View File

@ -16,7 +16,10 @@
#ifndef _TD_TSDB_DEF_H_ #ifndef _TD_TSDB_DEF_H_
#define _TD_TSDB_DEF_H_ #define _TD_TSDB_DEF_H_
#include "mallocator.h"
#include "tsdb.h" #include "tsdb.h"
#include "tsdbMemTable.h"
#include "tsdbOptions.h" #include "tsdbOptions.h"
#ifdef __cplusplus #ifdef __cplusplus
@ -24,8 +27,9 @@ extern "C" {
#endif #endif
struct STsdb { struct STsdb {
char * path; char * path;
STsdbOptions options; STsdbOptions options;
STsdbMemAllocator *pTMA;
}; };
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -13,22 +13,17 @@
* 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_TSDB_IMPL_H_ #ifndef _TD_TSDB_MEM_TABLE_H_
#define _TD_TSDB_IMPL_H_ #define _TD_TSDB_MEM_TABLE_H_
#include "os.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
struct STsdbOptions { typedef struct SMemTable SMemTable;
size_t lruCacheSize;
/* TODO */
};
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /*_TD_TSDB_IMPL_H_*/ #endif /*_TD_TSDB_MEM_TABLE_H_*/

View File

@ -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/>.
*/