Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
73f802c3
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
73f802c3
编写于
1月 19, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more tkv
上级
3c512df9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
97 addition
and
30 deletion
+97
-30
source/libs/tdb/inc/tdb.h
source/libs/tdb/inc/tdb.h
+13
-13
source/libs/tdb/src/devinc/tdb_inc.h
source/libs/tdb/src/devinc/tdb_inc.h
+3
-11
source/libs/tdb/src/devinc/tdb_mpfile.h
source/libs/tdb/src/devinc/tdb_mpfile.h
+14
-4
source/libs/tdb/src/devinc/tdb_mpool.h
source/libs/tdb/src/devinc/tdb_mpool.h
+65
-0
source/libs/tdb/src/inc/tdbDB.h
source/libs/tdb/src/inc/tdbDB.h
+2
-2
未找到文件。
source/libs/tdb/inc/tdb.h
浏览文件 @
73f802c3
...
@@ -29,10 +29,10 @@ extern "C" {
...
@@ -29,10 +29,10 @@ extern "C" {
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
// Forward declarations
typedef
struct
TDB
TDB
;
typedef
struct
TDB
TDB
;
typedef
struct
TDB_MPOOL
TDB_MPOOL
;
//
typedef struct TDB_MPOOL TDB_MPOOL;
typedef
struct
TDB_MPFILE
TDB_MPFILE
;
//
typedef struct TDB_MPFILE TDB_MPFILE;
typedef
struct
TDB_CURSOR
TDB_CURSOR
;
//
typedef struct TDB_CURSOR TDB_CURSOR;
typedef
struct
{
typedef
struct
{
void
*
bdata
;
void
*
bdata
;
...
@@ -46,17 +46,17 @@ int tdbCloseDB(TDB* dbp, uint32_t flags);
...
@@ -46,17 +46,17 @@ int tdbCloseDB(TDB* dbp, uint32_t flags);
int
tdbPut
(
TDB
*
dbp
,
const
TDB_KEY
*
key
,
const
TDB_VALUE
*
value
,
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
);
int
tdbGet
(
TDB
*
dbp
,
const
TDB_KEY
*
key
,
TDB_VALUE
*
value
,
uint32_t
flags
);
// TDB_MPOOL
//
//
TDB_MPOOL
int
tdbOpenMPool
(
TDB_MPOOL
**
mp
);
//
int tdbOpenMPool(TDB_MPOOL** mp);
int
tdbCloseMPool
(
TDB_MPOOL
*
mp
);
//
int tdbCloseMPool(TDB_MPOOL* mp);
// TDB_MPFILE
//
//
TDB_MPFILE
int
tdbOpenMPFile
(
TDB_MPFILE
**
mpf
,
TDB_MPOOL
*
mp
);
//
int tdbOpenMPFile(TDB_MPFILE** mpf, TDB_MPOOL* mp);
int
tdbCloseMPFile
(
TDB_MPFILE
**
mpf
);
//
int tdbCloseMPFile(TDB_MPFILE** mpf);
// TDB_CURSOR
//
//
TDB_CURSOR
int
tdbOpenCursor
(
TDB
*
dbp
,
TDB_CURSOR
**
tdbcpp
);
//
int tdbOpenCursor(TDB* dbp, TDB_CURSOR** tdbcpp);
int
tdbCloseCurosr
(
TDB_CURSOR
*
tdbcp
);
//
int tdbCloseCurosr(TDB_CURSOR* tdbcp);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/libs/tdb/src/
inc/tdb_mpool
.h
→
source/libs/tdb/src/
devinc/tdb_inc
.h
浏览文件 @
73f802c3
...
@@ -13,23 +13,15 @@
...
@@ -13,23 +13,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#ifndef _TD_TDB_MPOOL_H_
#ifndef _TD_TDB_INC_H_
#define _TD_TDB_MPOOL_H_
#define _TD_TDB_INC_H_
#include "tdbDef.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
#endif
#endif
struct
TDB_MPOOL
{
pthread_mutex_t
mutex
;
int64_t
cachesize
;
pgsize_t
pgsize
;
};
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
#endif
/*_TD_TDB_MPOOL_H_*/
#endif
/*_TD_TDB_INC_H_*/
\ No newline at end of file
source/libs/tdb/src/inc/tdb_mpfile.h
→
source/libs/tdb/src/
dev
inc/tdb_mpfile.h
浏览文件 @
73f802c3
...
@@ -23,11 +23,21 @@
...
@@ -23,11 +23,21 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
struct
TDB_MPFILE
{
// Exposed handle
TDB_MPOOL
*
mp
;
// memory pool used to get/put pages in this file
typedef
struct
TDB_MPFILE
TDB_MPFILE
;
// Exposed apis
int
tdbMPFOpen
(
TDB_MPFILE
**
mpfp
,
const
char
*
fname
,
TDB_MPOOL
*
mp
);
int
tdbMPFClose
(
TDB_MPFILE
*
mpf
);
int
tdbMPFGet
(
TDB_MPFILE
*
mpf
,
pgid_t
pgid
,
void
*
addr
);
int
tdbMPFPut
(
TDB_MPOOL
*
mpf
,
pgid_t
pgid
,
void
*
addr
);
char
*
fname
;
// Hidden structures
int
fd
;
struct
TDB_MPFILE
{
uint8_t
fuid
[
20
];
// file unique ID
TDB_MPOOL
*
mp
;
// underlying memory pool
char
*
fname
;
// file name
int
fd
;
// fd
};
};
#ifdef __cplusplus
#ifdef __cplusplus
...
...
source/libs/tdb/src/devinc/tdb_mpool.h
0 → 100644
浏览文件 @
73f802c3
/*
* 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_MPOOL_H_
#define _TD_TDB_MPOOL_H_
#include "tdbDef.h"
#ifdef __cplusplus
extern
"C"
{
#endif
// Exposed handle
typedef
struct
TDB_MPOOL
TDB_MPOOL
;
// Exposed apis
int
tdbOpenMP
(
TDB_MPOOL
**
mpp
,
uint64_t
cachesize
,
pgsize_t
pgsize
);
int
tdbCloseMP
(
TDB_MPOOL
*
mp
);
int
tdbMPFetchPage
(
TDB_MPOOL
*
mp
,
mp_pgid_t
mpgid
,
void
*
p
);
int
tdbMpUnfetchPage
(
TDB_MPOOL
*
mp
,
mp_pgid_t
mpgid
,
void
*
p
);
// Hidden impls
#define TDB_FILE_UID_LEN 20
typedef
struct
{
uint8_t
fuid
[
TDB_FILE_UID_LEN
];
pgid_t
pgid
;
}
mp_pgid_t
;
typedef
struct
MP_PAGE
{
SRWLatch
rwLatch
;
mp_pgid_t
mpgid
;
uint8_t
dirty
;
int32_t
pinRef
;
// TD_DLIST_NODE(MP_PAGE); // The free list handle
char
*
page
[];
}
MP_PAGE
;
struct
TDB_MPOOL
{
pthread_mutex_t
mutex
;
int64_t
cachesize
;
pgsize_t
pgsize
;
MP_PAGE
*
pages
;
// TD_DBLIST(MP_PAGE) freeList;
// TD_DLIST(TD_MPFILE) mpfList; // MPFILE registered on this memory pool
// Hash<mp_pgid_t, frameid> hash;
};
#ifdef __cplusplus
}
#endif
#endif
/*_TD_TDB_MPOOL_H_*/
\ No newline at end of file
source/libs/tdb/src/inc/tdbDB.h
浏览文件 @
73f802c3
...
@@ -40,8 +40,8 @@ struct TDB {
...
@@ -40,8 +40,8 @@ struct TDB {
TDB_HEAP
*
heap
;
TDB_HEAP
*
heap
;
}
dbam
;
// db access method
}
dbam
;
// db access method
TDB_FH
*
fhp
;
// The backup file handle
//
TDB_FH * fhp; // The backup file handle
TDB_MPOOL
*
mph
;
// The memory pool handle
//
TDB_MPOOL *mph; // The memory pool handle
};
};
#ifdef __cplusplus
#ifdef __cplusplus
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录