From 36f1f3088437f2a4195eee1e7dc8fecfb1801191 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 13 Oct 2021 10:43:26 +0800 Subject: [PATCH] more --- source/server/vnode/tsdb/CMakeLists.txt | 4 +- source/server/vnode/tsdb/inc/tsdbMemTable.h | 41 +++++++++++++++++++++ source/server/vnode/tsdb/src/tsdb.c | 11 ++++++ source/server/vnode/tsdb/src/tsdbMemTable.c | 16 ++++++++ 4 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 source/server/vnode/tsdb/inc/tsdbMemTable.h create mode 100644 source/server/vnode/tsdb/src/tsdbMemTable.c diff --git a/source/server/vnode/tsdb/CMakeLists.txt b/source/server/vnode/tsdb/CMakeLists.txt index 426fa2a317..339971431b 100644 --- a/source/server/vnode/tsdb/CMakeLists.txt +++ b/source/server/vnode/tsdb/CMakeLists.txt @@ -8,5 +8,7 @@ target_include_directories( target_link_libraries( tsdb PUBLIC os - PRIVATE common + PUBLIC util + PUBLIC common + PUBLIC tkv ) \ No newline at end of file diff --git a/source/server/vnode/tsdb/inc/tsdbMemTable.h b/source/server/vnode/tsdb/inc/tsdbMemTable.h new file mode 100644 index 0000000000..b13c0579ce --- /dev/null +++ b/source/server/vnode/tsdb/inc/tsdbMemTable.h @@ -0,0 +1,41 @@ +/* + * 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 . + */ + +#ifndef _TD_TSDB_MEMTABLE_H_ +#define _TD_TSDB_MEMTABLE_H_ + +#include "tdef.h" +#include "thash.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct STsdbMemTable STsdbMemTable; + +/* --------------------- For compile and test only --------------------- */ +struct STsdbMemTable { + TSKEY minKey; + TSKEY maxKey; + SHashObj *tData; // uid --> SSkipList + void * mallocator; + T_REF_DECLARE() +}; + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_TSDB_MEMTABLE_H_*/ \ No newline at end of file diff --git a/source/server/vnode/tsdb/src/tsdb.c b/source/server/vnode/tsdb/src/tsdb.c index 56637ec74e..7fbb0a6868 100644 --- a/source/server/vnode/tsdb/src/tsdb.c +++ b/source/server/vnode/tsdb/src/tsdb.c @@ -14,6 +14,17 @@ */ #include "tsdb.h" +#include "tkv.h" +#include "tsdbMemTable.h" + +/* -------------- -------------- */ +struct STsdb { + STsdbMemTable *mem; + STsdbMemTable *imem; + STkvDb * lrowdb; // last row cache + STkvDb * lastdb; // last cache + // TODO +}; int tsdbInsert(STsdb *tsdb, SSubmitReq *pReq, SSubmitRsp *pRsp) { return 0; } int tsdbCommit(STsdb *pTsdb) { return 0; } \ No newline at end of file diff --git a/source/server/vnode/tsdb/src/tsdbMemTable.c b/source/server/vnode/tsdb/src/tsdbMemTable.c new file mode 100644 index 0000000000..a528419dd2 --- /dev/null +++ b/source/server/vnode/tsdb/src/tsdbMemTable.c @@ -0,0 +1,16 @@ +/* + * 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 . + */ + +#include "tsdbMemTable.h" \ No newline at end of file