Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5cf0c4a6
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
5cf0c4a6
编写于
3月 29, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update code style
上级
9a445b26
变更
31
隐藏空白更改
内联
并排
Showing
31 changed file
with
207 addition
and
110 deletion
+207
-110
source/libs/index/inc/indexCache.h
source/libs/index/inc/indexCache.h
+2
-3
source/libs/index/inc/indexComm.h
source/libs/index/inc/indexComm.h
+0
-0
source/libs/index/inc/indexFst.h
source/libs/index/inc/indexFst.h
+5
-5
source/libs/index/inc/indexFstAutomation.h
source/libs/index/inc/indexFstAutomation.h
+1
-1
source/libs/index/inc/indexFstCommon.h
source/libs/index/inc/indexFstCommon.h
+0
-0
source/libs/index/inc/indexFstCountingWriter.h
source/libs/index/inc/indexFstCountingWriter.h
+0
-0
source/libs/index/inc/indexFstNode.h
source/libs/index/inc/indexFstNode.h
+2
-2
source/libs/index/inc/indexFstRegistry.h
source/libs/index/inc/indexFstRegistry.h
+2
-2
source/libs/index/inc/indexFstUtil.h
source/libs/index/inc/indexFstUtil.h
+1
-1
source/libs/index/inc/indexSparse.h
source/libs/index/inc/indexSparse.h
+43
-0
source/libs/index/inc/indexTfile.h
source/libs/index/inc/indexTfile.h
+4
-4
source/libs/index/inc/indexUtil.h
source/libs/index/inc/indexUtil.h
+0
-0
source/libs/index/src/index.c
source/libs/index/src/index.c
+6
-6
source/libs/index/src/indexCache.c
source/libs/index/src/indexCache.c
+3
-3
source/libs/index/src/indexComm.c
source/libs/index/src/indexComm.c
+0
-0
source/libs/index/src/indexFst.c
source/libs/index/src/indexFst.c
+2
-2
source/libs/index/src/indexFstAutomation.c
source/libs/index/src/indexFstAutomation.c
+1
-1
source/libs/index/src/indexFstCommon.c
source/libs/index/src/indexFstCommon.c
+20
-17
source/libs/index/src/indexFstCountingWriter.c
source/libs/index/src/indexFstCountingWriter.c
+21
-9
source/libs/index/src/indexFstNode.c
source/libs/index/src/indexFstNode.c
+25
-9
source/libs/index/src/indexFstRegister.c
source/libs/index/src/indexFstRegister.c
+17
-9
source/libs/index/src/indexFstUtil.c
source/libs/index/src/indexFstUtil.c
+2
-2
source/libs/index/src/indexJson.c
source/libs/index/src/indexJson.c
+0
-0
source/libs/index/src/indexSparse.c
source/libs/index/src/indexSparse.c
+16
-0
source/libs/index/src/indexTfile.c
source/libs/index/src/indexTfile.c
+5
-5
source/libs/index/src/indexUtil.c
source/libs/index/src/indexUtil.c
+1
-1
source/libs/index/test/fstTest.cc
source/libs/index/test/fstTest.cc
+5
-5
source/libs/index/test/fstUT.cc
source/libs/index/test/fstUT.cc
+5
-5
source/libs/index/test/indexTests.cc
source/libs/index/test/indexTests.cc
+6
-6
source/libs/index/test/jsonUT.cc
source/libs/index/test/jsonUT.cc
+6
-6
source/libs/index/test/utilUT.cc
source/libs/index/test/utilUT.cc
+6
-6
未找到文件。
source/libs/index/inc/index
_c
ache.h
→
source/libs/index/inc/index
C
ache.h
浏览文件 @
5cf0c4a6
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* 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.
...
...
@@ -16,7 +15,7 @@
#define __INDEX_CACHE_H__
#include "indexInt.h"
#include "index
_u
til.h"
#include "index
U
til.h"
#include "tskiplist.h"
// ----------------- key structure in skiplist ---------------------
...
...
source/libs/index/inc/index
_c
omm.h
→
source/libs/index/inc/index
C
omm.h
浏览文件 @
5cf0c4a6
文件已移动
source/libs/index/inc/index
_f
st.h
→
source/libs/index/inc/index
F
st.h
浏览文件 @
5cf0c4a6
...
...
@@ -20,12 +20,12 @@
extern
"C"
{
#endif
#include "indexFstAutomation.h"
#include "indexFstCountingWriter.h"
#include "indexFstNode.h"
#include "indexFstRegistry.h"
#include "indexFstUtil.h"
#include "indexInt.h"
#include "index_fst_automation.h"
#include "index_fst_counting_writer.h"
#include "index_fst_node.h"
#include "index_fst_registry.h"
#include "index_fst_util.h"
#define OUTPUT_PREFIX(a, b) ((a) > (b) ? (b) : (a)
...
...
source/libs/index/inc/index
_fst_a
utomation.h
→
source/libs/index/inc/index
FstA
utomation.h
浏览文件 @
5cf0c4a6
...
...
@@ -19,8 +19,8 @@
extern
"C"
{
#endif
#include "indexFstUtil.h"
#include "indexInt.h"
#include "index_fst_util.h"
typedef
struct
AutomationCtx
AutomationCtx
;
...
...
source/libs/index/inc/index
_fst_c
ommon.h
→
source/libs/index/inc/index
FstC
ommon.h
浏览文件 @
5cf0c4a6
文件已移动
source/libs/index/inc/index
_fst_counting_w
riter.h
→
source/libs/index/inc/index
FstCountingW
riter.h
浏览文件 @
5cf0c4a6
文件已移动
source/libs/index/inc/index
_fst_n
ode.h
→
source/libs/index/inc/index
FstN
ode.h
浏览文件 @
5cf0c4a6
...
...
@@ -20,9 +20,9 @@
extern
"C"
{
#endif
#include "indexFstCountingWriter.h"
#include "indexFstUtil.h"
#include "indexInt.h"
#include "index_fst_counting_writer.h"
#include "index_fst_util.h"
#define FST_BUILDER_NODE_IS_FINAL(bn) (bn->isFinal)
#define FST_BUILDER_NODE_TRANS_ISEMPTY(bn) (taosArrayGetSize(bn->trans) == 0)
...
...
source/libs/index/inc/index
_fst_r
egistry.h
→
source/libs/index/inc/index
FstR
egistry.h
浏览文件 @
5cf0c4a6
...
...
@@ -19,9 +19,9 @@
extern
"C"
{
#endif
#include "indexFstNode.h"
#include "indexFstUtil.h"
#include "indexInt.h"
#include "index_fst_node.h"
#include "index_fst_util.h"
typedef
struct
FstRegistryCell
{
CompiledAddr
addr
;
...
...
source/libs/index/inc/index
_fst_u
til.h
→
source/libs/index/inc/index
FstU
til.h
浏览文件 @
5cf0c4a6
...
...
@@ -20,8 +20,8 @@
extern
"C"
{
#endif
#include "indexFstCommon.h"
#include "indexInt.h"
#include "index_fst_common.h"
typedef
uint64_t
FstType
;
typedef
uint64_t
CompiledAddr
;
...
...
source/libs/index/inc/indexSparse.h
0 → 100644
浏览文件 @
5cf0c4a6
/*
* 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_INDEX_SPARSE_H_
#define _TD_INDEX_SPARSE_H_
#include "tarray.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
FstSparseSet
{
SArray
*
dense
;
SArray
*
sparse
;
int32_t
size
;
}
FstSparseSet
;
FstSparseSet
*
sparSetCreate
(
int32_t
sz
);
void
sparSetDestroy
(
FstSparseSet
**
s
);
int32_t
sparSetLen
(
FstSparseSet
*
ss
);
int32_t
sparSetAdd
(
FstSparseSet
*
ss
,
uint32_t
ip
);
int32_t
sparSetGet
(
FstSparseSet
*
ss
,
uint32_t
i
);
bool
sparSetContains
(
FstSparseSet
*
ss
,
uint32_t
ip
);
void
sparSetClear
(
FstSparseSet
*
ss
);
#ifdef __cplusplus
}
#endif
#endif
source/libs/index/inc/index
_t
file.h
→
source/libs/index/inc/index
T
file.h
浏览文件 @
5cf0c4a6
...
...
@@ -15,11 +15,11 @@
#ifndef __INDEX_TFILE_H__
#define __INDEX_TFILE_H__
#include "indexFst.h"
#include "indexFstCountingWriter.h"
#include "indexInt.h"
#include "index_fst.h"
#include "index_fst_counting_writer.h"
#include "index_tfile.h"
#include "index_util.h"
#include "indexTfile.h"
#include "indexUtil.h"
#include "tlockfree.h"
#ifdef __cplusplus
...
...
source/libs/index/inc/index
_u
til.h
→
source/libs/index/inc/index
U
til.h
浏览文件 @
5cf0c4a6
文件已移动
source/libs/index/src/index.c
浏览文件 @
5cf0c4a6
...
...
@@ -14,11 +14,11 @@
*/
#include "index.h"
#include "indexCache.h"
#include "indexComm.h"
#include "indexInt.h"
#include "index_cache.h"
#include "index_comm.h"
#include "index_tfile.h"
#include "index_util.h"
#include "indexTfile.h"
#include "indexUtil.h"
#include "tdef.h"
#include "tsched.h"
...
...
@@ -236,11 +236,11 @@ int indexDelete(SIndex* index, SIndexMultiTermQuery* query) {
return
1
;
}
int
indexRebuild
(
SIndex
*
index
,
SIndexOpts
*
opts
){
int
indexRebuild
(
SIndex
*
index
,
SIndexOpts
*
opts
)
{
#ifdef USE_INVERTED_INDEX
#endif
return
0
;
return
0
;
}
SIndexOpts
*
indexOptsCreate
()
{
...
...
source/libs/index/src/index
_c
ache.c
→
source/libs/index/src/index
C
ache.c
浏览文件 @
5cf0c4a6
...
...
@@ -13,9 +13,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "index
_c
ache.h"
#include "index
_c
omm.h"
#include "index
_u
til.h"
#include "index
C
ache.h"
#include "index
C
omm.h"
#include "index
U
til.h"
#include "tcompare.h"
#include "tsched.h"
...
...
source/libs/index/src/index
_c
omm.c
→
source/libs/index/src/index
C
omm.c
浏览文件 @
5cf0c4a6
文件已移动
source/libs/index/src/index
_f
st.c
→
source/libs/index/src/index
F
st.c
浏览文件 @
5cf0c4a6
...
...
@@ -13,9 +13,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "index_fst.h"
#include "indexFst.h"
#include "indexFstAutomation.h"
#include "indexInt.h"
#include "index_fst_automation.h"
#include "tchecksum.h"
#include "tcoding.h"
...
...
source/libs/index/src/index
_fst_a
utomation.c
→
source/libs/index/src/index
FstA
utomation.c
浏览文件 @
5cf0c4a6
...
...
@@ -13,7 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "index
_fst_a
utomation.h"
#include "index
FstA
utomation.h"
StartWithStateValue
*
startWithStateValueCreate
(
StartWithStateKind
kind
,
ValueType
ty
,
void
*
val
)
{
StartWithStateValue
*
sv
=
taosMemoryCalloc
(
1
,
sizeof
(
StartWithStateValue
));
...
...
source/libs/index/src/index
_fst_c
ommon.c
→
source/libs/index/src/index
FstC
ommon.c
浏览文件 @
5cf0c4a6
...
...
@@ -12,7 +12,7 @@
* 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 "index
_fst_c
ommon.h"
#include "index
FstC
ommon.h"
const
uint8_t
COMMON_INPUTS
[]
=
{
84
,
// '\x00'
...
...
@@ -274,20 +274,23 @@ const uint8_t COMMON_INPUTS[] = {
};
const
char
COMMON_INPUTS_INV
[]
=
{
't'
,
'e'
,
'/'
,
'o'
,
'a'
,
's'
,
'r'
,
'i'
,
'p'
,
'c'
,
'n'
,
'w'
,
'.'
,
'h'
,
'l'
,
'm'
,
'-'
,
'd'
,
'u'
,
'0'
,
'1'
,
'2'
,
'g'
,
'='
,
':'
,
'b'
,
'f'
,
'3'
,
'y'
,
'5'
,
'&'
,
'_'
,
'4'
,
'v'
,
'9'
,
'6'
,
'7'
,
'8'
,
'k'
,
'%'
,
'?'
,
'x'
,
'C'
,
'D'
,
'A'
,
'S'
,
'F'
,
'I'
,
'B'
,
'E'
,
'j'
,
'P'
,
'T'
,
'z'
,
'R'
,
'N'
,
'M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,
'\xc8'
,
'\xc9'
,
'\xca'
,
'\xcb'
,
'\xcc'
,
'\xcd'
,
'\xce'
,
'\xcf'
,
'\xd0'
,
'\xd1'
,
'\xd2'
,
'\xd3'
,
'\xd4'
,
'\xd5'
,
'\xd6'
,
'\xd7'
,
'\xd8'
,
'\xd9'
,
'\xda'
,
'\xdb'
,
'\xdc'
,
'\xdd'
,
'\xde'
,
'\xdf'
,
'\xe0'
,
'\xe1'
,
'\xe2'
,
'\xe3'
,
'\xe4'
,
'\xe5'
,
'\xe6'
,
'\xe7'
,
'\xe8'
,
'\xe9'
,
'\xea'
,
'\xeb'
,
'\xec'
,
'\xed'
,
'\xee'
,
'\xef'
,
'\xf0'
,
'\xf1'
,
'\xf2'
,
'\xf3'
,
'\xf4'
,
'\xf5'
,
'\xf6'
,
'\xf7'
,
'\xf8'
,
'\xf9'
,
'\xfa'
,
'\xfb'
,
'\xfc'
,
'\xfd'
,
'\xfe'
,
'\xff'
,
};
source/libs/index/src/index
_fst_counting_w
riter.c
→
source/libs/index/src/index
FstCountingW
riter.c
浏览文件 @
5cf0c4a6
...
...
@@ -13,10 +13,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "
os
.h"
#include "index
_fst_counting_writer
.h"
#include "
indexFstCountingWriter
.h"
#include "index
FstUtil
.h"
#include "indexInt.h"
#include "
index_fst_util
.h"
#include "
os
.h"
#include "tutil.h"
static
int
writeCtxDoWrite
(
WriterCtx
*
ctx
,
uint8_t
*
buf
,
int
len
)
{
...
...
@@ -82,7 +82,9 @@ static int writeCtxDoFlush(WriterCtx* ctx) {
WriterCtx
*
writerCtxCreate
(
WriterType
type
,
const
char
*
path
,
bool
readOnly
,
int32_t
capacity
)
{
WriterCtx
*
ctx
=
taosMemoryCalloc
(
1
,
sizeof
(
WriterCtx
));
if
(
ctx
==
NULL
)
{
return
NULL
;
}
if
(
ctx
==
NULL
)
{
return
NULL
;
}
ctx
->
type
=
type
;
if
(
ctx
->
type
==
TFile
)
{
...
...
@@ -126,7 +128,9 @@ WriterCtx* writerCtxCreate(WriterType type, const char* path, bool readOnly, int
return
ctx
;
END:
if
(
ctx
->
type
==
TMemory
)
{
taosMemoryFree
(
ctx
->
mem
.
buf
);
}
if
(
ctx
->
type
==
TMemory
)
{
taosMemoryFree
(
ctx
->
mem
.
buf
);
}
taosMemoryFree
(
ctx
);
return
NULL
;
}
...
...
@@ -148,14 +152,18 @@ void writerCtxDestroy(WriterCtx* ctx, bool remove) {
// stat(ctx->file.buf, &fstat);
// indexError("write file size: %d", (int)(fstat.st_size));
}
if
(
remove
)
{
unlink
(
ctx
->
file
.
buf
);
}
if
(
remove
)
{
unlink
(
ctx
->
file
.
buf
);
}
}
taosMemoryFree
(
ctx
);
}
FstCountingWriter
*
fstCountingWriterCreate
(
void
*
wrt
)
{
FstCountingWriter
*
cw
=
taosMemoryCalloc
(
1
,
sizeof
(
FstCountingWriter
));
if
(
cw
==
NULL
)
{
return
NULL
;
}
if
(
cw
==
NULL
)
{
return
NULL
;
}
cw
->
wrt
=
wrt
;
//(void *)(writerCtxCreate(TFile, readOnly));
...
...
@@ -169,7 +177,9 @@ void fstCountingWriterDestroy(FstCountingWriter* cw) {
}
int
fstCountingWriterWrite
(
FstCountingWriter
*
write
,
uint8_t
*
buf
,
uint32_t
len
)
{
if
(
write
==
NULL
)
{
return
0
;
}
if
(
write
==
NULL
)
{
return
0
;
}
// update checksum
// write data to file/socket or mem
WriterCtx
*
ctx
=
write
->
wrt
;
...
...
@@ -182,7 +192,9 @@ int fstCountingWriterWrite(FstCountingWriter* write, uint8_t* buf, uint32_t len)
return
len
;
}
int
fstCountingWriterRead
(
FstCountingWriter
*
write
,
uint8_t
*
buf
,
uint32_t
len
)
{
if
(
write
==
NULL
)
{
return
0
;
}
if
(
write
==
NULL
)
{
return
0
;
}
WriterCtx
*
ctx
=
write
->
wrt
;
int
nRead
=
ctx
->
read
(
ctx
,
buf
,
len
);
// assert(nRead == len);
...
...
source/libs/index/src/index
_fst_n
ode.c
→
source/libs/index/src/index
FstN
ode.c
浏览文件 @
5cf0c4a6
...
...
@@ -12,7 +12,7 @@
* 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 "index
_fst_n
ode.h"
#include "index
FstN
ode.h"
FstBuilderNode
*
fstBuilderNodeDefault
()
{
FstBuilderNode
*
bn
=
taosMemoryMalloc
(
sizeof
(
FstBuilderNode
));
...
...
@@ -22,31 +22,45 @@ FstBuilderNode* fstBuilderNodeDefault() {
return
bn
;
}
void
fstBuilderNodeDestroy
(
FstBuilderNode
*
node
)
{
if
(
node
==
NULL
)
{
return
;
}
if
(
node
==
NULL
)
{
return
;
}
taosArrayDestroy
(
node
->
trans
);
taosMemoryFree
(
node
);
}
bool
fstBuilderNodeEqual
(
FstBuilderNode
*
n1
,
FstBuilderNode
*
n2
)
{
if
(
n1
==
n2
)
{
return
true
;
}
if
(
n1
==
NULL
||
n2
==
NULL
)
{
return
false
;
}
if
(
n1
==
n2
)
{
return
true
;
}
if
(
n1
==
NULL
||
n2
==
NULL
)
{
return
false
;
}
if
(
n1
->
isFinal
!=
n2
->
isFinal
||
n1
->
finalOutput
!=
n2
->
finalOutput
)
{
return
false
;
}
if
(
n1
->
isFinal
!=
n2
->
isFinal
||
n1
->
finalOutput
!=
n2
->
finalOutput
)
{
return
false
;
}
size_t
s1
=
n1
->
trans
?
taosArrayGetSize
(
n1
->
trans
)
:
0
;
size_t
s2
=
n2
->
trans
?
taosArrayGetSize
(
n2
->
trans
)
:
0
;
if
(
s1
!=
s2
)
{
return
false
;
}
if
(
s1
!=
s2
)
{
return
false
;
}
for
(
size_t
i
=
0
;
i
<
s1
;
i
++
)
{
FstTransition
*
t1
=
taosArrayGet
(
n1
->
trans
,
i
);
FstTransition
*
t2
=
taosArrayGet
(
n2
->
trans
,
i
);
if
(
t1
->
inp
!=
t2
->
inp
||
t1
->
out
!=
t2
->
out
||
t1
->
addr
!=
t2
->
addr
)
{
return
false
;
}
if
(
t1
->
inp
!=
t2
->
inp
||
t1
->
out
!=
t2
->
out
||
t1
->
addr
!=
t2
->
addr
)
{
return
false
;
}
}
return
true
;
}
FstBuilderNode
*
fstBuilderNodeClone
(
FstBuilderNode
*
src
)
{
FstBuilderNode
*
node
=
taosMemoryMalloc
(
sizeof
(
FstBuilderNode
));
if
(
node
==
NULL
)
{
return
NULL
;
}
if
(
node
==
NULL
)
{
return
NULL
;
}
//
size_t
sz
=
taosArrayGetSize
(
src
->
trans
);
...
...
@@ -64,7 +78,9 @@ FstBuilderNode* fstBuilderNodeClone(FstBuilderNode* src) {
}
// not destroy src, User's bussiness
void
fstBuilderNodeCloneFrom
(
FstBuilderNode
*
dst
,
FstBuilderNode
*
src
)
{
if
(
dst
==
NULL
||
src
==
NULL
)
{
return
;
}
if
(
dst
==
NULL
||
src
==
NULL
)
{
return
;
}
dst
->
isFinal
=
src
->
isFinal
;
dst
->
finalOutput
=
src
->
finalOutput
;
...
...
source/libs/index/src/index
_fst_registry
.c
→
source/libs/index/src/index
FstRegister
.c
浏览文件 @
5cf0c4a6
...
...
@@ -13,8 +13,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "indexFstRegistry.h"
#include "os.h"
#include "index_fst_registry.h"
uint64_t
fstRegistryHash
(
FstRegistry
*
registry
,
FstBuilderNode
*
bNode
)
{
// TODO(yihaoDeng): refactor later
...
...
@@ -35,7 +35,9 @@ uint64_t fstRegistryHash(FstRegistry* registry, FstBuilderNode* bNode) {
}
static
void
fstRegistryCellSwap
(
SArray
*
arr
,
uint32_t
a
,
uint32_t
b
)
{
size_t
sz
=
taosArrayGetSize
(
arr
);
if
(
a
>=
sz
||
b
>=
sz
)
{
return
;
}
if
(
a
>=
sz
||
b
>=
sz
)
{
return
;
}
FstRegistryCell
*
cell1
=
(
FstRegistryCell
*
)
taosArrayGet
(
arr
,
a
);
FstRegistryCell
*
cell2
=
(
FstRegistryCell
*
)
taosArrayGet
(
arr
,
b
);
...
...
@@ -52,7 +54,9 @@ static void fstRegistryCellSwap(SArray* arr, uint32_t a, uint32_t b) {
static
void
fstRegistryCellPromote
(
SArray
*
arr
,
uint32_t
start
,
uint32_t
end
)
{
size_t
sz
=
taosArrayGetSize
(
arr
);
if
(
start
>=
sz
&&
end
>=
sz
)
{
return
;
}
if
(
start
>=
sz
&&
end
>=
sz
)
{
return
;
}
assert
(
start
>=
end
);
...
...
@@ -66,7 +70,9 @@ static void fstRegistryCellPromote(SArray* arr, uint32_t start, uint32_t end) {
FstRegistry
*
fstRegistryCreate
(
uint64_t
tableSize
,
uint64_t
mruSize
)
{
FstRegistry
*
registry
=
taosMemoryMalloc
(
sizeof
(
FstRegistry
));
if
(
registry
==
NULL
)
{
return
NULL
;
}
if
(
registry
==
NULL
)
{
return
NULL
;
}
uint64_t
nCells
=
tableSize
*
mruSize
;
SArray
*
tb
=
(
SArray
*
)
taosArrayInit
(
nCells
,
sizeof
(
FstRegistryCell
));
...
...
@@ -87,7 +93,9 @@ FstRegistry* fstRegistryCreate(uint64_t tableSize, uint64_t mruSize) {
}
void
fstRegistryDestroy
(
FstRegistry
*
registry
)
{
if
(
registry
==
NULL
)
{
return
;
}
if
(
registry
==
NULL
)
{
return
;
}
SArray
*
tb
=
registry
->
table
;
size_t
sz
=
taosArrayGetSize
(
tb
);
...
...
@@ -100,7 +108,9 @@ void fstRegistryDestroy(FstRegistry* registry) {
}
FstRegistryEntry
*
fstRegistryGetEntry
(
FstRegistry
*
registry
,
FstBuilderNode
*
bNode
)
{
if
(
taosArrayGetSize
(
registry
->
table
)
<=
0
)
{
return
NULL
;
}
if
(
taosArrayGetSize
(
registry
->
table
)
<=
0
)
{
return
NULL
;
}
uint64_t
bucket
=
fstRegistryHash
(
registry
,
bNode
);
uint64_t
start
=
registry
->
mruSize
*
bucket
;
uint64_t
end
=
start
+
registry
->
mruSize
;
...
...
@@ -165,6 +175,4 @@ FstRegistryEntry* fstRegistryGetEntry(FstRegistry* registry, FstBuilderNode* bNo
}
return
entry
;
}
void
fstRegistryEntryDestroy
(
FstRegistryEntry
*
entry
)
{
taosMemoryFree
(
entry
);
}
void
fstRegistryEntryDestroy
(
FstRegistryEntry
*
entry
)
{
taosMemoryFree
(
entry
);
}
source/libs/index/src/index
_fst_u
til.c
→
source/libs/index/src/index
FstU
til.c
浏览文件 @
5cf0c4a6
...
...
@@ -12,8 +12,8 @@
* 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 "index
_fst_u
til.h"
#include "index
_fst_c
ommon.h"
#include "index
FstU
til.h"
#include "index
FstC
ommon.h"
// A sentinel value used to indicate an empty final state
const
CompiledAddr
EMPTY_ADDRESS
=
0
;
...
...
source/libs/index/src/index
_j
son.c
→
source/libs/index/src/index
J
son.c
浏览文件 @
5cf0c4a6
文件已移动
source/libs/index/src/indexSparse.c
0 → 100644
浏览文件 @
5cf0c4a6
/*
* 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 "indexSparse.h"
source/libs/index/src/index
_t
file.c
→
source/libs/index/src/index
T
file.c
浏览文件 @
5cf0c4a6
...
...
@@ -13,12 +13,12 @@ p *
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "index
_t
file.h"
#include "index
T
file.h"
#include "index.h"
#include "index
_c
omm.h"
#include "index
_f
st.h"
#include "index
_fst_counting_w
riter.h"
#include "index
_u
til.h"
#include "index
C
omm.h"
#include "index
F
st.h"
#include "index
FstCountingW
riter.h"
#include "index
U
til.h"
#include "taosdef.h"
#include "tcoding.h"
#include "tcompare.h"
...
...
source/libs/index/src/index
_u
til.c
→
source/libs/index/src/index
U
til.c
浏览文件 @
5cf0c4a6
...
...
@@ -12,7 +12,7 @@
* 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 "index
_u
til.h"
#include "index
U
til.h"
#include "index.h"
#include "tcompare.h"
...
...
source/libs/index/test/fstTest.cc
浏览文件 @
5cf0c4a6
...
...
@@ -5,12 +5,12 @@
#include <thread>
#include <vector>
#include "index.h"
#include "indexCache.h"
#include "indexFst.h"
#include "indexFstCountingWriter.h"
#include "indexFstUtil.h"
#include "indexInt.h"
#include "index_cache.h"
#include "index_fst.h"
#include "index_fst_counting_writer.h"
#include "index_fst_util.h"
#include "index_tfile.h"
#include "indexTfile.h"
#include "tskiplist.h"
#include "tutil.h"
void
*
callback
(
void
*
s
)
{
return
s
;
}
...
...
source/libs/index/test/fstUT.cc
浏览文件 @
5cf0c4a6
...
...
@@ -6,12 +6,12 @@
#include <thread>
#include <vector>
#include "index.h"
#include "indexCache.h"
#include "indexFst.h"
#include "indexFstCountingWriter.h"
#include "indexFstUtil.h"
#include "indexInt.h"
#include "index_cache.h"
#include "index_fst.h"
#include "index_fst_counting_writer.h"
#include "index_fst_util.h"
#include "index_tfile.h"
#include "indexTfile.h"
#include "tglobal.h"
#include "tlog.h"
#include "tskiplist.h"
...
...
source/libs/index/test/indexTests.cc
浏览文件 @
5cf0c4a6
...
...
@@ -18,13 +18,13 @@
#include <string>
#include <thread>
#include "index.h"
#include "indexCache.h"
#include "indexFst.h"
#include "indexFstCountingWriter.h"
#include "indexFstUtil.h"
#include "indexInt.h"
#include "index_cache.h"
#include "index_fst.h"
#include "index_fst_counting_writer.h"
#include "index_fst_util.h"
#include "index_tfile.h"
#include "index_util.h"
#include "indexTfile.h"
#include "indexUtil.h"
#include "tskiplist.h"
#include "tutil.h"
using
namespace
std
;
...
...
source/libs/index/test/jsonUT.cc
浏览文件 @
5cf0c4a6
...
...
@@ -5,13 +5,13 @@
#include <thread>
#include <vector>
#include "index.h"
#include "indexCache.h"
#include "indexFst.h"
#include "indexFstCountingWriter.h"
#include "indexFstUtil.h"
#include "indexInt.h"
#include "index_cache.h"
#include "index_fst.h"
#include "index_fst_counting_writer.h"
#include "index_fst_util.h"
#include "index_tfile.h"
#include "index_util.h"
#include "indexTfile.h"
#include "indexUtil.h"
#include "tglobal.h"
#include "tskiplist.h"
#include "tutil.h"
...
...
source/libs/index/test/utilUT.cc
浏览文件 @
5cf0c4a6
...
...
@@ -5,13 +5,13 @@
#include <thread>
#include <vector>
#include "index.h"
#include "indexCache.h"
#include "indexFst.h"
#include "indexFstCountingWriter.h"
#include "indexFstUtil.h"
#include "indexInt.h"
#include "index_cache.h"
#include "index_fst.h"
#include "index_fst_counting_writer.h"
#include "index_fst_util.h"
#include "index_tfile.h"
#include "index_util.h"
#include "indexTfile.h"
#include "indexUtil.h"
#include "tglobal.h"
#include "tskiplist.h"
#include "tutil.h"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录