Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
fd94249f
TDengine
项目概览
taosdata
/
TDengine
11 个月 前同步成功
通知
1179
Star
22014
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fd94249f
编写于
2月 07, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact
上级
64cb09cc
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
84 addition
and
94 deletion
+84
-94
source/libs/tdb/src/db/btree.c
source/libs/tdb/src/db/btree.c
+3
-1
source/libs/tdb/src/db/pgcache.c
source/libs/tdb/src/db/pgcache.c
+16
-0
source/libs/tdb/src/db/pgfile.c
source/libs/tdb/src/db/pgfile.c
+3
-1
source/libs/tdb/src/db/tdb.c
source/libs/tdb/src/db/tdb.c
+47
-47
source/libs/tdb/src/inc/btree.h
source/libs/tdb/src/inc/btree.h
+2
-0
source/libs/tdb/src/inc/pgfile.h
source/libs/tdb/src/inc/pgfile.h
+9
-0
source/libs/tdb/src/inc/tdbInt.h
source/libs/tdb/src/inc/tdbInt.h
+4
-0
source/libs/tdb/src/inc/tdb_db.h
source/libs/tdb/src/inc/tdb_db.h
+0
-45
未找到文件。
source/libs/tdb/src/db/btree.c
浏览文件 @
fd94249f
...
...
@@ -11,4 +11,6 @@
*
* 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/>.
*/
\ No newline at end of file
*/
#include "tdbInt.h"
\ No newline at end of file
source/libs/tdb/src/db/pgcache.c
浏览文件 @
fd94249f
/*
* 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/>.
*/
#include "tdbInt.h"
\ No newline at end of file
source/libs/tdb/src/db/pgfile.c
浏览文件 @
fd94249f
...
...
@@ -11,4 +11,6 @@
*
* 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/>.
*/
\ No newline at end of file
*/
#include "tdbInt.h"
\ No newline at end of file
source/libs/tdb/src/db/tdb.c
浏览文件 @
fd94249f
...
...
@@ -13,61 +13,61 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "tdb
_db
.h"
#include "tdb
Int
.h"
static
int
tdbOpenImpl
(
TDB
*
dbp
);
//
static int tdbOpenImpl(TDB *dbp);
int
tdbOpen
(
TDB
**
dbpp
,
const
char
*
fname
,
const
char
*
dbname
,
uint32_t
flags
)
{
TDB
*
dbp
;
TDB_MPFILE
*
mpf
;
uint8_t
fileid
[
TDB_FILE_ID_LEN
];
//
int tdbOpen(TDB **dbpp, const char *fname, const char *dbname, uint32_t flags) {
//
TDB * dbp;
//
TDB_MPFILE *mpf;
//
uint8_t fileid[TDB_FILE_ID_LEN];
if
((
dbp
=
(
TDB
*
)
calloc
(
1
,
sizeof
(
*
dbp
)))
==
NULL
)
{
return
-
1
;
}
//
if ((dbp = (TDB *)calloc(1, sizeof(*dbp))) == NULL) {
//
return -1;
//
}
if
((
dbp
->
fname
=
strdup
(
fname
))
==
NULL
)
{
free
(
dbp
);
return
-
1
;
}
//
if ((dbp->fname = strdup(fname)) == NULL) {
//
free(dbp);
//
return -1;
//
}
if
((
dbname
)
&&
((
dbp
->
dbname
=
strdup
(
dbname
))
==
NULL
))
{
free
(
dbp
->
fname
);
free
(
dbp
);
return
-
1
;
}
//
if ((dbname) && ((dbp->dbname = strdup(dbname)) == NULL)) {
//
free(dbp->fname);
//
free(dbp);
//
return -1;
//
}
// if (tdbGnrtFileID(fname, fileid) < 0) {
// // todo
// return -1;
// }
//
// if (tdbGnrtFileID(fname, fileid) < 0) {
//
// // todo
//
// return -1;
//
// }
// TODO: mpf = tdbGetMPFileByID(fileid);
if
(
mpf
==
NULL
)
{
// todoerr: maybe we need to create one
return
-
1
;
}
//
// TODO: mpf = tdbGetMPFileByID(fileid);
//
if (mpf == NULL) {
//
// todoerr: maybe we need to create one
//
return -1;
//
}
if
(
tdbOpenImpl
(
dbp
)
<
0
)
{
// todoerr
return
-
1
;
}
//
if (tdbOpenImpl(dbp) < 0) {
//
// todoerr
//
return -1;
//
}
*
dbpp
=
dbp
;
return
0
;
}
//
*dbpp = dbp;
//
return 0;
//
}
int
tdbClose
(
TDB
*
dbp
,
uint32_t
flags
)
{
// TODO
return
0
;
}
//
int tdbClose(TDB *dbp, uint32_t flags) {
//
// TODO
//
return 0;
//
}
static
int
tdbOpenImpl
(
TDB
*
dbp
)
{
if
(
dbp
->
dbname
==
NULL
)
{
// todo: open the DB as a master DB
}
else
{
// todo: open the DB as a sub-db
}
// TODO
return
0
;
}
\ No newline at end of file
// static int tdbOpenImpl(TDB *dbp) {
// if (dbp->dbname == NULL) {
// // todo: open the DB as a master DB
// } else {
// // todo: open the DB as a sub-db
// }
// // TODO
// return 0;
// }
\ No newline at end of file
source/libs/tdb/src/inc/btree.h
浏览文件 @
fd94249f
...
...
@@ -16,6 +16,8 @@
#ifndef _TD_BTREE_H_
#define _TD_BTREE_H_
#include "tdbInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
...
...
source/libs/tdb/src/inc/pgfile.h
浏览文件 @
fd94249f
...
...
@@ -16,12 +16,21 @@
#ifndef _TD_PAGE_FILE_H_
#define _TD_PAGE_FILE_H_
#include "tdbInt.h"
#include "pgcache.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
SPgFile
SPgFile
;
struct
SPgFile
{
char
*
fname
;
// backend file name
SPgCache
*
pPgCache
;
// page cache underline
};
#ifdef __cplusplus
}
#endif
...
...
source/libs/tdb/src/inc/tdbInt.h
浏览文件 @
fd94249f
...
...
@@ -20,6 +20,8 @@
#include "tlist.h"
#include "tlockfree.h"
#include "tdb.h"
#ifdef __cplusplus
extern
"C"
{
#endif
...
...
@@ -51,6 +53,8 @@ typedef int32_t pgsize_t;
// tdb_log
#define tdbError(var)
#include "pgcache.h"
// tdb util
int
tdbGnrtFileID
(
const
char
*
fname
,
uint8_t
*
fileid
);
...
...
source/libs/tdb/src/inc/tdb_db.h
已删除
100644 → 0
浏览文件 @
64cb09cc
/*
* 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/>.
*/
#ifndef _TD_TDB_DB_H_
#define _TD_TDB_DB_H_
#include "tdb_mpool.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
TDB
TDB
;
struct
TDB
{
char
*
fname
;
char
*
dbname
;
TDB_MPFILE
*
mpf
;
// union {
// TDB_BTREE *btree;
// TDB_HASH * hash;
// TDB_HEAP * heap;
// } dbam; // db access method
};
int
tdbOpen
(
TDB
**
dbpp
,
const
char
*
fname
,
const
char
*
dbname
,
uint32_t
flags
);
int
tdbClose
(
TDB
*
dbp
,
uint32_t
flags
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_TDB_DB_H_*/
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录