Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d89aae08
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
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,发现更多精彩内容 >>
提交
d89aae08
编写于
10月 08, 2021
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more
上级
4e306a79
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
104 addition
and
78 deletion
+104
-78
include/libs/tkv/tkv.h
include/libs/tkv/tkv.h
+19
-46
include/server/vnode/meta/meta.h
include/server/vnode/meta/meta.h
+31
-5
include/server/vnode/tsdb/tsdb.h
include/server/vnode/tsdb/tsdb.h
+54
-27
未找到文件。
include/libs/tkv/tkv.h
浏览文件 @
d89aae08
...
@@ -20,52 +20,25 @@
...
@@ -20,52 +20,25 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
typedef
struct
tkv_db_s
tkv_db_t
;
// Types exported
typedef
struct
STkvDb
STkvDb
;
typedef
struct
{
typedef
struct
STkvOptions
STkvOptions
;
/* data */
typedef
struct
STkvCache
STkvCache
;
}
tkv_key_t
;
// DB operations
typedef
struct
{
STkvDb
*
tkvOpen
(
const
STkvOptions
*
options
,
const
char
*
path
);
bool
pinned
;
void
tkvClose
(
STkvDb
*
db
);
int64_t
ref
;
// TODO: use util library
void
tkvPut
(
STkvDb
*
db
,
void
*
/*TODO*/
);
// TODO: add a RW latch here
uint64_t
offset
;
// DB options
void
*
pObj
;
STkvOptions
*
tkvOptionsCreate
();
}
tkv_obj_t
;
void
tkvOptionsDestroy
(
STkvOptions
*
);
void
tkvOptionsSetCache
(
STkvOptions
*
,
STkvCache
*
);
typedef
int
(
*
tkv_key_comp_fn_t
)(
const
tkv_key_t
*
,
const
tkv_key_t
*
);
typedef
void
(
*
tkv_get_key_fn_t
)(
const
tkv_obj_t
*
,
tkv_key_t
*
);
// DB cache
typedef
int
(
*
tkv_obj_encode_fn_t
)(
void
**
buf
,
void
*
pObj
);
typedef
enum
{
TKV_LRU_CACHE
=
0
,
TKV_LFU_CACHE
=
1
}
ETkvCacheType
;
typedef
void
*
(
*
tkv_obj_decode_fn_t
)(
void
*
buf
,
void
**
pObj
);
STkvCache
*
tkvCacheCreate
(
size_t
capacity
,
ETkvCacheType
type
);
typedef
int
(
*
tkv_obj_comp_fn_t
)(
const
tkv_obj_t
*
,
const
tkv_obj_t
*
);
void
tkvCacheDestroy
(
STkvCache
*
);
typedef
void
(
*
tkv_obj_destroy_fn_t
)(
void
*
);
typedef
struct
{
uint64_t
memLimit
;
tkv_get_key_fn_t
getKey
;
tkv_obj_encode_fn_t
encode
;
tkv_obj_decode_fn_t
decode
;
tkv_obj_comp_fn_t
compare
;
tkv_obj_destroy_fn_t
destroy
;
}
tkv_db_option_t
;
tkv_db_t
*
tkvOpenDB
(
char
*
dir
,
tkv_db_option_t
*
);
int
tkvCloseDB
(
tkv_db_t
*
);
int
tkvPut
(
tkv_db_t
*
,
tkv_obj_t
*
);
int
tkvPutBatch
(
tkv_db_t
*
,
tkv_obj_t
**
,
int
);
// TODO: use array here
const
tkv_obj_t
*
tkvGet
(
tkv_key_t
*
);
int
tkvGetBatch
(
tkv_db_t
*
,
tkv_key_t
**
,
int
,
tkv_obj_t
**
);
// TODO: use array here
int
tkvDrop
(
tkv_db_t
*
,
tkv_key_t
*
);
int
tkvDropBatch
(
tkv_db_t
*
,
tkv_key_t
**
,
int
);
// TODO: use array here
int
tkvCommit
(
tkv_db_t
*
,
void
*
/*TODO*/
);
typedef
struct
{
}
tkv_db_iter_t
;
tkv_db_iter_t
*
tkvIterNew
(
tkv_db_t
*
);
void
tkvIterFree
(
tkv_db_iter_t
*
);
const
tkv_obj_t
*
tkvIterNext
(
tkv_db_iter_t
*
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
include/server/vnode/meta/meta.h
浏览文件 @
d89aae08
...
@@ -18,16 +18,42 @@
...
@@ -18,16 +18,42 @@
#include "taosMsg.h"
#include "taosMsg.h"
#include "os.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
#endif
#endif
typedef
struct
SMeta
SMeta
;
typedef
uint64_t
tuid_t
;
// Types exported
typedef
struct
SMeta
SMeta
;
typedef
struct
SMetaOptions
SMetaOptions
;
typedef
struct
SMetaQueryHandle
SMetaQueryHandle
;
typedef
struct
SMetaQueryOptions
SMetaQueryOptions
;
// SMeta operations
int
metaCreate
(
const
char
*
path
);
int
metaDestroy
(
const
char
*
path
);
SMeta
*
metaOpen
(
SMetaOptions
*
);
void
metaClose
(
SMeta
*
);
int
metaCreateTable
(
SMeta
*
,
void
*
);
int
metaDropTable
(
SMeta
*
,
uint64_t
tuid_t
);
int
metaAlterTable
(
SMeta
*
,
void
*
);
int
metaCommit
(
SMeta
*
);
// Options
SMetaOptions
*
metaOptionsCreate
();
void
metaOptionsDestroy
(
SMetaOptions
*
);
void
metaOptionsSetCache
(
SMetaOptions
*
,
size_t
capacity
);
// SMetaQueryHandle
SMetaQueryHandle
*
metaQueryHandleCreate
(
SMetaQueryOptions
*
);
void
metaQueryHandleDestroy
(
SMetaQueryHandle
*
);
int
metaCreateTable
(
SMeta
*
pMeta
,
SCreateTableReq
*
pReq
);
// SMetaQueryOptions
int
metaDropTable
(
SMeta
*
pMeta
,
SDropTableReq
*
pReq
);
SMetaQueryOptions
*
metaQueryOptionsCreate
();
int
metaAlterTable
(
SMeta
*
pMeta
,
SAlterTableReq
*
pReq
);
void
metaQueryOptionsDestroy
(
SMetaQueryOptions
*
);
int
metaCommit
(
SMeta
*
pMeta
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
include/server/vnode/tsdb/tsdb.h
浏览文件 @
d89aae08
...
@@ -23,33 +23,60 @@
...
@@ -23,33 +23,60 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
typedef
struct
STsdb
STsdb
;
// Types exported
typedef
struct
{
typedef
struct
STsdb
STsdb
;
int32_t
id
;
// TODO: use a global definition
typedef
struct
STsdbOptions
STsdbOptions
;
int32_t
days
;
typedef
struct
STsdbSMAOptions
STsdbSMAOptions
;
// SMA stands for Small Materialized Aggregation
int32_t
keep
;
typedef
struct
STsdbReadOptions
STsdbReadOptions
;
int32_t
keep1
;
typedef
struct
STsdbSnapshot
STsdbSnapshot
;
int32_t
keep2
;
typedef
struct
STsdbQueryHandle
STsdbQueryHandle
;
int32_t
minRows
;
int32_t
maxRows
;
// DB operations
int8_t
precision
;
int
tsdbCreate
(
const
char
*
path
);
int8_t
update
;
int
tsdbDestroy
(
const
char
*
path
);
}
STsdbCfg
;
STsdb
*
tsdbOpen
(
const
STsdbOptions
*
options
);
void
tsdbClose
(
STsdb
*
);
// Module init and clear
int
tsdbReset
(
STsdb
*
,
const
STsdbOptions
*
);
int
tsdbInit
();
int
tsdbInsert
(
STsdb
*
,
SSubmitReq
*
,
SSubmitRsp
*
);
int
tsdbClear
();
int
tsdbCommit
(
STsdb
*
);
int
tsdbCompact
(
STsdb
*
);
// Repository operations
int
tsdbCreateRepo
(
int
id
);
// Options
int
tsdbDropRepo
(
int
id
);
STsdbOptions
*
tsdbOptionsCreate
();
STsdb
*
tsdbOpenRepo
(
STsdbCfg
*
pCfg
);
void
tsdbOptionsDestroy
(
STsdbOptions
*
);
int
tsdbCloseRepo
(
STsdb
*
pTsdb
);
void
tsdbOptionsSetId
(
STsdbOptions
*
,
int
id
);
int
tsdbForceCloseRepo
(
STsdb
*
pTsdb
);
void
tsdbOptionsSetHoursPerFile
(
STsdbOptions
*
,
int
hours
);
void
tsdbOptionsSetRetention
(
STsdbOptions
*
,
int
keep
,
int
keep1
,
int
keep2
);
// Data commit
void
tsdbOptionsSetMinAndMaxRows
(
STsdbOptions
*
,
int
minRows
,
int
maxRows
);
int
tsdbInsert
(
STsdb
*
pTsdb
,
SSubmitReq
*
pMsg
);
void
tsdbOptionsSetPrecision
(
STsdbOptions
*
,
int
);
int
tsdbCommit
(
STsdb
*
pTsdb
);
void
tsdbOptionsSetCache
(
STsdbOptions
*
,
int
);
typedef
enum
{
TSDB_NO_UPDATE
=
0
,
TSDB_WHOLE_ROW_UPDATE
=
1
,
TSDB_PARTIAL_ROW_UPDATE
=
2
}
ETsdbUpdateType
;
void
tsdbOptionsSetUpdate
(
STsdbOptions
*
,
ETsdbUpdateType
);
void
tsdbOptionsSetSMA
(
STsdbOptions
*
,
STsdbSMAOptions
*
);
// STsdbSMAOptions
STsdbSMAOptions
*
tsdbSMAOptionsCreate
();
void
tsdbSMAOptionsDestroy
(
STsdbSMAOptions
*
);
void
tsdbSMAOptionsSetFuncs
(
STsdbSMAOptions
*
,
SArray
*
/*Array of function to perform on each block*/
);
void
tsdbSMAOptionsSetIntervals
(
STsdbSMAOptions
*
,
SArray
*
);
void
tsdbSMAOptionsSetColTypes
(
STsdbSMAOptions
*
,
SArray
*
);
// STsdbQueryHandle
STsdbQueryHandle
*
tsdbQueryHandleCreate
(
STsdb
*
,
STsdbReadOptions
*
);
void
tsdbQueryHandleDestroy
(
STsdbQueryHandle
*
);
void
tsdbResetQueryHandle
(
STsdbQueryHandle
*
,
STsdbReadOptions
*
);
bool
tsdbNextDataBlock
(
STsdbQueryHandle
*
);
void
tsdbGetDataBlockInfo
(
STsdbQueryHandle
*
,
SDataBlockInfo
*
);
void
tsdbGetDataBlockStatisInfo
(
STsdbQueryHandle
*
,
SDataStatis
**
);
// STsdbReadOptions
STsdbReadOptions
*
tsdbReadOptionsCreate
();
void
tsdbReadOptionsDestroy
(
STsdbReadOptions
*
);
void
tsdbReadOptionsSetSnapshot
(
STsdbReadOptions
*
,
STsdbSnapshot
*
);
// STsdbSnapshot
STsdbSnapshot
*
tsdbSnapshotCreate
(
STsdb
*
);
void
tsdbSnapshotDestroy
(
STsdbSnapshot
*
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录