diff --git a/source/libs/tdb/CMakeLists.txt b/source/libs/tdb/CMakeLists.txt
index eb63f2b14479e1e4cb45a4e2b1bf015a7b4699a1..bb8904117c2c283281b987b05df96a0e4bfd5415 100644
--- a/source/libs/tdb/CMakeLists.txt
+++ b/source/libs/tdb/CMakeLists.txt
@@ -1,5 +1,5 @@
-set(TDB_SUBDIRS "btree" "db" "hash" "mpool" "dmgr")
+set(TDB_SUBDIRS "db")
foreach(TDB_SUBDIR ${TDB_SUBDIRS})
aux_source_directory("src/${TDB_SUBDIR}" TDB_SRC)
endforeach()
@@ -18,5 +18,5 @@ target_link_libraries(
)
if(${BUILD_TEST})
- add_subdirectory(test)
+ # add_subdirectory(test)
endif(${BUILD_TEST})
diff --git a/source/libs/tdb/inc/tdb.h b/source/libs/tdb/inc/tdb.h
index 5264707eb85ee5a70858f3ce406e8ef297184fda..faf9208f8f8f454cb94ba880fd14a30e17f47d24 100644
--- a/source/libs/tdb/inc/tdb.h
+++ b/source/libs/tdb/inc/tdb.h
@@ -22,29 +22,29 @@
extern "C" {
#endif
-#define TDB_EXTERN
-#define TDB_PUBLIC
-#define TDB_STATIC static
+// #define TDB_EXTERN
+// #define TDB_PUBLIC
+// #define TDB_STATIC static
-typedef enum { TDB_BTREE_T = 0, TDB_HASH_T = 1, TDB_HEAP_T = 2 } tdb_db_t;
+// typedef enum { TDB_BTREE_T = 0, TDB_HASH_T = 1, TDB_HEAP_T = 2 } tdb_db_t;
-// Forward declarations
-typedef struct TDB TDB;
-// typedef struct TDB_MPOOL TDB_MPOOL;
-// typedef struct TDB_MPFILE TDB_MPFILE;
-// typedef struct TDB_CURSOR TDB_CURSOR;
+// // Forward declarations
+// typedef struct TDB TDB;
+// // typedef struct TDB_MPOOL TDB_MPOOL;
+// // typedef struct TDB_MPFILE TDB_MPFILE;
+// // typedef struct TDB_CURSOR TDB_CURSOR;
-typedef struct {
- void* bdata;
- uint32_t size;
-} TDB_KEY, TDB_VALUE;
+// typedef struct {
+// void* bdata;
+// uint32_t size;
+// } TDB_KEY, TDB_VALUE;
-// TDB Operations
-int tdbCreateDB(TDB** dbpp, tdb_db_t type);
-int tdbOpenDB(TDB* dbp, const char* fname, const char* dbname, uint32_t flags);
-int tdbCloseDB(TDB* dbp, uint32_t flags);
-int tdbPut(TDB* dbp, const TDB_KEY* key, const TDB_VALUE* value, uint32_t flags);
-int tdbGet(TDB* dbp, const TDB_KEY* key, TDB_VALUE* value, uint32_t flags);
+// // TDB Operations
+// int tdbCreateDB(TDB** dbpp, tdb_db_t type);
+// int tdbOpenDB(TDB* dbp, const char* fname, const char* dbname, uint32_t flags);
+// int tdbCloseDB(TDB* dbp, uint32_t flags);
+// int tdbPut(TDB* dbp, const TDB_KEY* key, const TDB_VALUE* value, uint32_t flags);
+// int tdbGet(TDB* dbp, const TDB_KEY* key, TDB_VALUE* value, uint32_t flags);
// // TDB_MPOOL
// int tdbOpenMPool(TDB_MPOOL** mp);
diff --git a/source/libs/tdb/src/db/tdbDB.c b/source/libs/tdb/src/db/tdbDB.c
index eaf85ea4a1930e2a6304986df43656ee07cb8e20..9fac9887d02acedfb00b1b4f3e05c95acbf104f9 100644
--- a/source/libs/tdb/src/db/tdbDB.c
+++ b/source/libs/tdb/src/db/tdbDB.c
@@ -13,6 +13,7 @@
* along with this program. If not, see .
*/
+#if 0
#include "tdbDB.h"
#include "tdb.h"
@@ -83,4 +84,5 @@ TDB_EXTERN int tdbOpenDB(TDB* dbp, const char* fname, const char* dbname, uint32
TDB_EXTERN int tdbCloseDB(TDB* dbp, uint32_t flags) {
// TODO
return 0;
-}
\ No newline at end of file
+}
+#endif
\ No newline at end of file
diff --git a/source/libs/tdb/src/devinc/tdb_inc.h b/source/libs/tdb/src/devinc/tdb_inc.h
deleted file mode 100644
index c05247c44a41002119a227bf691d31456a13ec7e..0000000000000000000000000000000000000000
--- a/source/libs/tdb/src/devinc/tdb_inc.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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_TDB_INC_H_
-#define _TD_TDB_INC_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*_TD_TDB_INC_H_*/
diff --git a/source/libs/tdb/src/dmgr/tdbDiskMgr.c b/source/libs/tdb/src/dmgr/tdbDiskMgr.c
deleted file mode 100644
index 71ab5f2589d7c56bbfe3e0a493f10fa54d085463..0000000000000000000000000000000000000000
--- a/source/libs/tdb/src/dmgr/tdbDiskMgr.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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 "tdbDiskMgr.h"
-
-struct STkvDiskMgr {
- char * fname;
- uint16_t pgsize;
- FileFd fd;
- pgid_t npgid;
-};
-
-#define PAGE_OFFSET(PGID, PGSIZE) ((PGID) * (PGSIZE))
-
-int tdmOpen(STkvDiskMgr **ppDiskMgr, const char *fname, uint16_t pgsize) {
- STkvDiskMgr *pDiskMgr;
-
- pDiskMgr = malloc(sizeof(*pDiskMgr));
- if (pDiskMgr == NULL) {
- return -1;
- }
-
- pDiskMgr->fname = strdup(fname);
- if (pDiskMgr->fname == NULL) {
- free(pDiskMgr);
- return -1;
- }
- pDiskMgr->pgsize = pgsize;
- pDiskMgr->fd = open(fname, O_CREAT | O_RDWR, 0755);
- if (pDiskMgr->fd < 0) {
- free(pDiskMgr->fname);
- free(pDiskMgr);
- return -1;
- }
-
- *ppDiskMgr = pDiskMgr;
-
- return 0;
-}
-
-int tdmClose(STkvDiskMgr *pDiskMgr) {
- close(pDiskMgr->fd);
- free(pDiskMgr->fname);
- free(pDiskMgr);
- return 0;
-}
-
-int tdmReadPage(STkvDiskMgr *pDiskMgr, pgid_t pgid, void *pData) {
- taosLSeekFile(pDiskMgr->fd, PAGE_OFFSET(pgid, pDiskMgr->pgsize), SEEK_SET);
- taosReadFile(pDiskMgr->fd, pData, pDiskMgr->pgsize);
- return 0;
-}
-
-int tdmWritePage(STkvDiskMgr *pDiskMgr, pgid_t pgid, const void *pData) {
- taosLSeekFile(pDiskMgr->fd, PAGE_OFFSET(pgid, pDiskMgr->pgsize), SEEK_SET);
- taosWriteFile(pDiskMgr->fd, pData, pDiskMgr->pgsize);
- return 0;
-}
-
-int tdmFlush(STkvDiskMgr *pDiskMgr) { return taosFsyncFile(pDiskMgr->fd); }
-
-int32_t tdmAllocPage(STkvDiskMgr *pDiskMgr) { return pDiskMgr->npgid++; }
\ No newline at end of file
diff --git a/source/libs/tdb/src/inc/tdbBtree.h b/source/libs/tdb/src/inc/tdbBtree.h
deleted file mode 100644
index 28258b8e60b7ea44f13fc56903d99e7427cdddfc..0000000000000000000000000000000000000000
--- a/source/libs/tdb/src/inc/tdbBtree.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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_TDB_BTREE_H_
-#define _TD_TDB_BTREE_H_
-
-#include "tdbDef.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
- pgid_t root; // root page number
-} TDB_BTREE;
-
-TDB_PUBLIC int tdbInitBtreeDB(TDB *dbp);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*_TD_TDB_BTREE_H_*/
\ No newline at end of file
diff --git a/source/libs/tdb/src/inc/tdbDB.h b/source/libs/tdb/src/inc/tdbDB.h
index c246c18775a673f26ec580b70ac3e4456f521e34..7607580d3e9da8ad34a37547d1e22694584c33a8 100644
--- a/source/libs/tdb/src/inc/tdbDB.h
+++ b/source/libs/tdb/src/inc/tdbDB.h
@@ -18,8 +18,6 @@
#include "tdb.h"
#include "tdbBtree.h"
-#include "tdbHash.h"
-#include "tdbHeap.h"
#ifdef __cplusplus
extern "C" {
@@ -34,11 +32,11 @@ struct TDB {
tdb_db_t type;
char * fname;
char * dbname;
- union {
- TDB_BTREE *btree;
- TDB_HASH * hash;
- TDB_HEAP * heap;
- } dbam; // db access method
+ // union {
+ // TDB_BTREE *btree;
+ // TDB_HASH * hash;
+ // TDB_HEAP * heap;
+ // } dbam; // db access method
// TDB_FH * fhp; // The backup file handle
// TDB_MPOOL *mph; // The memory pool handle
diff --git a/source/libs/tdb/src/inc/tdbDiskMgr.h b/source/libs/tdb/src/inc/tdbDiskMgr.h
deleted file mode 100644
index b83a1474371a6cbd3f0463ae5a2f160ae499eac5..0000000000000000000000000000000000000000
--- a/source/libs/tdb/src/inc/tdbDiskMgr.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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_TDISK_MGR_H_
-#define _TD_TDISK_MGR_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "os.h"
-
-#include "tdbDef.h"
-
-typedef struct STkvDiskMgr STkvDiskMgr;
-
-int tdmOpen(STkvDiskMgr **ppDiskMgr, const char *fname, uint16_t pgsize);
-int tdmClose(STkvDiskMgr *pDiskMgr);
-int tdmReadPage(STkvDiskMgr *pDiskMgr, pgid_t pgid, void *pData);
-int tdmWritePage(STkvDiskMgr *pDiskMgr, pgid_t pgid, const void *pData);
-int tdmFlush(STkvDiskMgr *pDiskMgr);
-pgid_t tdmAllocPage(STkvDiskMgr *pDiskMgr);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*_TD_TDISK_MGR_H_*/
\ No newline at end of file
diff --git a/source/libs/tdb/src/inc/tdbHash.h b/source/libs/tdb/src/inc/tdbHash.h
deleted file mode 100644
index 8219bda2f82eae05f7aa1fba5433c261272612b5..0000000000000000000000000000000000000000
--- a/source/libs/tdb/src/inc/tdbHash.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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_TDB_HASH_H_
-#define _TD_TDB_HASH_H_
-
-#include "tdbDef.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
- // TODO
-} TDB_HASH;
-
-TDB_PUBLIC int tdbInitHashDB(TDB *dbp);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*_TD_TDB_HASH_H_*/
\ No newline at end of file
diff --git a/source/libs/tdb/src/inc/tdbHeap.h b/source/libs/tdb/src/inc/tdbHeap.h
deleted file mode 100644
index 25a812fa5f7507624b6e4e02954735cbd0e38b00..0000000000000000000000000000000000000000
--- a/source/libs/tdb/src/inc/tdbHeap.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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_TDB_HEAP_H_
-#define _TD_TDB_HEAP_H_
-
-#include "tdbDef.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
- // TODO
-} TDB_HEAP;
-
-TDB_PUBLIC int tdbInitHeapDB(TDB *dbp);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*_TD_TDB_HEAP_H_*/
\ No newline at end of file
diff --git a/source/libs/tdb/src/inc/tdbPage.h b/source/libs/tdb/src/inc/tdbPage.h
deleted file mode 100644
index e7245b6c393be112a0b5ab9c64085aff5ae42615..0000000000000000000000000000000000000000
--- a/source/libs/tdb/src/inc/tdbPage.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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_TKV_PAGE_H_
-#define _TD_TKV_PAGE_H_
-
-#include "os.h"
-#include "tdbDef.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
- pgid_t pgid;
- int32_t pinCount;
- bool idDirty;
- char* pData;
-} STdbPage;
-
-typedef struct {
- uint16_t dbver;
- uint16_t pgsize;
- uint32_t cksm;
-} STdbPgHdr;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*_TD_TKV_PAGE_H_*/
\ No newline at end of file
diff --git a/source/libs/tdb/src/inc/tdbDef.h b/source/libs/tdb/src/inc/tdb_inc.h
similarity index 92%
rename from source/libs/tdb/src/inc/tdbDef.h
rename to source/libs/tdb/src/inc/tdb_inc.h
index 48a6831f869874e833cd0de6940cd735707f6b73..1e9c3dd8cce61facc1d26f0e02f1214d42b52add 100644
--- a/source/libs/tdb/src/inc/tdbDef.h
+++ b/source/libs/tdb/src/inc/tdb_inc.h
@@ -13,11 +13,10 @@
* along with this program. If not, see .
*/
-#ifndef _TD_TDB_DEF_H_
-#define _TD_TDB_DEF_H_
+#ifndef _TD_TDB_INC_H_
+#define _TD_TDB_INC_H_
#include "os.h"
-#include "tlist.h"
#ifdef __cplusplus
extern "C" {
@@ -41,4 +40,4 @@ typedef int32_t pgsize_t;
}
#endif
-#endif /*_TD_TDB_DEF_H_*/
\ No newline at end of file
+#endif /*_TD_TDB_INC_H_*/
diff --git a/source/libs/tdb/src/devinc/tdb_mpfile.h b/source/libs/tdb/src/inc/tdb_mpfile.h
similarity index 100%
rename from source/libs/tdb/src/devinc/tdb_mpfile.h
rename to source/libs/tdb/src/inc/tdb_mpfile.h
diff --git a/source/libs/tdb/src/devinc/tdb_mpool.h b/source/libs/tdb/src/inc/tdb_mpool.h
similarity index 97%
rename from source/libs/tdb/src/devinc/tdb_mpool.h
rename to source/libs/tdb/src/inc/tdb_mpool.h
index 4acf8bef8ce27dfb882f714d7dcc8dfeb13c9f87..1023b14a5027fe6d6fa6488518ee3ef25a3f5e35 100644
--- a/source/libs/tdb/src/devinc/tdb_mpool.h
+++ b/source/libs/tdb/src/inc/tdb_mpool.h
@@ -16,7 +16,7 @@
#ifndef _TD_TDB_MPOOL_H_
#define _TD_TDB_MPOOL_H_
-#include "tdbDef.h"
+#include "tdb_inc.h"
#ifdef __cplusplus
extern "C" {
diff --git a/source/libs/tdb/src/mpool/tdb_mpool.c b/source/libs/tdb/src/mpool/tdb_mpool.c
deleted file mode 100644
index 6dea4a4e57392be988126c579648f39a8270b9bf..0000000000000000000000000000000000000000
--- a/source/libs/tdb/src/mpool/tdb_mpool.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * 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