Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9728ec02
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
9728ec02
编写于
10月 12, 2021
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact
上级
98ae04e7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
90 deletion
+26
-90
include/common/schema.h
include/common/schema.h
+0
-76
include/server/vnode/meta/meta.h
include/server/vnode/meta/meta.h
+14
-13
source/server/vnode/meta/src/meta.c
source/server/vnode/meta/src/meta.c
+12
-1
未找到文件。
include/common/schema.h
浏览文件 @
9728ec02
...
...
@@ -16,86 +16,10 @@
#ifndef _TD_COMMON_SCHEMA_H_
#define _TD_COMMON_SCHEMA_H_
#include "os.h"
#ifdef __cplusplus
extern
"C"
{
#endif
// ----------------- TSDB COLUMN DEFINITION
typedef
struct
{
int8_t
type
;
// Column type
int16_t
colId
;
// column ID
int16_t
bytes
;
// column bytes (restore to int16_t in case of misuse)
uint16_t
offset
;
// point offset in SDataRow after the header part.
}
STColumn
;
#define colType(col) ((col)->type)
#define colColId(col) ((col)->colId)
#define colBytes(col) ((col)->bytes)
#define colOffset(col) ((col)->offset)
#define colSetType(col, t) (colType(col) = (t))
#define colSetColId(col, id) (colColId(col) = (id))
#define colSetBytes(col, b) (colBytes(col) = (b))
#define colSetOffset(col, o) (colOffset(col) = (o))
// ----------------- TSDB SCHEMA DEFINITION
typedef
struct
{
int
version
;
// version
int
numOfCols
;
// Number of columns appended
int
tlen
;
// maximum length of a SDataRow without the header part (sizeof(VarDataOffsetT) + sizeof(VarDataLenT) + //
// (bytes))
uint16_t
flen
;
// First part length in a SDataRow after the header part
uint16_t
vlen
;
// pure value part length, excluded the overhead (bytes only)
STColumn
columns
[];
}
STSchema
;
#define schemaNCols(s) ((s)->numOfCols)
#define schemaVersion(s) ((s)->version)
#define schemaTLen(s) ((s)->tlen)
#define schemaFLen(s) ((s)->flen)
#define schemaVLen(s) ((s)->vlen)
#define schemaColAt(s, i) ((s)->columns + i)
#define tdFreeSchema(s) tfree((s))
STSchema
*
tdDupSchema
(
STSchema
*
pSchema
);
int
tdEncodeSchema
(
void
**
buf
,
STSchema
*
pSchema
);
void
*
tdDecodeSchema
(
void
*
buf
,
STSchema
**
pRSchema
);
static
FORCE_INLINE
int
comparColId
(
const
void
*
key1
,
const
void
*
key2
)
{
if
(
*
(
int16_t
*
)
key1
>
((
STColumn
*
)
key2
)
->
colId
)
{
return
1
;
}
else
if
(
*
(
int16_t
*
)
key1
<
((
STColumn
*
)
key2
)
->
colId
)
{
return
-
1
;
}
else
{
return
0
;
}
}
static
FORCE_INLINE
STColumn
*
tdGetColOfID
(
STSchema
*
pSchema
,
int16_t
colId
)
{
void
*
ptr
=
bsearch
(
&
colId
,
(
void
*
)
pSchema
->
columns
,
schemaNCols
(
pSchema
),
sizeof
(
STColumn
),
comparColId
);
if
(
ptr
==
NULL
)
return
NULL
;
return
(
STColumn
*
)
ptr
;
}
// ----------------- SCHEMA BUILDER DEFINITION
typedef
struct
{
int
tCols
;
int
nCols
;
int
tlen
;
uint16_t
flen
;
uint16_t
vlen
;
int
version
;
STColumn
*
columns
;
}
STSchemaBuilder
;
int
tdInitTSchemaBuilder
(
STSchemaBuilder
*
pBuilder
,
int32_t
version
);
void
tdDestroyTSchemaBuilder
(
STSchemaBuilder
*
pBuilder
);
void
tdResetTSchemaBuilder
(
STSchemaBuilder
*
pBuilder
,
int32_t
version
);
int
tdAddColToSchema
(
STSchemaBuilder
*
pBuilder
,
int8_t
type
,
int16_t
colId
,
int16_t
bytes
);
STSchema
*
tdGetSchemaFromBuilder
(
STSchemaBuilder
*
pBuilder
);
#ifdef __cplusplus
}
#endif
...
...
include/server/vnode/meta/meta.h
浏览文件 @
9728ec02
...
...
@@ -27,33 +27,34 @@ extern "C" {
typedef
uint64_t
tuid_t
;
// Types exported
typedef
struct
SMeta
SMeta
;
typedef
struct
SMetaOptions
SMetaOptions
;
typedef
struct
SMetaQueryHandle
SMetaQueryHandle
;
typedef
struct
SMetaQueryOptions
SMetaQueryOptions
;
typedef
struct
SMeta
SMeta
;
typedef
struct
SMetaOpts
SMetaOpts
;
typedef
struct
SMetaQueryHandle
SMetaQueryHandle
;
typedef
struct
SMetaQueryOpts
SMetaQueryOpts
;
typedef
struct
STableOpts
STableOpts
;
// SMeta operations
int
metaCreate
(
const
char
*
path
);
void
metaDestroy
(
const
char
*
path
);
SMeta
*
metaOpen
(
SMetaOpt
ion
s
*
);
SMeta
*
metaOpen
(
SMetaOpts
*
);
void
metaClose
(
SMeta
*
);
int
metaCreateTable
(
SMeta
*
,
void
*
);
int
metaCreateTable
(
SMeta
*
,
STableOpts
*
);
int
metaDropTable
(
SMeta
*
,
uint64_t
tuid_t
);
int
metaAlterTable
(
SMeta
*
,
void
*
);
int
metaCommit
(
SMeta
*
);
// Options
SMetaOpt
ion
s
*
metaOptionsCreate
();
void
metaOptionsDestroy
(
SMetaOption
s
*
);
void
metaOptionsSetCache
(
SMetaOption
s
*
,
size_t
capacity
);
SMetaOpts
*
metaOptionsCreate
();
void
metaOptionsDestroy
(
SMetaOpt
s
*
);
void
metaOptionsSetCache
(
SMetaOpt
s
*
,
size_t
capacity
);
// SMetaQueryHandle
SMetaQueryHandle
*
metaQueryHandleCreate
(
SMetaQueryOpt
ion
s
*
);
SMetaQueryHandle
*
metaQueryHandleCreate
(
SMetaQueryOpts
*
);
void
metaQueryHandleDestroy
(
SMetaQueryHandle
*
);
// SMetaQueryOpt
ion
s
SMetaQueryOpt
ion
s
*
metaQueryOptionsCreate
();
void
metaQueryOptionsDestroy
(
SMetaQueryOption
s
*
);
// SMetaQueryOpts
SMetaQueryOpts
*
metaQueryOptionsCreate
();
void
metaQueryOptionsDestroy
(
SMetaQueryOpt
s
*
);
#ifdef __cplusplus
}
...
...
source/server/vnode/meta/src/meta.c
浏览文件 @
9728ec02
...
...
@@ -51,9 +51,15 @@ struct SMeta {
size_t
totalUsed
;
};
struct
STableOpts
{
int8_t
type
;
char
*
name
;
STSchema
*
pSchema
;
};
/* -------------------- Methods -------------------- */
SMeta
*
metaOpen
(
SMetaOpt
ion
s
*
options
)
{
SMeta
*
metaOpen
(
SMetaOpts
*
options
)
{
SMeta
*
pMeta
=
NULL
;
char
*
err
=
NULL
;
...
...
@@ -104,6 +110,11 @@ void metaClose(SMeta *pMeta) {
}
}
int
metaCreateTable
(
SMeta
*
pMeta
,
STableOpts
*
pTableOpts
)
{
// TODO
return
0
;
}
void
metaDestroy
(
const
char
*
path
)
{
taosRemoveDir
(
path
);
}
int
metaCommit
(
SMeta
*
meta
)
{
return
0
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录