diff --git a/source/libs/tdb/inc/tdb.h b/source/libs/tdb/inc/tdb.h index de83824170..e02f0f32b7 100644 --- a/source/libs/tdb/inc/tdb.h +++ b/source/libs/tdb/inc/tdb.h @@ -23,10 +23,11 @@ extern "C" { #endif typedef struct STDb TDB; +typedef struct STDbEnv TENV; int tdbCreate(TDB **ppDb); int tdbDestroy(TDB *pDb); -int tdbOpen(TDB **pDb); +int tdbOpen(TDB **pDb, const char *fname, const char *dbname); int tdbClose(TDB *pDb); #ifdef __cplusplus diff --git a/source/libs/tdb/src/db/btree.c b/source/libs/tdb/src/db/btree.c index 845bddc8b5..746ca6a99a 100644 --- a/source/libs/tdb/src/db/btree.c +++ b/source/libs/tdb/src/db/btree.c @@ -15,11 +15,6 @@ #include "tdbInt.h" -struct SBTree { - pgno_t root; - // TODO -}; - struct SBtCursor { // TODO }; \ No newline at end of file diff --git a/source/libs/tdb/src/db/tdb.c b/source/libs/tdb/src/db/tdb.c index ea819b34e7..f922a04ceb 100644 --- a/source/libs/tdb/src/db/tdb.c +++ b/source/libs/tdb/src/db/tdb.c @@ -16,8 +16,8 @@ #include "tdbInt.h" struct STDb { - // TODO - SBTree *pBt; + SBTree btree; // current access method + SPgFile *pPgFile; // backend page file this DB is using }; int tdbCreate(TDB **ppDb) { @@ -41,7 +41,7 @@ int tdbDestroy(TDB *pDb) { return 0; } -int tdbOpen(TDB **pDb) { +int tdbOpen(TDB **pDb, const char *fname, const char *dbname) { // TODO return 0; } diff --git a/source/libs/tdb/src/db/tdbEnv.c b/source/libs/tdb/src/db/tdbEnv.c new file mode 100644 index 0000000000..aae92f2bed --- /dev/null +++ b/source/libs/tdb/src/db/tdbEnv.c @@ -0,0 +1,21 @@ +/* + * 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 "tdbInt.h" + +struct STDbEnv { + TDB * dbList; // TDB list + SPgFile *pgFileList; // SPgFile list +}; \ No newline at end of file diff --git a/source/libs/tdb/src/inc/btree.h b/source/libs/tdb/src/inc/btree.h index 4b6fe589a9..2aa2f4528f 100644 --- a/source/libs/tdb/src/inc/btree.h +++ b/source/libs/tdb/src/inc/btree.h @@ -32,6 +32,10 @@ int btreeCursorOpen(SBtCursor *pBtCur, SBTree *pBt); int btreeCursorClose(SBtCursor *pBtCur); int btreeCursorMoveTo(SBtCursor *pBtCur); +struct SBTree { + pgno_t root; +}; + #ifdef __cplusplus } #endif