diff --git a/include/server/vnode/tsdb/tsdb.h b/include/server/vnode/tsdb/tsdb.h
index 949ac679ae..e92205378a 100644
--- a/include/server/vnode/tsdb/tsdb.h
+++ b/include/server/vnode/tsdb/tsdb.h
@@ -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
diff --git a/source/dnode/vnode/impl/inc/vnodeDef.h b/source/dnode/vnode/impl/inc/vnodeDef.h
index 3ad7de722e..5ffbd8dcff 100644
--- a/source/dnode/vnode/impl/inc/vnodeDef.h
+++ b/source/dnode/vnode/impl/inc/vnodeDef.h
@@ -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;
};
diff --git a/source/dnode/vnode/impl/inc/vnodeMemAllocator.h b/source/dnode/vnode/impl/inc/vnodeMemAllocator.h
index 7e9bd21fe3..9184eb416b 100644
--- a/source/dnode/vnode/impl/inc/vnodeMemAllocator.h
+++ b/source/dnode/vnode/impl/inc/vnodeMemAllocator.h
@@ -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
diff --git a/source/dnode/vnode/impl/src/vnodeMemAllocator.c b/source/dnode/vnode/impl/src/vnodeMemAllocator.c
index 3771a14113..902014eb47 100644
--- a/source/dnode/vnode/impl/src/vnodeMemAllocator.c
+++ b/source/dnode/vnode/impl/src/vnodeMemAllocator.c
@@ -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 ------------------------ */
\ No newline at end of file
+/* ------------------------ Arena Allocator IMPL ------------------------ */
+
+#endif
\ No newline at end of file
diff --git a/source/dnode/vnode/tsdb/inc/tsdbDef.h b/source/dnode/vnode/tsdb/inc/tsdbDef.h
index ebe0d6b4b0..0a17387ba7 100644
--- a/source/dnode/vnode/tsdb/inc/tsdbDef.h
+++ b/source/dnode/vnode/tsdb/inc/tsdbDef.h
@@ -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
diff --git a/include/server/vnode/tsdb/impl/tsdbImpl.h b/source/dnode/vnode/tsdb/inc/tsdbMemTable.h
similarity index 81%
rename from include/server/vnode/tsdb/impl/tsdbImpl.h
rename to source/dnode/vnode/tsdb/inc/tsdbMemTable.h
index 04d2ec43c9..15d868de9f 100644
--- a/include/server/vnode/tsdb/impl/tsdbImpl.h
+++ b/source/dnode/vnode/tsdb/inc/tsdbMemTable.h
@@ -13,22 +13,17 @@
* along with this program. If not, see .
*/
-#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_*/
\ No newline at end of file
+#endif /*_TD_TSDB_MEM_TABLE_H_*/
\ No newline at end of file
diff --git a/source/dnode/vnode/tsdb/src/tsdbMemTable.c b/source/dnode/vnode/tsdb/src/tsdbMemTable.c
new file mode 100644
index 0000000000..6dea4a4e57
--- /dev/null
+++ b/source/dnode/vnode/tsdb/src/tsdbMemTable.c
@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * 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 .
+ */
\ No newline at end of file