Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4cc94968
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
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看板
提交
4cc94968
编写于
10月 13, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact: format header file
上级
b3b0e5a5
变更
52
展开全部
显示空白变更内容
内联
并排
Showing
52 changed file
with
849 addition
and
816 deletion
+849
-816
include/common/systable.h
include/common/systable.h
+8
-8
include/common/tgrant.h
include/common/tgrant.h
+17
-16
include/common/tmsgtype.h
include/common/tmsgtype.h
+5
-1
include/common/tname.h
include/common/tname.h
+1
-1
include/common/trow.h
include/common/trow.h
+5
-5
include/common/ttime.h
include/common/ttime.h
+5
-5
include/common/ttszip.h
include/common/ttszip.h
+1
-1
include/libs/catalog/catalog.h
include/libs/catalog/catalog.h
+19
-13
include/libs/executor/dataSinkMgt.h
include/libs/executor/dataSinkMgt.h
+7
-7
include/libs/function/function.h
include/libs/function/function.h
+2
-2
include/libs/function/taosudf.h
include/libs/function/taosudf.h
+54
-55
include/libs/function/tudf.h
include/libs/function/tudf.h
+10
-10
include/libs/monitor/monitor.h
include/libs/monitor/monitor.h
+0
-1
include/libs/qcom/query.h
include/libs/qcom/query.h
+44
-43
include/libs/qworker/qworker.h
include/libs/qworker/qworker.h
+5
-4
include/libs/scalar/filter.h
include/libs/scalar/filter.h
+5
-4
include/libs/scheduler/scheduler.h
include/libs/scheduler/scheduler.h
+32
-33
include/libs/sync/sync.h
include/libs/sync/sync.h
+1
-1
include/libs/tfs/tfs.h
include/libs/tfs/tfs.h
+2
-2
include/os/os.h
include/os/os.h
+15
-14
include/os/osDef.h
include/os/osDef.h
+119
-108
include/os/osDir.h
include/os/osDir.h
+19
-20
include/os/osEndian.h
include/os/osEndian.h
+1
-1
include/os/osEnv.h
include/os/osEnv.h
+1
-1
include/os/osEok.h
include/os/osEok.h
+25
-30
include/os/osLocale.h
include/os/osLocale.h
+1
-1
include/os/osLz4.h
include/os/osLz4.h
+18
-18
include/os/osMath.h
include/os/osMath.h
+23
-23
include/os/osMemory.h
include/os/osMemory.h
+10
-10
include/os/osRand.h
include/os/osRand.h
+5
-5
include/os/osShm.h
include/os/osShm.h
+2
-2
include/os/osSignal.h
include/os/osSignal.h
+7
-7
include/os/osSleep.h
include/os/osSleep.h
+4
-4
include/os/osSocket.h
include/os/osSocket.h
+3
-3
include/os/osString.h
include/os/osString.h
+36
-36
include/os/osSysinfo.h
include/os/osSysinfo.h
+3
-3
include/os/osSystem.h
include/os/osSystem.h
+6
-6
include/os/osThread.h
include/os/osThread.h
+170
-171
include/os/osTimer.h
include/os/osTimer.h
+9
-9
include/os/osTimezone.h
include/os/osTimezone.h
+27
-28
include/util/tbloomfilter.h
include/util/tbloomfilter.h
+14
-15
include/util/tconfig.h
include/util/tconfig.h
+2
-2
include/util/tcrc32c.h
include/util/tcrc32c.h
+16
-16
include/util/tdigest.h
include/util/tdigest.h
+29
-28
include/util/thash.h
include/util/thash.h
+11
-11
include/util/tidpool.h
include/util/tidpool.h
+4
-4
include/util/tlrucache.h
include/util/tlrucache.h
+11
-14
include/util/tpagedbuf.h
include/util/tpagedbuf.h
+3
-2
include/util/tscalablebf.h
include/util/tscalablebf.h
+6
-7
include/util/tthread.h
include/util/tthread.h
+3
-3
include/util/tutil.h
include/util/tutil.h
+2
-2
tools/scripts/codeFormat.sh
tools/scripts/codeFormat.sh
+21
-0
未找到文件。
include/common/systable.h
浏览文件 @
4cc94968
include/common/tgrant.h
浏览文件 @
4cc94968
...
@@ -47,7 +47,8 @@ typedef enum {
...
@@ -47,7 +47,8 @@ typedef enum {
int32_t
grantCheck
(
EGrantType
grant
);
int32_t
grantCheck
(
EGrantType
grant
);
#ifndef GRANTS_CFG
#ifndef GRANTS_CFG
#define GRANTS_SCHEMA static const SSysDbTableSchema grantsSchema[] = { \
#define GRANTS_SCHEMA \
static const SSysDbTableSchema grantsSchema[] = { \
{.name = "version", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
{.name = "version", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
{.name = "expire_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
{.name = "expire_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
{.name = "expired", .bytes = 5 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
{.name = "expired", .bytes = 5 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
...
@@ -62,7 +63,7 @@ int32_t grantCheck(EGrantType grant);
...
@@ -62,7 +63,7 @@ int32_t grantCheck(EGrantType grant);
{.name = "cpu_cores", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
{.name = "cpu_cores", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
{.name = "speed", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
{.name = "speed", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
{.name = "querytime", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
{.name = "querytime", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
}
}
#define GRANT_CFG_ADD
#define GRANT_CFG_ADD
#define GRANT_CFG_SET
#define GRANT_CFG_SET
#define GRANT_CFG_GET
#define GRANT_CFG_GET
...
...
include/common/tmsgtype.h
浏览文件 @
4cc94968
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
// clang-format off
// sql type
// sql type
#ifdef TSDB_SQL_C
#ifdef TSDB_SQL_C
...
@@ -103,6 +105,8 @@ enum {
...
@@ -103,6 +105,8 @@ enum {
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_MAX
,
"max"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_MAX
,
"max"
)
};
};
// clang-format on
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
include/common/tname.h
浏览文件 @
4cc94968
include/common/trow.h
浏览文件 @
4cc94968
include/common/ttime.h
浏览文件 @
4cc94968
include/common/ttszip.h
浏览文件 @
4cc94968
include/libs/catalog/catalog.h
浏览文件 @
4cc94968
...
@@ -182,7 +182,8 @@ int32_t catalogRemoveStbMeta(SCatalog* pCtg, const char* dbFName, uint64_t dbId,
...
@@ -182,7 +182,8 @@ int32_t catalogRemoveStbMeta(SCatalog* pCtg, const char* dbFName, uint64_t dbId,
* @param pTableMeta(output, table meta data, NEED to free it by calller)
* @param pTableMeta(output, table meta data, NEED to free it by calller)
* @return error code
* @return error code
*/
*/
int32_t
catalogGetTableMeta
(
SCatalog
*
pCatalog
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
);
int32_t
catalogGetTableMeta
(
SCatalog
*
pCatalog
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
);
/**
/**
* Get a super table's meta data.
* Get a super table's meta data.
...
@@ -193,9 +194,10 @@ int32_t catalogGetTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, const S
...
@@ -193,9 +194,10 @@ int32_t catalogGetTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, const S
* @param pTableMeta(output, table meta data, NEED to free it by calller)
* @param pTableMeta(output, table meta data, NEED to free it by calller)
* @return error code
* @return error code
*/
*/
int32_t
catalogGetSTableMeta
(
SCatalog
*
pCatalog
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
);
int32_t
catalogGetSTableMeta
(
SCatalog
*
pCatalog
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
);
int32_t
catalogUpdateTableMeta
(
SCatalog
*
pCatalog
,
STableMetaRsp
*
rspMsg
);
int32_t
catalogUpdateTableMeta
(
SCatalog
*
pCatalog
,
STableMetaRsp
*
rspMsg
);
int32_t
catalogUpdateTableMeta
(
SCatalog
*
pCatalog
,
STableMetaRsp
*
rspMsg
);
int32_t
catalogUpdateTableMeta
(
SCatalog
*
pCatalog
,
STableMetaRsp
*
rspMsg
);
...
@@ -232,7 +234,8 @@ int32_t catalogRefreshTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, con
...
@@ -232,7 +234,8 @@ int32_t catalogRefreshTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, con
* @param isSTable (input, is super table or not, 1:supposed to be stable, 0: supposed not to be stable, -1:not sure)
* @param isSTable (input, is super table or not, 1:supposed to be stable, 0: supposed not to be stable, -1:not sure)
* @return error code
* @return error code
*/
*/
int32_t
catalogRefreshGetTableMeta
(
SCatalog
*
pCatalog
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
,
int32_t
isSTable
);
int32_t
catalogRefreshGetTableMeta
(
SCatalog
*
pCatalog
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
,
int32_t
isSTable
);
/**
/**
* Get a table's actual vgroup, for stable it's all possible vgroup list.
* Get a table's actual vgroup, for stable it's all possible vgroup list.
...
@@ -243,7 +246,8 @@ int32_t catalogRefreshGetTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn,
...
@@ -243,7 +246,8 @@ int32_t catalogRefreshGetTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn,
* @param pVgroupList (output, vgroup info list, element is SVgroupInfo, NEED to simply free the array by caller)
* @param pVgroupList (output, vgroup info list, element is SVgroupInfo, NEED to simply free the array by caller)
* @return error code
* @return error code
*/
*/
int32_t
catalogGetTableDistVgInfo
(
SCatalog
*
pCatalog
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
SArray
**
pVgroupList
);
int32_t
catalogGetTableDistVgInfo
(
SCatalog
*
pCatalog
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
SArray
**
pVgroupList
);
/**
/**
* Get a table's vgroup from its name's hash value.
* Get a table's vgroup from its name's hash value.
...
@@ -267,13 +271,14 @@ int32_t catalogGetTableHashVgroup(SCatalog* pCatalog, SRequestConnInfo* pConn, c
...
@@ -267,13 +271,14 @@ int32_t catalogGetTableHashVgroup(SCatalog* pCatalog, SRequestConnInfo* pConn, c
*/
*/
int32_t
catalogGetAllMeta
(
SCatalog
*
pCatalog
,
SRequestConnInfo
*
pConn
,
const
SCatalogReq
*
pReq
,
SMetaData
*
pRsp
);
int32_t
catalogGetAllMeta
(
SCatalog
*
pCatalog
,
SRequestConnInfo
*
pConn
,
const
SCatalogReq
*
pReq
,
SMetaData
*
pRsp
);
int32_t
catalogAsyncGetAllMeta
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SCatalogReq
*
pReq
,
catalogCallback
fp
,
void
*
param
,
int64_t
*
jobId
);
int32_t
catalogAsyncGetAllMeta
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SCatalogReq
*
pReq
,
catalogCallback
fp
,
void
*
param
,
int64_t
*
jobId
);
int32_t
catalogGetQnodeList
(
SCatalog
*
pCatalog
,
SRequestConnInfo
*
pConn
,
SArray
*
pQnodeList
);
int32_t
catalogGetQnodeList
(
SCatalog
*
pCatalog
,
SRequestConnInfo
*
pConn
,
SArray
*
pQnodeList
);
int32_t
catalogGetDnodeList
(
SCatalog
*
pCatalog
,
SRequestConnInfo
*
pConn
,
SArray
**
pDnodeList
);
int32_t
catalogGetDnodeList
(
SCatalog
*
pCatalog
,
SRequestConnInfo
*
pConn
,
SArray
**
pDnodeList
);
int32_t
catalogGetExpiredSTables
(
SCatalog
*
pCatalog
,
SSTableVersion
**
stables
,
uint32_t
*
num
);
int32_t
catalogGetExpiredSTables
(
SCatalog
*
pCatalog
,
SSTableVersion
**
stables
,
uint32_t
*
num
);
int32_t
catalogGetExpiredDBs
(
SCatalog
*
pCatalog
,
SDbVgVersion
**
dbs
,
uint32_t
*
num
);
int32_t
catalogGetExpiredDBs
(
SCatalog
*
pCatalog
,
SDbVgVersion
**
dbs
,
uint32_t
*
num
);
...
@@ -285,19 +290,20 @@ int32_t catalogGetIndexMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const char*
...
@@ -285,19 +290,20 @@ int32_t catalogGetIndexMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const char*
int32_t
catalogGetTableIndex
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
SArray
**
pRes
);
int32_t
catalogGetTableIndex
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
SArray
**
pRes
);
int32_t
catalogRefreshGetTableCfg
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
STableCfg
**
pCfg
);
int32_t
catalogRefreshGetTableCfg
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
STableCfg
**
pCfg
);
int32_t
catalogUpdateTableIndex
(
SCatalog
*
pCtg
,
STableIndexRsp
*
pRsp
);
int32_t
catalogUpdateTableIndex
(
SCatalog
*
pCtg
,
STableIndexRsp
*
pRsp
);
int32_t
catalogGetUdfInfo
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
char
*
funcName
,
SFuncInfo
*
pInfo
);
int32_t
catalogGetUdfInfo
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
char
*
funcName
,
SFuncInfo
*
pInfo
);
int32_t
catalogChkAuth
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
char
*
user
,
const
char
*
dbFName
,
AUTH_TYPE
type
,
bool
*
pass
);
int32_t
catalogChkAuth
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
char
*
user
,
const
char
*
dbFName
,
AUTH_TYPE
type
,
bool
*
pass
);
int32_t
catalogUpdateUserAuthInfo
(
SCatalog
*
pCtg
,
SGetUserAuthRsp
*
pAuth
);
int32_t
catalogUpdateUserAuthInfo
(
SCatalog
*
pCtg
,
SGetUserAuthRsp
*
pAuth
);
int32_t
catalogUpdateVgEpSet
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
int32_t
vgId
,
SEpSet
*
epSet
);
int32_t
catalogUpdateVgEpSet
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
int32_t
vgId
,
SEpSet
*
epSet
);
int32_t
catalogGetServerVersion
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
char
**
pVersion
);
int32_t
catalogGetServerVersion
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
char
**
pVersion
);
int32_t
ctgdLaunchAsyncCall
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
uint64_t
reqId
,
bool
forceUpdate
);
int32_t
ctgdLaunchAsyncCall
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
uint64_t
reqId
,
bool
forceUpdate
);
...
...
include/libs/executor/dataSinkMgt.h
浏览文件 @
4cc94968
...
@@ -20,10 +20,10 @@
...
@@ -20,10 +20,10 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
#include "os.h"
#include "thash.h"
#include "executor.h"
#include "executor.h"
#include "os.h"
#include "plannodes.h"
#include "plannodes.h"
#include "thash.h"
#define DS_BUF_LOW 1
#define DS_BUF_LOW 1
#define DS_BUF_FULL 2
#define DS_BUF_FULL 2
...
@@ -60,7 +60,7 @@ typedef struct SDataSinkMgtCfg {
...
@@ -60,7 +60,7 @@ typedef struct SDataSinkMgtCfg {
uint32_t
maxDataBlockNumPerQuery
;
uint32_t
maxDataBlockNumPerQuery
;
}
SDataSinkMgtCfg
;
}
SDataSinkMgtCfg
;
int32_t
dsDataSinkMgtInit
(
SDataSinkMgtCfg
*
cfg
);
int32_t
dsDataSinkMgtInit
(
SDataSinkMgtCfg
*
cfg
);
typedef
struct
SInputData
{
typedef
struct
SInputData
{
const
struct
SSDataBlock
*
pData
;
const
struct
SSDataBlock
*
pData
;
...
@@ -86,7 +86,7 @@ typedef struct SOutputData {
...
@@ -86,7 +86,7 @@ typedef struct SOutputData {
*/
*/
int32_t
dsCreateDataSinker
(
const
SDataSinkNode
*
pDataSink
,
DataSinkHandle
*
pHandle
,
void
*
pParam
);
int32_t
dsCreateDataSinker
(
const
SDataSinkNode
*
pDataSink
,
DataSinkHandle
*
pHandle
,
void
*
pParam
);
int32_t
dsDataSinkGetCacheSize
(
SDataSinkStat
*
pStat
);
int32_t
dsDataSinkGetCacheSize
(
SDataSinkStat
*
pStat
);
/**
/**
* Put the result set returned by the executor into datasinker.
* Put the result set returned by the executor into datasinker.
...
@@ -114,7 +114,7 @@ void dsGetDataLength(DataSinkHandle handle, int64_t* pLen, bool* pQueryEnd);
...
@@ -114,7 +114,7 @@ void dsGetDataLength(DataSinkHandle handle, int64_t* pLen, bool* pQueryEnd);
*/
*/
int32_t
dsGetDataBlock
(
DataSinkHandle
handle
,
SOutputData
*
pOutput
);
int32_t
dsGetDataBlock
(
DataSinkHandle
handle
,
SOutputData
*
pOutput
);
int32_t
dsGetCacheSize
(
DataSinkHandle
handle
,
uint64_t
*
pSize
);
int32_t
dsGetCacheSize
(
DataSinkHandle
handle
,
uint64_t
*
pSize
);
/**
/**
* After dsGetStatus returns DS_NEED_SCHEDULE, the caller need to put this into the work queue.
* After dsGetStatus returns DS_NEED_SCHEDULE, the caller need to put this into the work queue.
...
...
include/libs/function/function.h
浏览文件 @
4cc94968
include/libs/function/taosudf.h
浏览文件 @
4cc94968
/*
/*
* 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
* 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
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
* or later ("AGPL"), as published by the Free Software Foundation.
*
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
* FITNESS FOR A PARTICULAR PURPOSE.
*
*
* You should have received a copy of the GNU Affero General Public License
* 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/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#ifndef TDENGINE_TAOSUDF_H
#ifndef TDENGINE_TAOSUDF_H
#define TDENGINE_TAOSUDF_H
#define TDENGINE_TAOSUDF_H
#include <stdint.h>
#include <stdbool.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
...
@@ -61,7 +61,6 @@ typedef struct SUdfColumnData {
...
@@ -61,7 +61,6 @@ typedef struct SUdfColumnData {
};
};
}
SUdfColumnData
;
}
SUdfColumnData
;
typedef
struct
SUdfColumn
{
typedef
struct
SUdfColumn
{
SUdfColumnMeta
colMeta
;
SUdfColumnMeta
colMeta
;
bool
hasNull
;
bool
hasNull
;
...
@@ -76,8 +75,8 @@ typedef struct SUdfDataBlock {
...
@@ -76,8 +75,8 @@ typedef struct SUdfDataBlock {
typedef
struct
SUdfInterBuf
{
typedef
struct
SUdfInterBuf
{
int32_t
bufLen
;
int32_t
bufLen
;
char
*
buf
;
char
*
buf
;
int8_t
numOfResult
;
//
zero or one
int8_t
numOfResult
;
//
zero or one
}
SUdfInterBuf
;
}
SUdfInterBuf
;
typedef
void
*
UdfcFuncHandle
;
typedef
void
*
UdfcFuncHandle
;
...
@@ -92,7 +91,8 @@ typedef int32_t (*TUdfDestroyFunc)();
...
@@ -92,7 +91,8 @@ typedef int32_t (*TUdfDestroyFunc)();
#define BitmapLen(_n) (((_n) + ((1 << NBIT) - 1)) >> NBIT)
#define BitmapLen(_n) (((_n) + ((1 << NBIT) - 1)) >> NBIT)
#define udfColDataIsNull_var(pColumn, row) ((pColumn->colData.varLenCol.varOffsets)[row] == -1)
#define udfColDataIsNull_var(pColumn, row) ((pColumn->colData.varLenCol.varOffsets)[row] == -1)
#define udfColDataIsNull_f(pColumn, row) ((BMCharPos(pColumn->colData.fixLenCol.nullBitmap, row) & (1u << (7u - BitPos(row)))) == (1u << (7u - BitPos(row))))
#define udfColDataIsNull_f(pColumn, row) \
((BMCharPos(pColumn->colData.fixLenCol.nullBitmap, row) & (1u << (7u - BitPos(row)))) == (1u << (7u - BitPos(row))))
#define udfColDataSetNull_f(pColumn, row) \
#define udfColDataSetNull_f(pColumn, row) \
do { \
do { \
BMCharPos(pColumn->colData.fixLenCol.nullBitmap, row) |= (1u << (7u - BitPos(row))); \
BMCharPos(pColumn->colData.fixLenCol.nullBitmap, row) |= (1u << (7u - BitPos(row))); \
...
@@ -116,8 +116,7 @@ typedef uint16_t VarDataLenT; // maxVarDataLen: 32767
...
@@ -116,8 +116,7 @@ typedef uint16_t VarDataLenT; // maxVarDataLen: 32767
(((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON))
(((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON))
#define IS_STR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR))
#define IS_STR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR))
static
FORCE_INLINE
char
*
udfColDataGetData
(
const
SUdfColumn
*
pColumn
,
int32_t
row
)
{
static
FORCE_INLINE
char
*
udfColDataGetData
(
const
SUdfColumn
*
pColumn
,
int32_t
row
)
{
if
(
IS_VAR_DATA_TYPE
(
pColumn
->
colMeta
.
type
))
{
if
(
IS_VAR_DATA_TYPE
(
pColumn
->
colMeta
.
type
))
{
return
pColumn
->
colData
.
varLenCol
.
payload
+
pColumn
->
colData
.
varLenCol
.
varOffsets
[
row
];
return
pColumn
->
colData
.
varLenCol
.
payload
+
pColumn
->
colData
.
varLenCol
.
varOffsets
[
row
];
}
else
{
}
else
{
...
@@ -125,13 +124,13 @@ static FORCE_INLINE char* udfColDataGetData(const SUdfColumn* pColumn, int32_t r
...
@@ -125,13 +124,13 @@ static FORCE_INLINE char* udfColDataGetData(const SUdfColumn* pColumn, int32_t r
}
}
}
}
static
FORCE_INLINE
bool
udfColDataIsNull
(
const
SUdfColumn
*
pColumn
,
int32_t
row
)
{
static
FORCE_INLINE
bool
udfColDataIsNull
(
const
SUdfColumn
*
pColumn
,
int32_t
row
)
{
if
(
IS_VAR_DATA_TYPE
(
pColumn
->
colMeta
.
type
))
{
if
(
IS_VAR_DATA_TYPE
(
pColumn
->
colMeta
.
type
))
{
if
(
pColumn
->
colMeta
.
type
==
TSDB_DATA_TYPE_JSON
)
{
if
(
pColumn
->
colMeta
.
type
==
TSDB_DATA_TYPE_JSON
)
{
if
(
udfColDataIsNull_var
(
pColumn
,
row
))
{
if
(
udfColDataIsNull_var
(
pColumn
,
row
))
{
return
true
;
return
true
;
}
}
char
*
data
=
udfColDataGetData
(
pColumn
,
row
);
char
*
data
=
udfColDataGetData
(
pColumn
,
row
);
return
(
*
data
==
TSDB_DATA_TYPE_NULL
);
return
(
*
data
==
TSDB_DATA_TYPE_NULL
);
}
else
{
}
else
{
return
udfColDataIsNull_var
(
pColumn
,
row
);
return
udfColDataIsNull_var
(
pColumn
,
row
);
...
@@ -141,29 +140,29 @@ static FORCE_INLINE bool udfColDataIsNull(const SUdfColumn* pColumn, int32_t row
...
@@ -141,29 +140,29 @@ static FORCE_INLINE bool udfColDataIsNull(const SUdfColumn* pColumn, int32_t row
}
}
}
}
static
FORCE_INLINE
int32_t
udfColEnsureCapacity
(
SUdfColumn
*
pColumn
,
int32_t
newCapacity
)
{
static
FORCE_INLINE
int32_t
udfColEnsureCapacity
(
SUdfColumn
*
pColumn
,
int32_t
newCapacity
)
{
SUdfColumnMeta
*
meta
=
&
pColumn
->
colMeta
;
SUdfColumnMeta
*
meta
=
&
pColumn
->
colMeta
;
SUdfColumnData
*
data
=
&
pColumn
->
colData
;
SUdfColumnData
*
data
=
&
pColumn
->
colData
;
if
(
newCapacity
==
0
||
newCapacity
<=
data
->
rowsAlloc
)
{
if
(
newCapacity
==
0
||
newCapacity
<=
data
->
rowsAlloc
)
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int
allocCapacity
=
(
data
->
rowsAlloc
<
8
)
?
8
:
data
->
rowsAlloc
;
int
allocCapacity
=
(
data
->
rowsAlloc
<
8
)
?
8
:
data
->
rowsAlloc
;
while
(
allocCapacity
<
newCapacity
)
{
while
(
allocCapacity
<
newCapacity
)
{
allocCapacity
*=
UDF_MEMORY_EXP_GROWTH
;
allocCapacity
*=
UDF_MEMORY_EXP_GROWTH
;
}
}
if
(
IS_VAR_DATA_TYPE
(
meta
->
type
))
{
if
(
IS_VAR_DATA_TYPE
(
meta
->
type
))
{
char
*
tmp
=
(
char
*
)
realloc
(
data
->
varLenCol
.
varOffsets
,
sizeof
(
int32_t
)
*
allocCapacity
);
char
*
tmp
=
(
char
*
)
realloc
(
data
->
varLenCol
.
varOffsets
,
sizeof
(
int32_t
)
*
allocCapacity
);
if
(
tmp
==
NULL
)
{
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
data
->
varLenCol
.
varOffsets
=
(
int32_t
*
)
tmp
;
data
->
varLenCol
.
varOffsets
=
(
int32_t
*
)
tmp
;
data
->
varLenCol
.
varOffsetsLen
=
sizeof
(
int32_t
)
*
allocCapacity
;
data
->
varLenCol
.
varOffsetsLen
=
sizeof
(
int32_t
)
*
allocCapacity
;
// for payload, add data in udfColDataAppend
// for payload, add data in udfColDataAppend
}
else
{
}
else
{
char
*
tmp
=
(
char
*
)
realloc
(
data
->
fixLenCol
.
nullBitmap
,
BitmapLen
(
allocCapacity
));
char
*
tmp
=
(
char
*
)
realloc
(
data
->
fixLenCol
.
nullBitmap
,
BitmapLen
(
allocCapacity
));
if
(
tmp
==
NULL
)
{
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
...
@@ -173,13 +172,13 @@ static FORCE_INLINE int32_t udfColEnsureCapacity(SUdfColumn* pColumn, int32_t ne
...
@@ -173,13 +172,13 @@ static FORCE_INLINE int32_t udfColEnsureCapacity(SUdfColumn* pColumn, int32_t ne
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
tmp
=
(
char
*
)
realloc
(
data
->
fixLenCol
.
data
,
allocCapacity
*
meta
->
bytes
);
tmp
=
(
char
*
)
realloc
(
data
->
fixLenCol
.
data
,
allocCapacity
*
meta
->
bytes
);
if
(
tmp
==
NULL
)
{
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
data
->
fixLenCol
.
data
=
tmp
;
data
->
fixLenCol
.
data
=
tmp
;
data
->
fixLenCol
.
dataLen
=
allocCapacity
*
meta
->
bytes
;
data
->
fixLenCol
.
dataLen
=
allocCapacity
*
meta
->
bytes
;
}
}
data
->
rowsAlloc
=
allocCapacity
;
data
->
rowsAlloc
=
allocCapacity
;
...
@@ -187,8 +186,8 @@ static FORCE_INLINE int32_t udfColEnsureCapacity(SUdfColumn* pColumn, int32_t ne
...
@@ -187,8 +186,8 @@ static FORCE_INLINE int32_t udfColEnsureCapacity(SUdfColumn* pColumn, int32_t ne
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
FORCE_INLINE
void
udfColDataSetNull
(
SUdfColumn
*
pColumn
,
int32_t
row
)
{
static
FORCE_INLINE
void
udfColDataSetNull
(
SUdfColumn
*
pColumn
,
int32_t
row
)
{
udfColEnsureCapacity
(
pColumn
,
row
+
1
);
udfColEnsureCapacity
(
pColumn
,
row
+
1
);
if
(
IS_VAR_DATA_TYPE
(
pColumn
->
colMeta
.
type
))
{
if
(
IS_VAR_DATA_TYPE
(
pColumn
->
colMeta
.
type
))
{
udfColDataSetNull_var
(
pColumn
,
row
);
udfColDataSetNull_var
(
pColumn
,
row
);
}
else
{
}
else
{
...
@@ -197,10 +196,10 @@ static FORCE_INLINE void udfColDataSetNull(SUdfColumn* pColumn, int32_t row) {
...
@@ -197,10 +196,10 @@ static FORCE_INLINE void udfColDataSetNull(SUdfColumn* pColumn, int32_t row) {
pColumn
->
hasNull
=
true
;
pColumn
->
hasNull
=
true
;
}
}
static
FORCE_INLINE
int32_t
udfColDataSet
(
SUdfColumn
*
pColumn
,
uint32_t
currentRow
,
const
char
*
pData
,
bool
isNull
)
{
static
FORCE_INLINE
int32_t
udfColDataSet
(
SUdfColumn
*
pColumn
,
uint32_t
currentRow
,
const
char
*
pData
,
bool
isNull
)
{
SUdfColumnMeta
*
meta
=
&
pColumn
->
colMeta
;
SUdfColumnMeta
*
meta
=
&
pColumn
->
colMeta
;
SUdfColumnData
*
data
=
&
pColumn
->
colData
;
SUdfColumnData
*
data
=
&
pColumn
->
colData
;
udfColEnsureCapacity
(
pColumn
,
currentRow
+
1
);
udfColEnsureCapacity
(
pColumn
,
currentRow
+
1
);
bool
isVarCol
=
IS_VAR_DATA_TYPE
(
meta
->
type
);
bool
isVarCol
=
IS_VAR_DATA_TYPE
(
meta
->
type
);
if
(
isNull
)
{
if
(
isNull
)
{
udfColDataSetNull
(
pColumn
,
currentRow
);
udfColDataSetNull
(
pColumn
,
currentRow
);
...
@@ -233,7 +232,7 @@ static FORCE_INLINE int32_t udfColDataSet(SUdfColumn* pColumn, uint32_t currentR
...
@@ -233,7 +232,7 @@ static FORCE_INLINE int32_t udfColDataSet(SUdfColumn* pColumn, uint32_t currentR
newSize
=
newSize
*
UDF_MEMORY_EXP_GROWTH
;
newSize
=
newSize
*
UDF_MEMORY_EXP_GROWTH
;
}
}
char
*
buf
=
(
char
*
)
realloc
(
data
->
varLenCol
.
payload
,
newSize
);
char
*
buf
=
(
char
*
)
realloc
(
data
->
varLenCol
.
payload
,
newSize
);
if
(
buf
==
NULL
)
{
if
(
buf
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
...
@@ -249,11 +248,11 @@ static FORCE_INLINE int32_t udfColDataSet(SUdfColumn* pColumn, uint32_t currentR
...
@@ -249,11 +248,11 @@ static FORCE_INLINE int32_t udfColDataSet(SUdfColumn* pColumn, uint32_t currentR
data
->
varLenCol
.
payloadLen
+=
dataLen
;
data
->
varLenCol
.
payloadLen
+=
dataLen
;
}
}
}
}
data
->
numOfRows
=
(
currentRow
+
1
>
data
->
numOfRows
)
?
(
currentRow
+
1
)
:
data
->
numOfRows
;
data
->
numOfRows
=
(
currentRow
+
1
>
data
->
numOfRows
)
?
(
currentRow
+
1
)
:
data
->
numOfRows
;
return
0
;
return
0
;
}
}
typedef
int32_t
(
*
TUdfScalarProcFunc
)(
SUdfDataBlock
*
block
,
SUdfColumn
*
resultCol
);
typedef
int32_t
(
*
TUdfScalarProcFunc
)(
SUdfDataBlock
*
block
,
SUdfColumn
*
resultCol
);
typedef
int32_t
(
*
TUdfAggStartFunc
)(
SUdfInterBuf
*
buf
);
typedef
int32_t
(
*
TUdfAggStartFunc
)(
SUdfInterBuf
*
buf
);
typedef
int32_t
(
*
TUdfAggProcessFunc
)(
SUdfDataBlock
*
block
,
SUdfInterBuf
*
interBuf
,
SUdfInterBuf
*
newInterBuf
);
typedef
int32_t
(
*
TUdfAggProcessFunc
)(
SUdfDataBlock
*
block
,
SUdfInterBuf
*
interBuf
,
SUdfInterBuf
*
newInterBuf
);
...
...
include/libs/function/tudf.h
浏览文件 @
4cc94968
...
@@ -24,12 +24,12 @@
...
@@ -24,12 +24,12 @@
#define alloc alloc
#define alloc alloc
#include <taosudf.h>
#include <taosudf.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdbool.h>
#include "tmsg.h"
#include <stdint.h>
#include "tcommon.h"
#include "function.h"
#include "function.h"
#include "tcommon.h"
#include "tdatablock.h"
#include "tdatablock.h"
#include "tmsg.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
...
@@ -43,8 +43,7 @@ extern "C" {
...
@@ -43,8 +43,7 @@ extern "C" {
#endif
#endif
#define UDF_DNODE_ID_ENV_NAME "DNODE_ID"
#define UDF_DNODE_ID_ENV_NAME "DNODE_ID"
// low level APIs
//low level APIs
/**
/**
* setup udf
* setup udf
* @param udf, in
* @param udf, in
...
@@ -62,7 +61,8 @@ int32_t doCallUdfAggProcess(UdfcFuncHandle handle, SSDataBlock *block, SUdfInter
...
@@ -62,7 +61,8 @@ int32_t doCallUdfAggProcess(UdfcFuncHandle handle, SSDataBlock *block, SUdfInter
int32_t
doCallUdfAggFinalize
(
UdfcFuncHandle
handle
,
SUdfInterBuf
*
interBuf
,
SUdfInterBuf
*
resultData
);
int32_t
doCallUdfAggFinalize
(
UdfcFuncHandle
handle
,
SUdfInterBuf
*
interBuf
,
SUdfInterBuf
*
resultData
);
// input: interbuf1, interbuf2
// input: interbuf1, interbuf2
// output: resultBuf
// output: resultBuf
int32_t
doCallUdfAggMerge
(
UdfcFuncHandle
handle
,
SUdfInterBuf
*
interBuf1
,
SUdfInterBuf
*
interBuf2
,
SUdfInterBuf
*
resultBuf
);
int32_t
doCallUdfAggMerge
(
UdfcFuncHandle
handle
,
SUdfInterBuf
*
interBuf1
,
SUdfInterBuf
*
interBuf2
,
SUdfInterBuf
*
resultBuf
);
// input: block
// input: block
// output: resultData
// output: resultData
int32_t
doCallUdfScalarFunc
(
UdfcFuncHandle
handle
,
SScalarParam
*
input
,
int32_t
numOfCols
,
SScalarParam
*
output
);
int32_t
doCallUdfScalarFunc
(
UdfcFuncHandle
handle
,
SScalarParam
*
input
,
int32_t
numOfCols
,
SScalarParam
*
output
);
...
@@ -75,11 +75,11 @@ int32_t doTeardownUdf(UdfcFuncHandle handle);
...
@@ -75,11 +75,11 @@ int32_t doTeardownUdf(UdfcFuncHandle handle);
void
freeUdfInterBuf
(
SUdfInterBuf
*
buf
);
void
freeUdfInterBuf
(
SUdfInterBuf
*
buf
);
//high level APIs
//
high level APIs
bool
udfAggGetEnv
(
struct
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
);
bool
udfAggGetEnv
(
struct
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
);
bool
udfAggInit
(
struct
SqlFunctionCtx
*
pCtx
,
struct
SResultRowEntryInfo
*
pResultCellInfo
);
bool
udfAggInit
(
struct
SqlFunctionCtx
*
pCtx
,
struct
SResultRowEntryInfo
*
pResultCellInfo
);
int32_t
udfAggProcess
(
struct
SqlFunctionCtx
*
pCtx
);
int32_t
udfAggProcess
(
struct
SqlFunctionCtx
*
pCtx
);
int32_t
udfAggFinalize
(
struct
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
);
int32_t
udfAggFinalize
(
struct
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
);
int32_t
callUdfScalarFunc
(
char
*
udfName
,
SScalarParam
*
input
,
int32_t
numOfCols
,
SScalarParam
*
output
);
int32_t
callUdfScalarFunc
(
char
*
udfName
,
SScalarParam
*
input
,
int32_t
numOfCols
,
SScalarParam
*
output
);
...
...
include/libs/monitor/monitor.h
浏览文件 @
4cc94968
...
@@ -227,7 +227,6 @@ int32_t tDeserializeSMonMloadInfo(void *buf, int32_t bufLen, SMonMloadInfo *pInf
...
@@ -227,7 +227,6 @@ int32_t tDeserializeSMonMloadInfo(void *buf, int32_t bufLen, SMonMloadInfo *pInf
int32_t
tSerializeSQnodeLoad
(
void
*
buf
,
int32_t
bufLen
,
SQnodeLoad
*
pInfo
);
int32_t
tSerializeSQnodeLoad
(
void
*
buf
,
int32_t
bufLen
,
SQnodeLoad
*
pInfo
);
int32_t
tDeserializeSQnodeLoad
(
void
*
buf
,
int32_t
bufLen
,
SQnodeLoad
*
pInfo
);
int32_t
tDeserializeSQnodeLoad
(
void
*
buf
,
int32_t
bufLen
,
SQnodeLoad
*
pInfo
);
typedef
struct
{
typedef
struct
{
const
char
*
server
;
const
char
*
server
;
uint16_t
port
;
uint16_t
port
;
...
...
include/libs/qcom/query.h
浏览文件 @
4cc94968
...
@@ -61,7 +61,6 @@ typedef struct STableComInfo {
...
@@ -61,7 +61,6 @@ typedef struct STableComInfo {
int32_t
rowSize
;
// row size of the schema
int32_t
rowSize
;
// row size of the schema
}
STableComInfo
;
}
STableComInfo
;
typedef
struct
SIndexMeta
{
typedef
struct
SIndexMeta
{
#if defined(WINDOWS) || defined(_TD_DARWIN_64)
#if defined(WINDOWS) || defined(_TD_DARWIN_64)
size_t
avoidCompilationErrors
;
size_t
avoidCompilationErrors
;
...
@@ -166,7 +165,7 @@ typedef struct SRequestConnInfo {
...
@@ -166,7 +165,7 @@ typedef struct SRequestConnInfo {
SEpSet
mgmtEps
;
SEpSet
mgmtEps
;
}
SRequestConnInfo
;
}
SRequestConnInfo
;
typedef
void
(
*
__freeFunc
)(
void
*
param
);
typedef
void
(
*
__freeFunc
)(
void
*
param
);
typedef
struct
SMsgSendInfo
{
typedef
struct
SMsgSendInfo
{
__async_send_cb_fn_t
fp
;
// async callback function
__async_send_cb_fn_t
fp
;
// async callback function
...
@@ -218,7 +217,7 @@ void initQueryModuleMsgHandle();
...
@@ -218,7 +217,7 @@ void initQueryModuleMsgHandle();
const
SSchema
*
tGetTbnameColumnSchema
();
const
SSchema
*
tGetTbnameColumnSchema
();
bool
tIsValidSchema
(
struct
SSchema
*
pSchema
,
int32_t
numOfCols
,
int32_t
numOfTags
);
bool
tIsValidSchema
(
struct
SSchema
*
pSchema
,
int32_t
numOfCols
,
int32_t
numOfTags
);
int32_t
queryCreateCTableMetaFromMsg
(
STableMetaRsp
*
msg
,
SCTableMeta
*
pMeta
);
int32_t
queryCreateCTableMetaFromMsg
(
STableMetaRsp
*
msg
,
SCTableMeta
*
pMeta
);
int32_t
queryCreateTableMetaFromMsg
(
STableMetaRsp
*
msg
,
bool
isSuperTable
,
STableMeta
**
pMeta
);
int32_t
queryCreateTableMetaFromMsg
(
STableMetaRsp
*
msg
,
bool
isSuperTable
,
STableMeta
**
pMeta
);
char
*
jobTaskStatusStr
(
int32_t
status
);
char
*
jobTaskStatusStr
(
int32_t
status
);
...
@@ -265,7 +264,9 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t
...
@@ -265,7 +264,9 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t
#define REQUEST_TOTAL_EXEC_TIMES 2
#define REQUEST_TOTAL_EXEC_TIMES 2
#define IS_SYS_DBNAME(_dbname) (((*(_dbname) == 'i') && (0 == strcmp(_dbname, TSDB_INFORMATION_SCHEMA_DB))) || ((*(_dbname) == 'p') && (0 == strcmp(_dbname, TSDB_PERFORMANCE_SCHEMA_DB))))
#define IS_SYS_DBNAME(_dbname) \
(((*(_dbname) == 'i') && (0 == strcmp(_dbname, TSDB_INFORMATION_SCHEMA_DB))) || \
((*(_dbname) == 'p') && (0 == strcmp(_dbname, TSDB_PERFORMANCE_SCHEMA_DB))))
#define qFatal(...) \
#define qFatal(...) \
do { \
do { \
...
...
include/libs/qworker/qworker.h
浏览文件 @
4cc94968
...
@@ -72,7 +72,6 @@ typedef struct SQWMsg {
...
@@ -72,7 +72,6 @@ typedef struct SQWMsg {
SRpcHandleInfo
connInfo
;
SRpcHandleInfo
connInfo
;
}
SQWMsg
;
}
SQWMsg
;
int32_t
qWorkerInit
(
int8_t
nodeType
,
int32_t
nodeId
,
void
**
qWorkerMgmt
,
const
SMsgCb
*
pMsgCb
);
int32_t
qWorkerInit
(
int8_t
nodeType
,
int32_t
nodeId
,
void
**
qWorkerMgmt
,
const
SMsgCb
*
pMsgCb
);
int32_t
qWorkerAbortPreprocessQueryMsg
(
void
*
qWorkerMgmt
,
SRpcMsg
*
pMsg
);
int32_t
qWorkerAbortPreprocessQueryMsg
(
void
*
qWorkerMgmt
,
SRpcMsg
*
pMsg
);
...
@@ -99,9 +98,11 @@ void qWorkerDestroy(void **qWorkerMgmt);
...
@@ -99,9 +98,11 @@ void qWorkerDestroy(void **qWorkerMgmt);
int32_t
qWorkerGetStat
(
SReadHandle
*
handle
,
void
*
qWorkerMgmt
,
SQWorkerStat
*
pStat
);
int32_t
qWorkerGetStat
(
SReadHandle
*
handle
,
void
*
qWorkerMgmt
,
SQWorkerStat
*
pStat
);
int32_t
qWorkerProcessLocalQuery
(
void
*
pMgmt
,
uint64_t
sId
,
uint64_t
qId
,
uint64_t
tId
,
int64_t
rId
,
int32_t
eId
,
SQWMsg
*
qwMsg
,
SArray
*
explainRes
);
int32_t
qWorkerProcessLocalQuery
(
void
*
pMgmt
,
uint64_t
sId
,
uint64_t
qId
,
uint64_t
tId
,
int64_t
rId
,
int32_t
eId
,
SQWMsg
*
qwMsg
,
SArray
*
explainRes
);
int32_t
qWorkerProcessLocalFetch
(
void
*
pMgmt
,
uint64_t
sId
,
uint64_t
qId
,
uint64_t
tId
,
int64_t
rId
,
int32_t
eId
,
void
**
pRsp
,
SArray
*
explainRes
);
int32_t
qWorkerProcessLocalFetch
(
void
*
pMgmt
,
uint64_t
sId
,
uint64_t
qId
,
uint64_t
tId
,
int64_t
rId
,
int32_t
eId
,
void
**
pRsp
,
SArray
*
explainRes
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
include/libs/scalar/filter.h
浏览文件 @
4cc94968
...
@@ -41,7 +41,8 @@ typedef struct SFilterColumnParam {
...
@@ -41,7 +41,8 @@ typedef struct SFilterColumnParam {
}
SFilterColumnParam
;
}
SFilterColumnParam
;
extern
int32_t
filterInitFromNode
(
SNode
*
pNode
,
SFilterInfo
**
pinfo
,
uint32_t
options
);
extern
int32_t
filterInitFromNode
(
SNode
*
pNode
,
SFilterInfo
**
pinfo
,
uint32_t
options
);
extern
bool
filterExecute
(
SFilterInfo
*
info
,
SSDataBlock
*
pSrc
,
SColumnInfoData
**
p
,
SColumnDataAgg
*
statis
,
int16_t
numOfCols
,
int32_t
*
pFilterResStatus
);
extern
bool
filterExecute
(
SFilterInfo
*
info
,
SSDataBlock
*
pSrc
,
SColumnInfoData
**
p
,
SColumnDataAgg
*
statis
,
int16_t
numOfCols
,
int32_t
*
pFilterResStatus
);
extern
int32_t
filterSetDataFromSlotId
(
SFilterInfo
*
info
,
void
*
param
);
extern
int32_t
filterSetDataFromSlotId
(
SFilterInfo
*
info
,
void
*
param
);
extern
int32_t
filterSetDataFromColId
(
SFilterInfo
*
info
,
void
*
param
);
extern
int32_t
filterSetDataFromColId
(
SFilterInfo
*
info
,
void
*
param
);
extern
int32_t
filterGetTimeRange
(
SNode
*
pNode
,
STimeWindow
*
win
,
bool
*
isStrict
);
extern
int32_t
filterGetTimeRange
(
SNode
*
pNode
,
STimeWindow
*
win
,
bool
*
isStrict
);
...
...
include/libs/scheduler/scheduler.h
浏览文件 @
4cc94968
...
@@ -50,11 +50,11 @@ typedef struct SQueryProfileSummary {
...
@@ -50,11 +50,11 @@ typedef struct SQueryProfileSummary {
typedef
struct
STaskInfo
{
typedef
struct
STaskInfo
{
SQueryNodeAddr
addr
;
SQueryNodeAddr
addr
;
SSubQueryMsg
*
msg
;
SSubQueryMsg
*
msg
;
}
STaskInfo
;
}
STaskInfo
;
typedef
struct
SSchdFetchParam
{
typedef
struct
SSchdFetchParam
{
void
**
pData
;
void
**
pData
;
int32_t
*
code
;
int32_t
*
code
;
}
SSchdFetchParam
;
}
SSchdFetchParam
;
...
@@ -65,11 +65,11 @@ typedef bool (*schedulerChkKillFp)(void* param);
...
@@ -65,11 +65,11 @@ typedef bool (*schedulerChkKillFp)(void* param);
typedef
struct
SSchedulerReq
{
typedef
struct
SSchedulerReq
{
bool
syncReq
;
bool
syncReq
;
bool
localReq
;
bool
localReq
;
SRequestConnInfo
*
pConn
;
SRequestConnInfo
*
pConn
;
SArray
*
pNodeList
;
SArray
*
pNodeList
;
SQueryPlan
*
pDag
;
SQueryPlan
*
pDag
;
int64_t
allocatorRefId
;
int64_t
allocatorRefId
;
const
char
*
sql
;
const
char
*
sql
;
int64_t
startTs
;
int64_t
startTs
;
schedulerExecFp
execFp
;
schedulerExecFp
execFp
;
schedulerFetchFp
fetchFp
;
schedulerFetchFp
fetchFp
;
...
@@ -80,18 +80,17 @@ typedef struct SSchedulerReq {
...
@@ -80,18 +80,17 @@ typedef struct SSchedulerReq {
void
**
pFetchRes
;
void
**
pFetchRes
;
}
SSchedulerReq
;
}
SSchedulerReq
;
int32_t
schedulerInit
(
void
);
int32_t
schedulerInit
(
void
);
int32_t
schedulerExecJob
(
SSchedulerReq
*
pReq
,
int64_t
*
pJob
);
int32_t
schedulerExecJob
(
SSchedulerReq
*
pReq
,
int64_t
*
pJob
);
int32_t
schedulerFetchRows
(
int64_t
jobId
,
SSchedulerReq
*
pReq
);
int32_t
schedulerFetchRows
(
int64_t
jobId
,
SSchedulerReq
*
pReq
);
void
schedulerFetchRowsA
(
int64_t
job
,
schedulerFetchFp
fp
,
void
*
param
);
void
schedulerFetchRowsA
(
int64_t
job
,
schedulerFetchFp
fp
,
void
*
param
);
int32_t
schedulerGetTasksStatus
(
int64_t
job
,
SArray
*
pSub
);
int32_t
schedulerGetTasksStatus
(
int64_t
job
,
SArray
*
pSub
);
void
schedulerStopQueryHb
(
void
*
pTrans
);
void
schedulerStopQueryHb
(
void
*
pTrans
);
int32_t
schedulerUpdatePolicy
(
int32_t
policy
);
int32_t
schedulerUpdatePolicy
(
int32_t
policy
);
int32_t
schedulerEnableReSchedule
(
bool
enableResche
);
int32_t
schedulerEnableReSchedule
(
bool
enableResche
);
...
@@ -101,7 +100,7 @@ int32_t schedulerEnableReSchedule(bool enableResche);
...
@@ -101,7 +100,7 @@ int32_t schedulerEnableReSchedule(bool enableResche);
* @param pJob
* @param pJob
* @return
* @return
*/
*/
//int32_t scheduleCancelJob(void *pJob);
//
int32_t scheduleCancelJob(void *pJob);
/**
/**
* Free the query job
* Free the query job
...
...
include/libs/sync/sync.h
浏览文件 @
4cc94968
...
@@ -132,7 +132,7 @@ typedef struct SSyncFSM {
...
@@ -132,7 +132,7 @@ typedef struct SSyncFSM {
void
(
*
FpRollBackCb
)(
struct
SSyncFSM
*
pFsm
,
const
SRpcMsg
*
pMsg
,
SFsmCbMeta
cbMeta
);
void
(
*
FpRollBackCb
)(
struct
SSyncFSM
*
pFsm
,
const
SRpcMsg
*
pMsg
,
SFsmCbMeta
cbMeta
);
void
(
*
FpRestoreFinishCb
)(
struct
SSyncFSM
*
pFsm
);
void
(
*
FpRestoreFinishCb
)(
struct
SSyncFSM
*
pFsm
);
void
(
*
FpReConfigCb
)(
struct
SSyncFSM
*
pFsm
,
const
SRpcMsg
*
pMsg
,
SReConfigCbMeta
*
cbMeta
);
void
(
*
FpReConfigCb
)(
struct
SSyncFSM
*
pFsm
,
const
SRpcMsg
*
pMsg
,
SReConfigCbMeta
*
cbMeta
);
void
(
*
FpLeaderTransferCb
)(
struct
SSyncFSM
*
pFsm
,
const
SRpcMsg
*
pMsg
,
SFsmCbMeta
cbMeta
);
void
(
*
FpLeaderTransferCb
)(
struct
SSyncFSM
*
pFsm
,
const
SRpcMsg
*
pMsg
,
SFsmCbMeta
cbMeta
);
void
(
*
FpBecomeLeaderCb
)(
struct
SSyncFSM
*
pFsm
);
void
(
*
FpBecomeLeaderCb
)(
struct
SSyncFSM
*
pFsm
);
...
...
include/libs/tfs/tfs.h
浏览文件 @
4cc94968
...
@@ -16,8 +16,8 @@
...
@@ -16,8 +16,8 @@
#ifndef _TD_TFS_H_
#ifndef _TD_TFS_H_
#define _TD_TFS_H_
#define _TD_TFS_H_
#include "tdef.h"
#include "monitor.h"
#include "monitor.h"
#include "tdef.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
...
...
include/os/os.h
浏览文件 @
4cc94968
...
@@ -26,28 +26,28 @@ extern "C" {
...
@@ -26,28 +26,28 @@ extern "C" {
#include <regex.h>
#include <regex.h>
#if !defined(WINDOWS)
#if !defined(WINDOWS)
#include <unistd.h>
#include <dirent.h>
#include <dirent.h>
#include <libgen.h>
#include <sched.h>
#include <sched.h>
#include <unistd.h>
#include <wordexp.h>
#include <wordexp.h>
#include <libgen.h>
#include <sys/utsname.h>
#include <sys/param.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/param.h>
#include <sys/shm.h>
#include <sys/stat.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <sys/time.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/types.h>
#include <termios.h>
#include <sys/utsname.h>
#include <sys/statvfs.h>
#include <sys/shm.h>
#include <sys/wait.h>
#include <sys/wait.h>
#include <termios.h>
#if defined(DARWIN)
#if defined(DARWIN)
#else
#else
#include <sys/prctl.h>
#include <argp.h>
#include <argp.h>
#include <sys/prctl.h>
#endif
#endif
#else
#else
...
@@ -82,11 +82,13 @@ extern "C" {
...
@@ -82,11 +82,13 @@ extern "C" {
#include <wchar.h>
#include <wchar.h>
#include <wctype.h>
#include <wctype.h>
#include "taoserror.h"
#include "osThread.h"
#include "osAtomic.h"
#include "osAtomic.h"
#include "osDef.h"
#include "osDef.h"
#include "osDir.h"
#include "osDir.h"
#include "osEndian.h"
#include "osEndian.h"
#include "osEnv.h"
#include "osFile.h"
#include "osFile.h"
#include "osLocale.h"
#include "osLocale.h"
#include "osLz4.h"
#include "osLz4.h"
...
@@ -94,10 +96,9 @@ extern "C" {
...
@@ -94,10 +96,9 @@ extern "C" {
#include "osMemory.h"
#include "osMemory.h"
#include "osProc.h"
#include "osProc.h"
#include "osRand.h"
#include "osRand.h"
#include "osThread.h"
#include "osSemaphore.h"
#include "osSemaphore.h"
#include "osSignal.h"
#include "osShm.h"
#include "osShm.h"
#include "osSignal.h"
#include "osSleep.h"
#include "osSleep.h"
#include "osSocket.h"
#include "osSocket.h"
#include "osString.h"
#include "osString.h"
...
@@ -106,7 +107,7 @@ extern "C" {
...
@@ -106,7 +107,7 @@ extern "C" {
#include "osTime.h"
#include "osTime.h"
#include "osTimer.h"
#include "osTimer.h"
#include "osTimezone.h"
#include "osTimezone.h"
#include "
osEnv
.h"
#include "
taoserror
.h"
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
include/os/osDef.h
浏览文件 @
4cc94968
...
@@ -21,101 +21,100 @@ extern "C" {
...
@@ -21,101 +21,100 @@ extern "C" {
#endif
#endif
#if defined(_TD_DARWIN_64)
#if defined(_TD_DARWIN_64)
// specific
// specific
#ifndef __COMPAR_FN_T
#ifndef __COMPAR_FN_T
#define __COMPAR_FN_T
#define __COMPAR_FN_T
typedef
int
(
*
__compar_fn_t
)(
const
void
*
,
const
void
*
);
typedef
int
(
*
__compar_fn_t
)(
const
void
*
,
const
void
*
);
#endif
#endif
// for send function in tsocket.c
// for send function in tsocket.c
#if defined(MSG_NOSIGNAL)
#if defined(MSG_NOSIGNAL)
#undef MSG_NOSIGNAL
#undef MSG_NOSIGNAL
#endif
#endif
#define MSG_NOSIGNAL
0
#define MSG_NOSIGNAL
0
#define SO_NO_CHECK
0x1234
#define SO_NO_CHECK
0x1234
#define SOL_TCP
0x1234
#define SOL_TCP
0x1234
#define TCP_KEEPIDLE
0x1234
#define TCP_KEEPIDLE
0x1234
#ifndef PTHREAD_MUTEX_RECURSIVE_NP
#ifndef PTHREAD_MUTEX_RECURSIVE_NP
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
#endif
#endif
#endif
#endif
#if defined(_ALPINE)
#if defined(_ALPINE)
#ifndef __COMPAR_FN_T
#ifndef __COMPAR_FN_T
#define __COMPAR_FN_T
#define __COMPAR_FN_T
typedef
int
(
*
__compar_fn_t
)(
const
void
*
,
const
void
*
);
typedef
int
(
*
__compar_fn_t
)(
const
void
*
,
const
void
*
);
#endif
void
error
(
int
,
int
,
const
char
*
);
#ifndef PTHREAD_MUTEX_RECURSIVE_NP
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
#endif
#endif
void
error
(
int
,
int
,
const
char
*
);
#ifndef PTHREAD_MUTEX_RECURSIVE_NP
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
#endif
#endif
#endif
#if defined(WINDOWS)
#if defined(WINDOWS)
char
*
stpcpy
(
char
*
dest
,
const
char
*
src
);
char
*
stpcpy
(
char
*
dest
,
const
char
*
src
);
char
*
stpncpy
(
char
*
dest
,
const
char
*
src
,
int
n
);
char
*
stpncpy
(
char
*
dest
,
const
char
*
src
,
int
n
);
// specific
// specific
#ifndef __COMPAR_FN_T
#ifndef __COMPAR_FN_T
#define __COMPAR_FN_T
#define __COMPAR_FN_T
typedef
int
(
*
__compar_fn_t
)(
const
void
*
,
const
void
*
);
typedef
int
(
*
__compar_fn_t
)(
const
void
*
,
const
void
*
);
#endif
#endif
#define ssize_t int
#define ssize_t int
#define _SSIZE_T_
#define _SSIZE_T_
#define bzero(ptr, size) memset((ptr), 0, (size))
#define bzero(ptr, size) memset((ptr), 0, (size))
#define strcasecmp
_stricmp
#define strcasecmp
_stricmp
#define strncasecmp
_strnicmp
#define strncasecmp
_strnicmp
#define wcsncasecmp
_wcsnicmp
#define wcsncasecmp
_wcsnicmp
#define strtok_r
strtok_s
#define strtok_r
strtok_s
// #define snprintf _snprintf
// #define snprintf _snprintf
#define in_addr_t unsigned long
#define in_addr_t unsigned long
// #define socklen_t int
// #define socklen_t int
char
*
strsep
(
char
**
stringp
,
const
char
*
delim
);
char
*
strsep
(
char
**
stringp
,
const
char
*
delim
);
char
*
getpass
(
const
char
*
prefix
);
char
*
getpass
(
const
char
*
prefix
);
char
*
strndup
(
const
char
*
s
,
int
n
);
char
*
strndup
(
const
char
*
s
,
int
n
);
// for send function in tsocket.c
// for send function in tsocket.c
#define MSG_NOSIGNAL
0
#define MSG_NOSIGNAL
0
#define SO_NO_CHECK
0x1234
#define SO_NO_CHECK
0x1234
#define SOL_TCP
0x1234
#define SOL_TCP
0x1234
#define SHUT_RDWR
SD_BOTH
#define SHUT_RDWR
SD_BOTH
#define SHUT_RD
SD_RECEIVE
#define SHUT_RD
SD_RECEIVE
#define SHUT_WR
SD_SEND
#define SHUT_WR
SD_SEND
#define LOCK_EX 1
#define LOCK_EX 1
#define LOCK_NB 2
#define LOCK_NB 2
#define LOCK_UN 3
#define LOCK_UN 3
#ifndef PATH_MAX
#ifndef PATH_MAX
#define PATH_MAX 256
#define PATH_MAX 256
#endif
#endif
typedef
struct
{
typedef
struct
{
int
we_wordc
;
int
we_wordc
;
char
*
we_wordv
[
1
];
char
*
we_wordv
[
1
];
int
we_offs
;
int
we_offs
;
char
wordPos
[
1025
];
char
wordPos
[
1025
];
}
wordexp_t
;
}
wordexp_t
;
int
wordexp
(
char
*
words
,
wordexp_t
*
pwordexp
,
int
flags
);
int
wordexp
(
char
*
words
,
wordexp_t
*
pwordexp
,
int
flags
);
void
wordfree
(
wordexp_t
*
pwordexp
);
void
wordfree
(
wordexp_t
*
pwordexp
);
#define openlog(a, b, c)
#define openlog(a, b, c)
#define closelog()
#define closelog()
#define LOG_ERR
0
#define LOG_ERR
0
#define LOG_INFO 1
#define LOG_INFO 1
void
syslog
(
int
unused
,
const
char
*
format
,
...);
void
syslog
(
int
unused
,
const
char
*
format
,
...);
#endif // WINDOWS
#endif // WINDOWS
#ifndef WINDOWS
#ifndef WINDOWS
#ifndef O_BINARY
#ifndef O_BINARY
#define O_BINARY 0
#define O_BINARY 0
#endif
#endif
#endif
#endif
#define POINTER_SHIFT(p, b) ((void *)((char *)(p) + (b)))
#define POINTER_SHIFT(p, b) ((void *)((char *)(p) + (b)))
...
@@ -171,9 +170,15 @@ extern "C" {
...
@@ -171,9 +170,15 @@ extern "C" {
#define DEFAULT_DOUBLE_COMP(x, y) \
#define DEFAULT_DOUBLE_COMP(x, y) \
do { \
do { \
if (isnan(x) && isnan(y)) { return 0; } \
if (isnan(x) && isnan(y)) { \
if (isnan(x)) { return -1; } \
return 0; \
if (isnan(y)) { return 1; } \
} \
if (isnan(x)) { \
return -1; \
} \
if (isnan(y)) { \
return 1; \
} \
if ((x) == (y)) { \
if ((x) == (y)) { \
return 0; \
return 0; \
} else { \
} else { \
...
@@ -190,37 +195,43 @@ extern "C" {
...
@@ -190,37 +195,43 @@ extern "C" {
#undef threadlocal
#undef threadlocal
#ifdef _ISOC11_SOURCE
#ifdef _ISOC11_SOURCE
#define threadlocal _Thread_local
#define threadlocal _Thread_local
#elif defined(__APPLE__)
#elif defined(__APPLE__)
#define threadlocal __thread
#define threadlocal __thread
#elif defined(__GNUC__) && !defined(threadlocal)
#elif defined(__GNUC__) && !defined(threadlocal)
#define threadlocal __thread
#define threadlocal __thread
#else
#else
#define threadlocal __declspec( thread
)
#define threadlocal __declspec(thread
)
#endif
#endif
#ifdef WINDOWS
#ifdef WINDOWS
#define PRIzu "ld"
#define PRIzu "ld"
#else
#else
#define PRIzu "zu"
#define PRIzu "zu"
#endif
#endif
#if !defined(WINDOWS)
#if !defined(WINDOWS)
#if defined(_TD_DARWIN_64)
#if defined(_TD_DARWIN_64)
// MacOS
// MacOS
#if !defined(_GNU_SOURCE)
#if !defined(_GNU_SOURCE)
#define setThreadName(name) do { pthread_setname_np((name)); } while (0)
#define setThreadName(name) \
#else
do { \
// pthread_setname_np not defined
pthread_setname_np((name)); \
#define setThreadName(name)
} while (0)
#endif
#else
#else
// pthread_setname_np not defined
// Linux, length of name must <= 16 (the last '\0' included)
#define setThreadName(name)
#define setThreadName(name) do { prctl(PR_SET_NAME, (name)); } while (0)
#endif
#endif
#else
// Linux, length of name must <= 16 (the last '\0' included)
#define setThreadName(name) \
do { \
prctl(PR_SET_NAME, (name)); \
} while (0)
#endif
#else
#else
// Windows
// Windows
#define setThreadName(name)
#define setThreadName(name)
#endif
#endif
#if defined(_WIN32)
#if defined(_WIN32)
...
...
include/os/osDir.h
浏览文件 @
4cc94968
...
@@ -19,12 +19,12 @@
...
@@ -19,12 +19,12 @@
// If the error is in a third-party library, place this header file under the third-party library header file.
// If the error is in a third-party library, place this header file under the third-party library header file.
// When you want to use this feature, you should find or add the same function in the following section.
// When you want to use this feature, you should find or add the same function in the following section.
#ifndef ALLOW_FORBID_FUNC
#ifndef ALLOW_FORBID_FUNC
#define opendir
OPENDIR_FUNC_TAOS_FORBID
#define opendir
OPENDIR_FUNC_TAOS_FORBID
#define readdir
READDIR_FUNC_TAOS_FORBID
#define readdir
READDIR_FUNC_TAOS_FORBID
#define closedir CLOSEDIR_FUNC_TAOS_FORBID
#define closedir CLOSEDIR_FUNC_TAOS_FORBID
#define dirname
DIRNAME_FUNC_TAOS_FORBID
#define dirname
DIRNAME_FUNC_TAOS_FORBID
#undef basename
#undef basename
#define basename BASENAME_FUNC_TAOS_FORBID
#define basename BASENAME_FUNC_TAOS_FORBID
#endif
#endif
#ifdef __cplusplus
#ifdef __cplusplus
...
@@ -51,7 +51,6 @@ extern "C" {
...
@@ -51,7 +51,6 @@ extern "C" {
typedef
struct
TdDir
*
TdDirPtr
;
typedef
struct
TdDir
*
TdDirPtr
;
typedef
struct
TdDirEntry
*
TdDirEntryPtr
;
typedef
struct
TdDirEntry
*
TdDirEntryPtr
;
void
taosRemoveDir
(
const
char
*
dirname
);
void
taosRemoveDir
(
const
char
*
dirname
);
bool
taosDirExist
(
const
char
*
dirname
);
bool
taosDirExist
(
const
char
*
dirname
);
int32_t
taosMkDir
(
const
char
*
dirname
);
int32_t
taosMkDir
(
const
char
*
dirname
);
...
@@ -61,13 +60,13 @@ void taosRemoveOldFiles(const char *dirname, int32_t keepDays);
...
@@ -61,13 +60,13 @@ void taosRemoveOldFiles(const char *dirname, int32_t keepDays);
int32_t
taosExpandDir
(
const
char
*
dirname
,
char
*
outname
,
int32_t
maxlen
);
int32_t
taosExpandDir
(
const
char
*
dirname
,
char
*
outname
,
int32_t
maxlen
);
int32_t
taosRealPath
(
char
*
dirname
,
char
*
realPath
,
int32_t
maxlen
);
int32_t
taosRealPath
(
char
*
dirname
,
char
*
realPath
,
int32_t
maxlen
);
bool
taosIsDir
(
const
char
*
dirname
);
bool
taosIsDir
(
const
char
*
dirname
);
char
*
taosDirName
(
char
*
dirname
);
char
*
taosDirName
(
char
*
dirname
);
char
*
taosDirEntryBaseName
(
char
*
dirname
);
char
*
taosDirEntryBaseName
(
char
*
dirname
);
TdDirPtr
taosOpenDir
(
const
char
*
dirname
);
TdDirPtr
taosOpenDir
(
const
char
*
dirname
);
TdDirEntryPtr
taosReadDir
(
TdDirPtr
pDir
);
TdDirEntryPtr
taosReadDir
(
TdDirPtr
pDir
);
bool
taosDirEntryIsDir
(
TdDirEntryPtr
pDirEntry
);
bool
taosDirEntryIsDir
(
TdDirEntryPtr
pDirEntry
);
char
*
taosGetDirEntryName
(
TdDirEntryPtr
pDirEntry
);
char
*
taosGetDirEntryName
(
TdDirEntryPtr
pDirEntry
);
int32_t
taosCloseDir
(
TdDirPtr
*
ppDir
);
int32_t
taosCloseDir
(
TdDirPtr
*
ppDir
);
#ifdef __cplusplus
#ifdef __cplusplus
...
...
include/os/osEndian.h
浏览文件 @
4cc94968
include/os/osEnv.h
浏览文件 @
4cc94968
...
@@ -34,7 +34,7 @@ extern int64_t tsOpenMax;
...
@@ -34,7 +34,7 @@ extern int64_t tsOpenMax;
extern
int64_t
tsStreamMax
;
extern
int64_t
tsStreamMax
;
extern
float
tsNumOfCores
;
extern
float
tsNumOfCores
;
extern
int64_t
tsTotalMemoryKB
;
extern
int64_t
tsTotalMemoryKB
;
extern
char
*
tsProcPath
;
extern
char
*
tsProcPath
;
extern
char
configDir
[];
extern
char
configDir
[];
extern
char
tsDataDir
[];
extern
char
tsDataDir
[];
...
...
include/os/osEok.h
浏览文件 @
4cc94968
...
@@ -24,8 +24,7 @@ extern "C" {
...
@@ -24,8 +24,7 @@ extern "C" {
#ifdef __APPLE__
#ifdef __APPLE__
enum
EPOLL_EVENTS
enum
EPOLL_EVENTS
{
{
EPOLLIN
=
0x001
,
EPOLLIN
=
0x001
,
#define EPOLLIN EPOLLIN
#define EPOLLIN EPOLLIN
EPOLLPRI
=
0x002
,
EPOLLPRI
=
0x002
,
...
@@ -56,24 +55,21 @@ enum EPOLL_EVENTS
...
@@ -56,24 +55,21 @@ enum EPOLL_EVENTS
#define EPOLLONESHOT EPOLLONESHOT
#define EPOLLONESHOT EPOLLONESHOT
EPOLLET
=
1u
<<
31
EPOLLET
=
1u
<<
31
#define EPOLLET EPOLLET
#define EPOLLET EPOLLET
};
};
/* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */
/* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */
#define EPOLL_CTL_ADD 1
/* Add a file descriptor to the interface. */
#define EPOLL_CTL_ADD 1
/* Add a file descriptor to the interface. */
#define EPOLL_CTL_DEL 2
/* Remove a file descriptor from the interface. */
#define EPOLL_CTL_DEL 2
/* Remove a file descriptor from the interface. */
#define EPOLL_CTL_MOD 3
/* Change file descriptor epoll_event structure. */
#define EPOLL_CTL_MOD 3
/* Change file descriptor epoll_event structure. */
typedef
union
epoll_data
{
typedef
union
epoll_data
{
void
*
ptr
;
void
*
ptr
;
int
fd
;
int
fd
;
uint32_t
u32
;
uint32_t
u32
;
uint64_t
u64
;
uint64_t
u64
;
}
epoll_data_t
;
}
epoll_data_t
;
struct
epoll_event
struct
epoll_event
{
{
uint32_t
events
;
/* Epoll events */
uint32_t
events
;
/* Epoll events */
epoll_data_t
data
;
/* User data variable */
epoll_data_t
data
;
/* User data variable */
};
};
...
@@ -90,4 +86,3 @@ int epoll_close(int epfd);
...
@@ -90,4 +86,3 @@ int epoll_close(int epfd);
#endif
#endif
#endif // _eok_h_fd274616_996c_400e_9023_ae70be881fa3_
#endif // _eok_h_fd274616_996c_400e_9023_ae70be881fa3_
include/os/osLocale.h
浏览文件 @
4cc94968
...
@@ -25,7 +25,7 @@ extern "C" {
...
@@ -25,7 +25,7 @@ extern "C" {
// If the error is in a third-party library, place this header file under the third-party library header file.
// If the error is in a third-party library, place this header file under the third-party library header file.
// When you want to use this feature, you should find or add the same function in the following section.
// When you want to use this feature, you should find or add the same function in the following section.
#ifndef ALLOW_FORBID_FUNC
#ifndef ALLOW_FORBID_FUNC
#define setlocale SETLOCALE_FUNC_TAOS_FORBID
#define setlocale SETLOCALE_FUNC_TAOS_FORBID
#endif
#endif
char
*
taosCharsetReplace
(
char
*
charsetstr
);
char
*
taosCharsetReplace
(
char
*
charsetstr
);
...
...
include/os/osLz4.h
浏览文件 @
4cc94968
...
@@ -21,25 +21,25 @@ extern "C" {
...
@@ -21,25 +21,25 @@ extern "C" {
#endif
#endif
#ifdef WINDOWS
#ifdef WINDOWS
int32_t
BUILDIN_CLZL
(
uint64_t
val
);
int32_t
BUILDIN_CLZL
(
uint64_t
val
);
int32_t
BUILDIN_CLZ
(
uint32_t
val
);
int32_t
BUILDIN_CLZ
(
uint32_t
val
);
int32_t
BUILDIN_CTZL
(
uint64_t
val
);
int32_t
BUILDIN_CTZL
(
uint64_t
val
);
int32_t
BUILDIN_CTZ
(
uint32_t
val
);
int32_t
BUILDIN_CTZ
(
uint32_t
val
);
#elif defined
(_TD_LINUX_32)
#elif defined(_TD_LINUX_32)
#define BUILDIN_CLZL(val) __builtin_clzll(val)
#define BUILDIN_CLZL(val) __builtin_clzll(val)
#define BUILDIN_CTZL(val) __builtin_ctzll(val)
#define BUILDIN_CTZL(val) __builtin_ctzll(val)
#define BUILDIN_CLZ(val)
__builtin_clz(val)
#define BUILDIN_CLZ(val)
__builtin_clz(val)
#define BUILDIN_CTZ(val)
__builtin_ctz(val)
#define BUILDIN_CTZ(val)
__builtin_ctz(val)
#elif defined
(_TD_ARM_32)
#elif defined(_TD_ARM_32)
#define BUILDIN_CLZL(val) __builtin_clzll(val)
#define BUILDIN_CLZL(val) __builtin_clzll(val)
#define BUILDIN_CTZL(val) __builtin_ctzll(val)
#define BUILDIN_CTZL(val) __builtin_ctzll(val)
#define BUILDIN_CLZ(val)
__builtin_clz(val)
#define BUILDIN_CLZ(val)
__builtin_clz(val)
#define BUILDIN_CTZ(val)
__builtin_ctz(val)
#define BUILDIN_CTZ(val)
__builtin_ctz(val)
#else
#else
#define BUILDIN_CLZL(val) __builtin_clzl(val)
#define BUILDIN_CLZL(val) __builtin_clzl(val)
#define BUILDIN_CTZL(val) __builtin_ctzl(val)
#define BUILDIN_CTZL(val) __builtin_ctzl(val)
#define BUILDIN_CLZ(val)
__builtin_clz(val)
#define BUILDIN_CLZ(val)
__builtin_clz(val)
#define BUILDIN_CTZ(val)
__builtin_ctz(val)
#define BUILDIN_CTZ(val)
__builtin_ctz(val)
#endif
#endif
#ifdef __cplusplus
#ifdef __cplusplus
...
...
include/os/osMath.h
浏览文件 @
4cc94968
...
@@ -39,13 +39,13 @@ extern "C" {
...
@@ -39,13 +39,13 @@ extern "C" {
#ifdef WINDOWS
#ifdef WINDOWS
#define TMAX(a, b)
(((a) > (b)) ? (a) : (b))
#define TMAX(a, b)
(((a) > (b)) ? (a) : (b))
#define TMIN(a, b)
(((a) < (b)) ? (a) : (b))
#define TMIN(a, b)
(((a) < (b)) ? (a) : (b))
#define TRANGE(aa, bb, cc) ((aa) = TMAX((aa), (bb)),
(aa) = TMIN((aa), (cc)))
#define TRANGE(aa, bb, cc) ((aa) = TMAX((aa), (bb)),
(aa) = TMIN((aa), (cc)))
#else
#else
#define TMAX(a, b)
\
#define TMAX(a, b)
\
({ \
({ \
__typeof(a) __a = (a); \
__typeof(a) __a = (a); \
__typeof(b) __b = (b); \
__typeof(b) __b = (b); \
...
@@ -71,7 +71,7 @@ extern "C" {
...
@@ -71,7 +71,7 @@ extern "C" {
typedef
int32_t
(
*
__compar_fn_t
)(
const
void
*
,
const
void
*
);
typedef
int32_t
(
*
__compar_fn_t
)(
const
void
*
,
const
void
*
);
#endif
#endif
void
taosSort
(
void
*
arr
,
int64_t
sz
,
int64_t
width
,
__compar_fn_t
compar
);
void
taosSort
(
void
*
arr
,
int64_t
sz
,
int64_t
width
,
__compar_fn_t
compar
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
include/os/osMemory.h
浏览文件 @
4cc94968
...
@@ -23,10 +23,10 @@ extern "C" {
...
@@ -23,10 +23,10 @@ extern "C" {
// If the error is in a third-party library, place this header file under the third-party library header file.
// If the error is in a third-party library, place this header file under the third-party library header file.
// When you want to use this feature, you should find or add the same function in the following sectio
// When you want to use this feature, you should find or add the same function in the following sectio
#ifndef ALLOW_FORBID_FUNC
#ifndef ALLOW_FORBID_FUNC
#define malloc
MALLOC_FUNC_TAOS_FORBID
#define malloc
MALLOC_FUNC_TAOS_FORBID
#define calloc
CALLOC_FUNC_TAOS_FORBID
#define calloc
CALLOC_FUNC_TAOS_FORBID
#define realloc REALLOC_FUNC_TAOS_FORBID
#define realloc REALLOC_FUNC_TAOS_FORBID
#define free
FREE_FUNC_TAOS_FORBID
#define free
FREE_FUNC_TAOS_FORBID
#endif
#endif
void
*
taosMemoryMalloc
(
int32_t
size
);
void
*
taosMemoryMalloc
(
int32_t
size
);
...
...
include/os/osRand.h
浏览文件 @
4cc94968
...
@@ -23,14 +23,14 @@ extern "C" {
...
@@ -23,14 +23,14 @@ extern "C" {
// If the error is in a third-party library, place this header file under the third-party library header file.
// If the error is in a third-party library, place this header file under the third-party library header file.
// When you want to use this feature, you should find or add the same function in the following section.
// When you want to use this feature, you should find or add the same function in the following section.
#ifndef ALLOW_FORBID_FUNC
#ifndef ALLOW_FORBID_FUNC
#define rand
RAND_FUNC_TAOS_FORBID
#define rand
RAND_FUNC_TAOS_FORBID
#define srand
SRAND_FUNC_TAOS_FORBID
#define srand
SRAND_FUNC_TAOS_FORBID
#define rand_r RANDR_FUNC_TAOS_FORBID
#define rand_r RANDR_FUNC_TAOS_FORBID
#endif
#endif
void
taosSeedRand
(
uint32_t
seed
);
void
taosSeedRand
(
uint32_t
seed
);
uint32_t
taosRand
(
void
);
uint32_t
taosRand
(
void
);
uint32_t
taosRandR
(
uint32_t
*
pSeed
);
uint32_t
taosRandR
(
uint32_t
*
pSeed
);
void
taosRandStr
(
char
*
str
,
int32_t
size
);
void
taosRandStr
(
char
*
str
,
int32_t
size
);
uint32_t
taosSafeRand
(
void
);
uint32_t
taosSafeRand
(
void
);
...
...
include/os/osShm.h
浏览文件 @
4cc94968
...
@@ -23,10 +23,10 @@ extern "C" {
...
@@ -23,10 +23,10 @@ extern "C" {
typedef
struct
{
typedef
struct
{
int32_t
id
;
int32_t
id
;
int32_t
size
;
int32_t
size
;
void
*
ptr
;
void
*
ptr
;
}
SShm
;
}
SShm
;
int32_t
taosCreateShm
(
SShm
*
pShm
,
int32_t
key
,
int32_t
shmsize
)
;
int32_t
taosCreateShm
(
SShm
*
pShm
,
int32_t
key
,
int32_t
shmsize
);
void
taosDropShm
(
SShm
*
pShm
);
void
taosDropShm
(
SShm
*
pShm
);
int32_t
taosAttachShm
(
SShm
*
pShm
);
int32_t
taosAttachShm
(
SShm
*
pShm
);
...
...
include/os/osSignal.h
浏览文件 @
4cc94968
...
@@ -21,27 +21,27 @@ extern "C" {
...
@@ -21,27 +21,27 @@ extern "C" {
#endif
#endif
#ifndef SIGALRM
#ifndef SIGALRM
#define SIGALRM 1234
#define SIGALRM 1234
#endif
#endif
#ifndef SIGHUP
#ifndef SIGHUP
#define SIGHUP 1230
#define SIGHUP 1230
#endif
#endif
#ifndef SIGCHLD
#ifndef SIGCHLD
#define SIGCHLD 1234
#define SIGCHLD 1234
#endif
#endif
#ifndef SIGUSR1
#ifndef SIGUSR1
#define SIGUSR1 1234
#define SIGUSR1 1234
#endif
#endif
#ifndef SIGUSR2
#ifndef SIGUSR2
#define SIGUSR2 1234
#define SIGUSR2 1234
#endif
#endif
#ifndef SIGBREAK
#ifndef SIGBREAK
#define SIGBREAK 1234
#define SIGBREAK 1234
#endif
#endif
#ifdef WINDOWS
#ifdef WINDOWS
...
...
include/os/osSleep.h
浏览文件 @
4cc94968
...
@@ -23,10 +23,10 @@ extern "C" {
...
@@ -23,10 +23,10 @@ extern "C" {
// If the error is in a third-party library, place this header file under the third-party library header file.
// If the error is in a third-party library, place this header file under the third-party library header file.
// When you want to use this feature, you should find or add the same function in the following section.
// When you want to use this feature, you should find or add the same function in the following section.
#ifndef ALLOW_FORBID_FUNC
#ifndef ALLOW_FORBID_FUNC
#define Sleep
SLEEP_FUNC_TAOS_FORBID
#define Sleep
SLEEP_FUNC_TAOS_FORBID
#define sleep
SLEEP_FUNC_TAOS_FORBID
#define sleep
SLEEP_FUNC_TAOS_FORBID
#define usleep
USLEEP_FUNC_TAOS_FORBID
#define usleep
USLEEP_FUNC_TAOS_FORBID
#define nanosleep NANOSLEEP_FUNC_TAOS_FORBID
#define nanosleep NANOSLEEP_FUNC_TAOS_FORBID
#endif
#endif
void
taosSsleep
(
int32_t
s
);
void
taosSsleep
(
int32_t
s
);
...
...
include/os/osSocket.h
浏览文件 @
4cc94968
...
@@ -119,8 +119,8 @@ typedef int32_t SocketFd;
...
@@ -119,8 +119,8 @@ typedef int32_t SocketFd;
typedef
SocketFd
EpollFd
;
typedef
SocketFd
EpollFd
;
typedef
struct
TdSocketServer
*
TdSocketServerPtr
;
typedef
struct
TdSocketServer
*
TdSocketServerPtr
;
typedef
struct
TdSocket
*
TdSocketPtr
;
typedef
struct
TdSocket
*
TdSocketPtr
;
typedef
struct
TdEpoll
*
TdEpollPtr
;
typedef
struct
TdEpoll
*
TdEpollPtr
;
int32_t
taosSendto
(
TdSocketPtr
pSocket
,
void
*
msg
,
int
len
,
unsigned
int
flags
,
const
struct
sockaddr
*
to
,
int
tolen
);
int32_t
taosSendto
(
TdSocketPtr
pSocket
,
void
*
msg
,
int
len
,
unsigned
int
flags
,
const
struct
sockaddr
*
to
,
int
tolen
);
int32_t
taosWriteSocket
(
TdSocketPtr
pSocket
,
void
*
msg
,
int
len
);
int32_t
taosWriteSocket
(
TdSocketPtr
pSocket
,
void
*
msg
,
int
len
);
...
...
include/os/osString.h
浏览文件 @
4cc94968
...
@@ -26,31 +26,31 @@ typedef int32_t TdUcs4;
...
@@ -26,31 +26,31 @@ typedef int32_t TdUcs4;
// If the error is in a third-party library, place this header file under the third-party library header file.
// If the error is in a third-party library, place this header file under the third-party library header file.
// When you want to use this feature, you should find or add the same function in the following section.
// When you want to use this feature, you should find or add the same function in the following section.
#ifndef ALLOW_FORBID_FUNC
#ifndef ALLOW_FORBID_FUNC
#define iconv_open
ICONV_OPEN_FUNC_TAOS_FORBID
#define iconv_open
ICONV_OPEN_FUNC_TAOS_FORBID
#define iconv_close ICONV_CLOSE_FUNC_TAOS_FORBID
#define iconv_close ICONV_CLOSE_FUNC_TAOS_FORBID
#define iconv
ICONV_FUNC_TAOS_FORBID
#define iconv
ICONV_FUNC_TAOS_FORBID
#define wcwidth
WCWIDTH_FUNC_TAOS_FORBID
#define wcwidth
WCWIDTH_FUNC_TAOS_FORBID
#define wcswidth
WCSWIDTH_FUNC_TAOS_FORBID
#define wcswidth
WCSWIDTH_FUNC_TAOS_FORBID
#define mbtowc
MBTOWC_FUNC_TAOS_FORBID
#define mbtowc
MBTOWC_FUNC_TAOS_FORBID
#define mbstowcs
MBSTOWCS_FUNC_TAOS_FORBID
#define mbstowcs
MBSTOWCS_FUNC_TAOS_FORBID
#define wctomb
WCTOMB_FUNC_TAOS_FORBID
#define wctomb
WCTOMB_FUNC_TAOS_FORBID
#define wcstombs
WCSTOMBS_FUNC_TAOS_FORBID
#define wcstombs
WCSTOMBS_FUNC_TAOS_FORBID
#define wcsncpy
WCSNCPY_FUNC_TAOS_FORBID
#define wcsncpy
WCSNCPY_FUNC_TAOS_FORBID
#define wchar_t
WCHAR_T_TYPE_TAOS_FORBID
#define wchar_t
WCHAR_T_TYPE_TAOS_FORBID
#define strcasestr
STR_CASE_STR_FORBID
#define strcasestr
STR_CASE_STR_FORBID
#define strtoll
STR_TO_LL_FUNC_TAOS_FORBID
#define strtoll
STR_TO_LL_FUNC_TAOS_FORBID
#define strtoull
STR_TO_ULL_FUNC_TAOS_FORBID
#define strtoull
STR_TO_ULL_FUNC_TAOS_FORBID
#define strtol
STR_TO_L_FUNC_TAOS_FORBID
#define strtol
STR_TO_L_FUNC_TAOS_FORBID
#define strtoul
STR_TO_UL_FUNC_TAOS_FORBID
#define strtoul
STR_TO_UL_FUNC_TAOS_FORBID
#define strtod
STR_TO_LD_FUNC_TAOS_FORBID
#define strtod
STR_TO_LD_FUNC_TAOS_FORBID
#define strtold
STR_TO_D_FUNC_TAOS_FORBID
#define strtold
STR_TO_D_FUNC_TAOS_FORBID
#define strtof
STR_TO_F_FUNC_TAOS_FORBID
#define strtof
STR_TO_F_FUNC_TAOS_FORBID
#endif
#endif
#ifdef WINDOWS
#ifdef WINDOWS
#define tstrdup(str) _strdup(str)
#define tstrdup(str) _strdup(str)
#else
#else
#define tstrdup(str) strdup(str)
#define tstrdup(str) strdup(str)
#endif
#endif
#define tstrncpy(dst, src, size) \
#define tstrncpy(dst, src, size) \
...
@@ -67,7 +67,7 @@ void taosConvDestroy();
...
@@ -67,7 +67,7 @@ void taosConvDestroy();
int32_t
taosUcs4ToMbs
(
TdUcs4
*
ucs4
,
int32_t
ucs4_max_len
,
char
*
mbs
);
int32_t
taosUcs4ToMbs
(
TdUcs4
*
ucs4
,
int32_t
ucs4_max_len
,
char
*
mbs
);
bool
taosMbsToUcs4
(
const
char
*
mbs
,
size_t
mbs_len
,
TdUcs4
*
ucs4
,
int32_t
ucs4_max_len
,
int32_t
*
len
);
bool
taosMbsToUcs4
(
const
char
*
mbs
,
size_t
mbs_len
,
TdUcs4
*
ucs4
,
int32_t
ucs4_max_len
,
int32_t
*
len
);
int32_t
tasoUcs4Compare
(
TdUcs4
*
f1_ucs4
,
TdUcs4
*
f2_ucs4
,
int32_t
bytes
);
int32_t
tasoUcs4Compare
(
TdUcs4
*
f1_ucs4
,
TdUcs4
*
f2_ucs4
,
int32_t
bytes
);
TdUcs4
*
tasoUcs4Copy
(
TdUcs4
*
target_ucs4
,
TdUcs4
*
source_ucs4
,
int32_t
len_ucs4
);
TdUcs4
*
tasoUcs4Copy
(
TdUcs4
*
target_ucs4
,
TdUcs4
*
source_ucs4
,
int32_t
len_ucs4
);
bool
taosValidateEncodec
(
const
char
*
encodec
);
bool
taosValidateEncodec
(
const
char
*
encodec
);
int32_t
taosHexEncode
(
const
unsigned
char
*
src
,
char
*
dst
,
int32_t
len
);
int32_t
taosHexEncode
(
const
unsigned
char
*
src
,
char
*
dst
,
int32_t
len
);
int32_t
taosHexDecode
(
const
char
*
src
,
char
*
dst
,
int32_t
len
);
int32_t
taosHexDecode
(
const
char
*
src
,
char
*
dst
,
int32_t
len
);
...
@@ -80,16 +80,16 @@ int32_t taosWcharToMb(char *pStr, TdWchar wchar);
...
@@ -80,16 +80,16 @@ int32_t taosWcharToMb(char *pStr, TdWchar wchar);
char
*
taosStrCaseStr
(
const
char
*
str
,
const
char
*
pattern
);
char
*
taosStrCaseStr
(
const
char
*
str
,
const
char
*
pattern
);
int64_t
taosStr2Int64
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
int64_t
taosStr2Int64
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
uint64_t
taosStr2UInt64
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
uint64_t
taosStr2UInt64
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
int32_t
taosStr2Int32
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
int32_t
taosStr2Int32
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
uint32_t
taosStr2UInt32
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
uint32_t
taosStr2UInt32
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
int16_t
taosStr2Int16
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
int16_t
taosStr2Int16
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
uint16_t
taosStr2UInt16
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
uint16_t
taosStr2UInt16
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
int8_t
taosStr2Int8
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
int8_t
taosStr2Int8
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
uint8_t
taosStr2UInt8
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
uint8_t
taosStr2UInt8
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
double
taosStr2Double
(
const
char
*
str
,
char
**
pEnd
);
double
taosStr2Double
(
const
char
*
str
,
char
**
pEnd
);
float
taosStr2Float
(
const
char
*
str
,
char
**
pEnd
);
float
taosStr2Float
(
const
char
*
str
,
char
**
pEnd
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
include/os/osSysinfo.h
浏览文件 @
4cc94968
include/os/osSystem.h
浏览文件 @
4cc94968
...
@@ -23,16 +23,16 @@ extern "C" {
...
@@ -23,16 +23,16 @@ extern "C" {
// If the error is in a third-party library, place this header file under the third-party library header file.
// If the error is in a third-party library, place this header file under the third-party library header file.
// When you want to use this feature, you should find or add the same function in the following section.
// When you want to use this feature, you should find or add the same function in the following section.
#ifndef ALLOW_FORBID_FUNC
#ifndef ALLOW_FORBID_FUNC
#define popen
POPEN_FUNC_TAOS_FORBID
#define popen
POPEN_FUNC_TAOS_FORBID
#define pclose
PCLOSE_FUNC_TAOS_FORBID
#define pclose
PCLOSE_FUNC_TAOS_FORBID
#define tcsetattr TCSETATTR_FUNC_TAOS_FORBID
#define tcsetattr TCSETATTR_FUNC_TAOS_FORBID
#define tcgetattr TCGETATTR_FUNC_TAOS_FORBID
#define tcgetattr TCGETATTR_FUNC_TAOS_FORBID
#endif
#endif
typedef
struct
TdCmd
*
TdCmdPtr
;
typedef
struct
TdCmd
*
TdCmdPtr
;
TdCmdPtr
taosOpenCmd
(
const
char
*
cmd
);
TdCmdPtr
taosOpenCmd
(
const
char
*
cmd
);
int64_t
taosGetsCmd
(
TdCmdPtr
pCmd
,
int32_t
maxSize
,
char
*
__restrict
buf
);
int64_t
taosGetsCmd
(
TdCmdPtr
pCmd
,
int32_t
maxSize
,
char
*
__restrict
buf
);
int64_t
taosGetLineCmd
(
TdCmdPtr
pCmd
,
char
**
__restrict
ptrBuf
);
int64_t
taosGetLineCmd
(
TdCmdPtr
pCmd
,
char
**
__restrict
ptrBuf
);
int32_t
taosEOFCmd
(
TdCmdPtr
pCmd
);
int32_t
taosEOFCmd
(
TdCmdPtr
pCmd
);
int64_t
taosCloseCmd
(
TdCmdPtr
*
ppCmd
);
int64_t
taosCloseCmd
(
TdCmdPtr
*
ppCmd
);
...
...
include/os/osThread.h
浏览文件 @
4cc94968
此差异已折叠。
点击以展开。
include/os/osTimer.h
浏览文件 @
4cc94968
...
@@ -23,11 +23,11 @@ extern "C" {
...
@@ -23,11 +23,11 @@ extern "C" {
// If the error is in a third-party library, place this header file under the third-party library header file.
// If the error is in a third-party library, place this header file under the third-party library header file.
// When you want to use this feature, you should find or add the same function in the following section.
// When you want to use this feature, you should find or add the same function in the following section.
#ifndef ALLOW_FORBID_FUNC
#ifndef ALLOW_FORBID_FUNC
#define timer_create
TIMER_CREATE_FUNC_TAOS_FORBID
#define timer_create
TIMER_CREATE_FUNC_TAOS_FORBID
#define timer_settime TIMER_SETTIME_FUNC_TAOS_FORBID
#define timer_settime TIMER_SETTIME_FUNC_TAOS_FORBID
#define timer_delete
TIMER_DELETE_FUNC_TAOS_FORBID
#define timer_delete
TIMER_DELETE_FUNC_TAOS_FORBID
#define timeSetEvent
TIMESETEVENT_SETTIME_FUNC_TAOS_FORBID
#define timeSetEvent
TIMESETEVENT_SETTIME_FUNC_TAOS_FORBID
#define timeKillEvent TIMEKILLEVENT_SETTIME_FUNC_TAOS_FORBID
#define timeKillEvent TIMEKILLEVENT_SETTIME_FUNC_TAOS_FORBID
#endif
#endif
#define MSECONDS_PER_TICK 5
#define MSECONDS_PER_TICK 5
...
...
include/os/osTimezone.h
浏览文件 @
4cc94968
...
@@ -23,12 +23,11 @@ extern "C" {
...
@@ -23,12 +23,11 @@ extern "C" {
// If the error is in a third-party library, place this header file under the third-party library header file.
// If the error is in a third-party library, place this header file under the third-party library header file.
// When you want to use this feature, you should find or add the same function in the following section.
// When you want to use this feature, you should find or add the same function in the following section.
#ifndef ALLOW_FORBID_FUNC
#ifndef ALLOW_FORBID_FUNC
#define tzset TZSET_FUNC_TAOS_FORBID
#define tzset TZSET_FUNC_TAOS_FORBID
#endif
#endif
enum
TdTimezone
enum
TdTimezone
{
{
TdWestZone12
=
-
12
,
TdWestZone12
=-
12
,
TdWestZone11
,
TdWestZone11
,
TdWestZone10
,
TdWestZone10
,
TdWestZone9
,
TdWestZone9
,
...
...
include/util/tbloomfilter.h
浏览文件 @
4cc94968
...
@@ -38,13 +38,12 @@ typedef struct SBloomFilter {
...
@@ -38,13 +38,12 @@ typedef struct SBloomFilter {
SBloomFilter
*
tBloomFilterInit
(
uint64_t
expectedEntries
,
double
errorRate
);
SBloomFilter
*
tBloomFilterInit
(
uint64_t
expectedEntries
,
double
errorRate
);
int32_t
tBloomFilterPut
(
SBloomFilter
*
pBF
,
const
void
*
keyBuf
,
uint32_t
len
);
int32_t
tBloomFilterPut
(
SBloomFilter
*
pBF
,
const
void
*
keyBuf
,
uint32_t
len
);
int32_t
tBloomFilterNoContain
(
const
SBloomFilter
*
pBF
,
const
void
*
keyBuf
,
int32_t
tBloomFilterNoContain
(
const
SBloomFilter
*
pBF
,
const
void
*
keyBuf
,
uint32_t
len
);
uint32_t
len
);
void
tBloomFilterDestroy
(
SBloomFilter
*
pBF
);
void
tBloomFilterDestroy
(
SBloomFilter
*
pBF
);
void
tBloomFilterDump
(
const
SBloomFilter
*
pBF
);
void
tBloomFilterDump
(
const
SBloomFilter
*
pBF
);
bool
tBloomFilterIsFull
(
const
SBloomFilter
*
pBF
);
bool
tBloomFilterIsFull
(
const
SBloomFilter
*
pBF
);
int32_t
tBloomFilterEncode
(
const
SBloomFilter
*
pBF
,
SEncoder
*
pEncoder
);
int32_t
tBloomFilterEncode
(
const
SBloomFilter
*
pBF
,
SEncoder
*
pEncoder
);
SBloomFilter
*
tBloomFilterDecode
(
SDecoder
*
pDecoder
);
SBloomFilter
*
tBloomFilterDecode
(
SDecoder
*
pDecoder
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
include/util/tconfig.h
浏览文件 @
4cc94968
...
@@ -105,11 +105,11 @@ int32_t cfgAddTimezone(SConfig *pCfg, const char *name, const char *defaultVal);
...
@@ -105,11 +105,11 @@ int32_t cfgAddTimezone(SConfig *pCfg, const char *name, const char *defaultVal);
const
char
*
cfgStypeStr
(
ECfgSrcType
type
);
const
char
*
cfgStypeStr
(
ECfgSrcType
type
);
const
char
*
cfgDtypeStr
(
ECfgDataType
type
);
const
char
*
cfgDtypeStr
(
ECfgDataType
type
);
void
cfgDumpItemValue
(
SConfigItem
*
pItem
,
char
*
buf
,
int32_t
bufSize
,
int32_t
*
pLen
);
void
cfgDumpItemValue
(
SConfigItem
*
pItem
,
char
*
buf
,
int32_t
bufSize
,
int32_t
*
pLen
);
void
cfgDumpCfg
(
SConfig
*
pCfg
,
bool
tsc
,
bool
dump
);
void
cfgDumpCfg
(
SConfig
*
pCfg
,
bool
tsc
,
bool
dump
);
int32_t
cfgGetApollUrl
(
const
char
**
envCmd
,
const
char
*
envFile
,
char
*
apolloUrl
);
int32_t
cfgGetApollUrl
(
const
char
**
envCmd
,
const
char
*
envFile
,
char
*
apolloUrl
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
include/util/tcrc32c.h
浏览文件 @
4cc94968
include/util/tdigest.h
浏览文件 @
4cc94968
...
@@ -32,17 +32,18 @@
...
@@ -32,17 +32,18 @@
#define COMPRESSION 300
#define COMPRESSION 300
#define GET_CENTROID(compression) (ceil(compression * M_PI / 2) + 1 + ADDITION_CENTROID_NUM)
#define GET_CENTROID(compression) (ceil(compression * M_PI / 2) + 1 + ADDITION_CENTROID_NUM)
#define GET_THRESHOLD(compression) (7.5 + 0.37 * compression - 2e-4 * pow(compression, 2))
#define GET_THRESHOLD(compression) (7.5 + 0.37 * compression - 2e-4 * pow(compression, 2))
#define TDIGEST_SIZE(compression) (sizeof(TDigest) + sizeof(SCentroid)*GET_CENTROID(compression) + sizeof(SPt)*GET_THRESHOLD(compression))
#define TDIGEST_SIZE(compression) \
(sizeof(TDigest) + sizeof(SCentroid) * GET_CENTROID(compression) + sizeof(SPt) * GET_THRESHOLD(compression))
typedef
struct
SCentroid
{
typedef
struct
SCentroid
{
double
mean
;
double
mean
;
int64_t
weight
;
int64_t
weight
;
}
SCentroid
;
}
SCentroid
;
typedef
struct
SPt
{
typedef
struct
SPt
{
double
value
;
double
value
;
int64_t
weight
;
int64_t
weight
;
}
SPt
;
}
SPt
;
typedef
struct
TDigest
{
typedef
struct
TDigest
{
double
compression
;
double
compression
;
...
@@ -58,14 +59,14 @@ typedef struct TDigest {
...
@@ -58,14 +59,14 @@ typedef struct TDigest {
int32_t
num_centroids
;
int32_t
num_centroids
;
SCentroid
*
centroids
;
SCentroid
*
centroids
;
}
TDigest
;
}
TDigest
;
TDigest
*
tdigestNewFrom
(
void
*
pBuf
,
int32_t
compression
);
TDigest
*
tdigestNewFrom
(
void
*
pBuf
,
int32_t
compression
);
void
tdigestAdd
(
TDigest
*
t
,
double
x
,
int64_t
w
);
void
tdigestAdd
(
TDigest
*
t
,
double
x
,
int64_t
w
);
void
tdigestMerge
(
TDigest
*
t1
,
TDigest
*
t2
);
void
tdigestMerge
(
TDigest
*
t1
,
TDigest
*
t2
);
double
tdigestQuantile
(
TDigest
*
t
,
double
q
);
double
tdigestQuantile
(
TDigest
*
t
,
double
q
);
void
tdigestCompress
(
TDigest
*
t
);
void
tdigestCompress
(
TDigest
*
t
);
void
tdigestFreeFrom
(
TDigest
*
t
);
void
tdigestFreeFrom
(
TDigest
*
t
);
void
tdigestAutoFill
(
TDigest
*
t
,
int32_t
compression
);
void
tdigestAutoFill
(
TDigest
*
t
,
int32_t
compression
);
#endif
/* TDIGEST_H */
#endif
/* TDIGEST_H */
include/util/thash.h
浏览文件 @
4cc94968
...
@@ -118,7 +118,7 @@ int32_t taosHashGetDup(SHashObj *pHashObj, const void *key, size_t keyLen, void
...
@@ -118,7 +118,7 @@ int32_t taosHashGetDup(SHashObj *pHashObj, const void *key, size_t keyLen, void
* @param size
* @param size
* @return
* @return
*/
*/
int32_t
taosHashGetDup_m
(
SHashObj
*
pHashObj
,
const
void
*
key
,
size_t
keyLen
,
void
**
destBuf
,
int32_t
*
size
);
int32_t
taosHashGetDup_m
(
SHashObj
*
pHashObj
,
const
void
*
key
,
size_t
keyLen
,
void
**
destBuf
,
int32_t
*
size
);
/**
/**
* remove item with the specified key
* remove item with the specified key
...
@@ -169,13 +169,13 @@ void *taosHashIterate(SHashObj *pHashObj, void *p);
...
@@ -169,13 +169,13 @@ void *taosHashIterate(SHashObj *pHashObj, void *p);
*/
*/
void
taosHashCancelIterate
(
SHashObj
*
pHashObj
,
void
*
p
);
void
taosHashCancelIterate
(
SHashObj
*
pHashObj
,
void
*
p
);
/**
/**
* Get the corresponding key information for a given data in hash table
* Get the corresponding key information for a given data in hash table
* @param data
* @param data
* @param keyLen
* @param keyLen
* @return
* @return
*/
*/
void
*
taosHashGetKey
(
void
*
data
,
size_t
*
keyLen
);
void
*
taosHashGetKey
(
void
*
data
,
size_t
*
keyLen
);
/**
/**
* return the payload data with the specified key(reference number added)
* return the payload data with the specified key(reference number added)
...
...
include/util/tidpool.h
浏览文件 @
4cc94968
include/util/tlrucache.h
浏览文件 @
4cc94968
...
@@ -28,10 +28,7 @@ typedef void (*_taos_lru_deleter_t)(const void *key, size_t keyLen, void *value)
...
@@ -28,10 +28,7 @@ typedef void (*_taos_lru_deleter_t)(const void *key, size_t keyLen, void *value)
typedef
struct
LRUHandle
LRUHandle
;
typedef
struct
LRUHandle
LRUHandle
;
typedef
enum
{
typedef
enum
{
TAOS_LRU_PRIORITY_HIGH
,
TAOS_LRU_PRIORITY_LOW
}
LRUPriority
;
TAOS_LRU_PRIORITY_HIGH
,
TAOS_LRU_PRIORITY_LOW
}
LRUPriority
;
typedef
enum
{
typedef
enum
{
TAOS_LRU_STATUS_OK
,
TAOS_LRU_STATUS_OK
,
...
@@ -45,15 +42,15 @@ void taosLRUCacheCleanup(SLRUCache *cache);
...
@@ -45,15 +42,15 @@ void taosLRUCacheCleanup(SLRUCache *cache);
LRUStatus
taosLRUCacheInsert
(
SLRUCache
*
cache
,
const
void
*
key
,
size_t
keyLen
,
void
*
value
,
size_t
charge
,
LRUStatus
taosLRUCacheInsert
(
SLRUCache
*
cache
,
const
void
*
key
,
size_t
keyLen
,
void
*
value
,
size_t
charge
,
_taos_lru_deleter_t
deleter
,
LRUHandle
**
handle
,
LRUPriority
priority
);
_taos_lru_deleter_t
deleter
,
LRUHandle
**
handle
,
LRUPriority
priority
);
LRUHandle
*
taosLRUCacheLookup
(
SLRUCache
*
cache
,
const
void
*
key
,
size_t
keyLen
);
LRUHandle
*
taosLRUCacheLookup
(
SLRUCache
*
cache
,
const
void
*
key
,
size_t
keyLen
);
void
taosLRUCacheErase
(
SLRUCache
*
cache
,
const
void
*
key
,
size_t
keyLen
);
void
taosLRUCacheErase
(
SLRUCache
*
cache
,
const
void
*
key
,
size_t
keyLen
);
void
taosLRUCacheEraseUnrefEntries
(
SLRUCache
*
cache
);
void
taosLRUCacheEraseUnrefEntries
(
SLRUCache
*
cache
);
bool
taosLRUCacheRef
(
SLRUCache
*
cache
,
LRUHandle
*
handle
);
bool
taosLRUCacheRef
(
SLRUCache
*
cache
,
LRUHandle
*
handle
);
bool
taosLRUCacheRelease
(
SLRUCache
*
cache
,
LRUHandle
*
handle
,
bool
eraseIfLastRef
);
bool
taosLRUCacheRelease
(
SLRUCache
*
cache
,
LRUHandle
*
handle
,
bool
eraseIfLastRef
);
void
*
taosLRUCacheValue
(
SLRUCache
*
cache
,
LRUHandle
*
handle
);
void
*
taosLRUCacheValue
(
SLRUCache
*
cache
,
LRUHandle
*
handle
);
size_t
taosLRUCacheGetUsage
(
SLRUCache
*
cache
);
size_t
taosLRUCacheGetUsage
(
SLRUCache
*
cache
);
size_t
taosLRUCacheGetPinnedUsage
(
SLRUCache
*
cache
);
size_t
taosLRUCacheGetPinnedUsage
(
SLRUCache
*
cache
);
...
...
include/util/tpagedbuf.h
浏览文件 @
4cc94968
...
@@ -53,7 +53,8 @@ typedef struct SDiskbasedBufStatis {
...
@@ -53,7 +53,8 @@ typedef struct SDiskbasedBufStatis {
* @param handle
* @param handle
* @return
* @return
*/
*/
int32_t
createDiskbasedBuf
(
SDiskbasedBuf
**
pBuf
,
int32_t
pagesize
,
int32_t
inMemBufSize
,
const
char
*
id
,
const
char
*
dir
);
int32_t
createDiskbasedBuf
(
SDiskbasedBuf
**
pBuf
,
int32_t
pagesize
,
int32_t
inMemBufSize
,
const
char
*
id
,
const
char
*
dir
);
/**
/**
*
*
...
@@ -158,7 +159,7 @@ void setBufPageCompressOnDisk(SDiskbasedBuf* pBuf, bool comp);
...
@@ -158,7 +159,7 @@ void setBufPageCompressOnDisk(SDiskbasedBuf* pBuf, bool comp);
* @param pBuf
* @param pBuf
* @param pageId
* @param pageId
*/
*/
void
dBufSetBufPageRecycled
(
SDiskbasedBuf
*
pBuf
,
void
*
pPage
);
void
dBufSetBufPageRecycled
(
SDiskbasedBuf
*
pBuf
,
void
*
pPage
);
/**
/**
* Print the statistics when closing this buffer
* Print the statistics when closing this buffer
...
...
include/util/tscalablebf.h
浏览文件 @
4cc94968
...
@@ -30,11 +30,10 @@ typedef struct SScalableBf {
...
@@ -30,11 +30,10 @@ typedef struct SScalableBf {
SScalableBf
*
tScalableBfInit
(
uint64_t
expectedEntries
,
double
errorRate
);
SScalableBf
*
tScalableBfInit
(
uint64_t
expectedEntries
,
double
errorRate
);
int32_t
tScalableBfPut
(
SScalableBf
*
pSBf
,
const
void
*
keyBuf
,
uint32_t
len
);
int32_t
tScalableBfPut
(
SScalableBf
*
pSBf
,
const
void
*
keyBuf
,
uint32_t
len
);
int32_t
tScalableBfNoContain
(
const
SScalableBf
*
pSBf
,
const
void
*
keyBuf
,
int32_t
tScalableBfNoContain
(
const
SScalableBf
*
pSBf
,
const
void
*
keyBuf
,
uint32_t
len
);
uint32_t
len
);
void
tScalableBfDestroy
(
SScalableBf
*
pSBf
);
void
tScalableBfDestroy
(
SScalableBf
*
pSBf
);
int32_t
tScalableBfEncode
(
const
SScalableBf
*
pSBf
,
SEncoder
*
pEncoder
);
int32_t
tScalableBfEncode
(
const
SScalableBf
*
pSBf
,
SEncoder
*
pEncoder
);
SScalableBf
*
tScalableBfDecode
(
SDecoder
*
pDecoder
);
SScalableBf
*
tScalableBfDecode
(
SDecoder
*
pDecoder
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
include/util/tthread.h
浏览文件 @
4cc94968
...
@@ -26,7 +26,7 @@ TdThread* taosCreateThread(void* (*__start_routine)(void*), void* param);
...
@@ -26,7 +26,7 @@ TdThread* taosCreateThread(void* (*__start_routine)(void*), void* param);
bool
taosDestroyThread
(
TdThread
*
pthread
);
bool
taosDestroyThread
(
TdThread
*
pthread
);
bool
taosThreadRunning
(
TdThread
*
pthread
);
bool
taosThreadRunning
(
TdThread
*
pthread
);
typedef
void
*
(
*
ThreadFp
)(
void
*
param
);
typedef
void
*
(
*
ThreadFp
)(
void
*
param
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
include/util/tutil.h
浏览文件 @
4cc94968
...
@@ -19,8 +19,8 @@
...
@@ -19,8 +19,8 @@
#include "os.h"
#include "os.h"
#include "tcrc32c.h"
#include "tcrc32c.h"
#include "tdef.h"
#include "tdef.h"
#include "tmd5.h"
#include "thash.h"
#include "thash.h"
#include "tmd5.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
...
...
tools/scripts/codeFormat.sh
0 → 100644
浏览文件 @
4cc94968
#!/bin/bash
PRJ_ROOT_DIR
=
$(
readlink
-f
--
"
$(
dirname
$0
)
/../.."
)
FORMAT_BIN
=
clang-format-14
ORIGIN_DIR
=
$(
pwd
)
cd
${
PRJ_ROOT_DIR
}
FORMAT_DIR_LIST
=(
"include"
# "source"
)
for
d
in
${
FORMAT_DIR_LIST
[@]
}
;
do
for
f
in
$(
find
${
PRJ_ROOT_DIR
}
/
$d
/
-regex
'.*\.\(cpp\|hpp\|c\|h\)'
)
;
do
${
FORMAT_BIN
}
-i
$f
done
done
cd
${
ORIGIN_DIR
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录