commit
bdd65f50bf
|
@ -42,6 +42,8 @@ execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
|
|||
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/deps/deps-download")
|
||||
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -gdwarf-2 -msse4.2 -mfma")
|
||||
|
||||
# deps
|
||||
add_subdirectory(deps)
|
||||
|
||||
|
|
|
@ -8,7 +8,13 @@ target_include_directories(
|
|||
# see https://stackoverflow.com/questions/25676277/cmake-target-include-directories-prints-an-error-when-i-try-to-add-the-source
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cJson>
|
||||
)
|
||||
|
||||
add_subdirectory(lz4/build/cmake)
|
||||
target_include_directories(
|
||||
lz4_static
|
||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/lz4/lib
|
||||
)
|
||||
|
||||
add_subdirectory(zlib)
|
||||
target_include_directories(
|
||||
zlib
|
||||
|
|
|
@ -31,21 +31,23 @@ typedef void TAOS_SUB;
|
|||
typedef void **TAOS_ROW;
|
||||
|
||||
// Data type definition
|
||||
#define TSDB_DATA_TYPE_NULL 0 // 1 bytes
|
||||
#define TSDB_DATA_TYPE_BOOL 1 // 1 bytes
|
||||
#define TSDB_DATA_TYPE_TINYINT 2 // 1 byte
|
||||
#define TSDB_DATA_TYPE_SMALLINT 3 // 2 bytes
|
||||
#define TSDB_DATA_TYPE_INT 4 // 4 bytes
|
||||
#define TSDB_DATA_TYPE_BIGINT 5 // 8 bytes
|
||||
#define TSDB_DATA_TYPE_FLOAT 6 // 4 bytes
|
||||
#define TSDB_DATA_TYPE_DOUBLE 7 // 8 bytes
|
||||
#define TSDB_DATA_TYPE_BINARY 8 // string
|
||||
#define TSDB_DATA_TYPE_TIMESTAMP 9 // 8 bytes
|
||||
#define TSDB_DATA_TYPE_NCHAR 10 // unicode string
|
||||
#define TSDB_DATA_TYPE_UTINYINT 11 // 1 byte
|
||||
#define TSDB_DATA_TYPE_USMALLINT 12 // 2 bytes
|
||||
#define TSDB_DATA_TYPE_UINT 13 // 4 bytes
|
||||
#define TSDB_DATA_TYPE_UBIGINT 14 // 8 bytes
|
||||
#ifndef TSDB_DATA_TYPE_NULL
|
||||
#define TSDB_DATA_TYPE_NULL 0 // 1 bytes
|
||||
#define TSDB_DATA_TYPE_BOOL 1 // 1 bytes
|
||||
#define TSDB_DATA_TYPE_TINYINT 2 // 1 byte
|
||||
#define TSDB_DATA_TYPE_SMALLINT 3 // 2 bytes
|
||||
#define TSDB_DATA_TYPE_INT 4 // 4 bytes
|
||||
#define TSDB_DATA_TYPE_BIGINT 5 // 8 bytes
|
||||
#define TSDB_DATA_TYPE_FLOAT 6 // 4 bytes
|
||||
#define TSDB_DATA_TYPE_DOUBLE 7 // 8 bytes
|
||||
#define TSDB_DATA_TYPE_BINARY 8 // string
|
||||
#define TSDB_DATA_TYPE_TIMESTAMP 9 // 8 bytes
|
||||
#define TSDB_DATA_TYPE_NCHAR 10 // unicode string
|
||||
#define TSDB_DATA_TYPE_UTINYINT 11 // 1 byte
|
||||
#define TSDB_DATA_TYPE_USMALLINT 12 // 2 bytes
|
||||
#define TSDB_DATA_TYPE_UINT 13 // 4 bytes
|
||||
#define TSDB_DATA_TYPE_UBIGINT 14 // 8 bytes
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
TSDB_OPTION_LOCALE,
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _TD_SCHEMA_H_
|
||||
#define _TD_SCHEMA_H_
|
||||
#ifndef _TD_COMMON_SCHEMA_H_
|
||||
#define _TD_COMMON_SCHEMA_H_
|
||||
|
||||
#include "os.h"
|
||||
|
||||
|
@ -100,4 +100,4 @@ STSchema *tdGetSchemaFromBuilder(STSchemaBuilder *pBuilder);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /*_TD_SCHEMA_H_*/
|
||||
#endif /*_TD_COMMON_SCHEMA_H_*/
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* 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_COMMON_TAOS_DEF_H_
|
||||
#define _TD_COMMON_TAOS_DEF_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "tdef.h"
|
||||
#include "taos.h"
|
||||
|
||||
#define TSWINDOW_INITIALIZER ((STimeWindow) {INT64_MIN, INT64_MAX})
|
||||
#define TSWINDOW_DESC_INITIALIZER ((STimeWindow) {INT64_MAX, INT64_MIN})
|
||||
#define IS_TSWINDOW_SPECIFIED(win) (((win).skey != INT64_MIN) || ((win).ekey != INT64_MAX))
|
||||
|
||||
typedef enum {
|
||||
TAOS_QTYPE_RPC = 0,
|
||||
TAOS_QTYPE_FWD = 1,
|
||||
TAOS_QTYPE_WAL = 2,
|
||||
TAOS_QTYPE_CQ = 3,
|
||||
TAOS_QTYPE_QUERY = 4
|
||||
} EQType;
|
||||
|
||||
typedef enum {
|
||||
TSDB_SUPER_TABLE = 0, // super table
|
||||
TSDB_CHILD_TABLE = 1, // table created from super table
|
||||
TSDB_NORMAL_TABLE = 2, // ordinary table
|
||||
TSDB_STREAM_TABLE = 3, // table created from stream computing
|
||||
TSDB_TEMP_TABLE = 4, // temp table created by nest query
|
||||
TSDB_TABLE_MAX = 5
|
||||
} ETableType;
|
||||
|
||||
typedef enum {
|
||||
TSDB_MOD_MNODE = 0,
|
||||
TSDB_MOD_HTTP = 1,
|
||||
TSDB_MOD_MONITOR = 2,
|
||||
TSDB_MOD_MQTT = 3,
|
||||
TSDB_MOD_MAX = 4
|
||||
} EModuleType;
|
||||
|
||||
typedef enum {
|
||||
TSDB_CHECK_ITEM_NETWORK,
|
||||
TSDB_CHECK_ITEM_MEM,
|
||||
TSDB_CHECK_ITEM_CPU,
|
||||
TSDB_CHECK_ITEM_DISK,
|
||||
TSDB_CHECK_ITEM_OS,
|
||||
TSDB_CHECK_ITEM_ACCESS,
|
||||
TSDB_CHECK_ITEM_VERSION,
|
||||
TSDB_CHECK_ITEM_DATAFILE,
|
||||
TSDB_CHECK_ITEM_MAX
|
||||
} ECheckItemType;
|
||||
|
||||
typedef enum {
|
||||
TD_ROW_DISCARD_UPDATE = 0,
|
||||
TD_ROW_OVERWRITE_UPDATE = 1,
|
||||
TD_ROW_PARTIAL_UPDATE = 2
|
||||
} TDUpdateConfig;
|
||||
|
||||
extern char *qtypeStr[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_TD_COMMON_TAOS_DEF_H_*/
|
|
@ -13,16 +13,13 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TAOSERROR_H
|
||||
#define TDENGINE_TAOSERROR_H
|
||||
#ifndef _TD_COMMON_TAOS_ERROR_H_
|
||||
#define _TD_COMMON_TAOS_ERROR_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define TAOS_DEF_ERROR_CODE(mod, code) ((int32_t)((0x80000000 | ((mod)<<16) | (code))))
|
||||
|
||||
#define TAOS_SYSTEM_ERROR(code) (0x80ff0000 | (code))
|
||||
|
@ -463,4 +460,4 @@ int32_t* taosGetErrno();
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif //TDENGINE_TAOSERROR_H
|
||||
#endif /*_TD_COMMON_TAOS_ERROR_H_*/
|
|
@ -13,19 +13,15 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TAOSMSG_H
|
||||
#define TDENGINE_TAOSMSG_H
|
||||
#ifndef _TD_COMMON_TAOS_MSG_H_
|
||||
#define _TD_COMMON_TAOS_MSG_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "taosdef.h"
|
||||
#include "taoserror.h"
|
||||
#include "trpc.h"
|
||||
#include "tdataformat.h"
|
||||
|
||||
// message type
|
||||
|
@ -339,6 +335,13 @@ typedef struct {
|
|||
int32_t pid;
|
||||
} SConnectMsg;
|
||||
|
||||
typedef struct SEpSet {
|
||||
int8_t inUse;
|
||||
int8_t numOfEps;
|
||||
uint16_t port[TSDB_MAX_REPLICA];
|
||||
char fqdn[TSDB_MAX_REPLICA][TSDB_FQDN_LEN];
|
||||
} SEpSet;
|
||||
|
||||
typedef struct {
|
||||
char acctId[TSDB_ACCT_ID_LEN];
|
||||
char serverVersion[TSDB_VERSION_LEN];
|
||||
|
@ -348,7 +351,7 @@ typedef struct {
|
|||
int8_t reserved1;
|
||||
int8_t reserved2;
|
||||
int32_t connId;
|
||||
SRpcEpSet epSet;
|
||||
SEpSet epSet;
|
||||
} SConnectRsp;
|
||||
|
||||
typedef struct {
|
||||
|
@ -465,6 +468,21 @@ typedef struct {
|
|||
int32_t tsOrder; // ts comp block order
|
||||
} STsBufInfo;
|
||||
|
||||
typedef struct SInterval {
|
||||
int32_t tz; // query client timezone
|
||||
char intervalUnit;
|
||||
char slidingUnit;
|
||||
char offsetUnit;
|
||||
int64_t interval;
|
||||
int64_t sliding;
|
||||
int64_t offset;
|
||||
} SInterval;
|
||||
|
||||
typedef struct SSessionWindow {
|
||||
int64_t gap; // gap between two session window(in microseconds)
|
||||
int32_t primaryColId; // primary timestamp column
|
||||
} SSessionWindow;
|
||||
|
||||
typedef struct {
|
||||
SMsgHead head;
|
||||
char version[TSDB_VERSION_LEN];
|
||||
|
@ -492,7 +510,6 @@ typedef struct {
|
|||
SSessionWindow sw; // session window
|
||||
uint16_t tagCondLen; // tag length in current query
|
||||
uint16_t colCondLen; // column length in current query
|
||||
uint32_t tbnameCondLen; // table name filter condition string length
|
||||
int16_t numOfGroupCols; // num of group by columns
|
||||
int16_t orderByIdx;
|
||||
int16_t orderType; // used in group by xx order by xxx
|
||||
|
@ -502,7 +519,6 @@ typedef struct {
|
|||
int64_t offset;
|
||||
uint32_t queryType; // denote another query process
|
||||
int16_t numOfOutput; // final output columns numbers
|
||||
int16_t tagNameRelType; // relation of tag criteria and tbname criteria
|
||||
int16_t fillType; // interpolate type
|
||||
uint64_t fillVal; // default value array list
|
||||
int32_t secondStageOutput;
|
||||
|
@ -631,7 +647,7 @@ typedef struct {
|
|||
char reserved[64];
|
||||
} SVnodeStatisticInfo;
|
||||
|
||||
typedef struct {
|
||||
typedef struct SVgroupAccess {
|
||||
int32_t vgId;
|
||||
int8_t accessState;
|
||||
} SVgroupAccess;
|
||||
|
@ -660,7 +676,7 @@ typedef struct {
|
|||
char mnodeEp[TSDB_EP_LEN];
|
||||
} SMInfo;
|
||||
|
||||
typedef struct {
|
||||
typedef struct SMInfos {
|
||||
int8_t inUse;
|
||||
int8_t mnodeNum;
|
||||
SMInfo mnodeInfos[TSDB_MAX_REPLICA];
|
||||
|
@ -686,7 +702,7 @@ typedef struct {
|
|||
int8_t reserved[4];
|
||||
} SClusterCfg;
|
||||
|
||||
typedef struct {
|
||||
typedef struct SStatusMsg {
|
||||
uint32_t version;
|
||||
int32_t dnodeId;
|
||||
char dnodeEp[TSDB_EP_LEN];
|
||||
|
@ -904,7 +920,7 @@ typedef struct {
|
|||
uint32_t onlineDnodes;
|
||||
uint32_t connId;
|
||||
int8_t killConnection;
|
||||
SRpcEpSet epSet;
|
||||
SEpSet epSet;
|
||||
} SHeartBeatRsp;
|
||||
|
||||
typedef struct {
|
||||
|
@ -942,4 +958,4 @@ typedef struct {
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_COMMON_TAOS_MSG_H_*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_QARITHMETICOPERATOR_H
|
||||
#define TDENGINE_QARITHMETICOPERATOR_H
|
||||
#ifndef _TD_COMMON_QARITHMETICOPERATOR_H_
|
||||
#define _TD_COMMON_QARITHMETICOPERATOR_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -29,4 +29,4 @@ _arithmetic_operator_fn_t getArithmeticOperatorFn(int32_t arithmeticOptr);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TSYNTAXTREEFUNCTION_H
|
||||
#endif /*_TD_COMMON_QARITHMETICOPERATOR_H_*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TSQLMSGTYPE_H
|
||||
#define TDENGINE_TSQLMSGTYPE_H
|
||||
#ifndef _TD_COMMON_SQLMSGTYPE_H_
|
||||
#define _TD_COMMON_SQLMSGTYPE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -116,4 +116,4 @@ extern char *sqlCmd[];
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TSQLMSGTYPE_H
|
||||
#endif /*_TD_COMMON_SQLMSGTYPE_H_*/
|
|
@ -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/>.
|
||||
*/
|
||||
#ifndef _TD_DATA_FORMAT_H_
|
||||
#define _TD_DATA_FORMAT_H_
|
||||
#ifndef _TD_COMMON_DATA_FORMAT_H_
|
||||
#define _TD_COMMON_DATA_FORMAT_H_
|
||||
|
||||
#include "os.h"
|
||||
#include "talgo.h"
|
||||
|
@ -51,6 +51,78 @@ extern "C" {
|
|||
memcpy(varDataVal(x), (str), (_size)); \
|
||||
} while (0);
|
||||
|
||||
// ----------------- TSDB COLUMN DEFINITION
|
||||
typedef struct {
|
||||
int8_t type; // Column type
|
||||
int16_t colId; // column ID
|
||||
int16_t bytes; // column bytes (restore to int16_t in case of misuse)
|
||||
uint16_t offset; // point offset in SDataRow after the header part.
|
||||
} STColumn;
|
||||
|
||||
#define colType(col) ((col)->type)
|
||||
#define colColId(col) ((col)->colId)
|
||||
#define colBytes(col) ((col)->bytes)
|
||||
#define colOffset(col) ((col)->offset)
|
||||
|
||||
#define colSetType(col, t) (colType(col) = (t))
|
||||
#define colSetColId(col, id) (colColId(col) = (id))
|
||||
#define colSetBytes(col, b) (colBytes(col) = (b))
|
||||
#define colSetOffset(col, o) (colOffset(col) = (o))
|
||||
|
||||
// ----------------- TSDB SCHEMA DEFINITION
|
||||
typedef struct {
|
||||
int version; // version
|
||||
int numOfCols; // Number of columns appended
|
||||
int tlen; // maximum length of a SDataRow without the header part (sizeof(VarDataOffsetT) + sizeof(VarDataLenT) + (bytes))
|
||||
uint16_t flen; // First part length in a SDataRow after the header part
|
||||
uint16_t vlen; // pure value part length, excluded the overhead (bytes only)
|
||||
STColumn columns[];
|
||||
} STSchema;
|
||||
|
||||
#define schemaNCols(s) ((s)->numOfCols)
|
||||
#define schemaVersion(s) ((s)->version)
|
||||
#define schemaTLen(s) ((s)->tlen)
|
||||
#define schemaFLen(s) ((s)->flen)
|
||||
#define schemaVLen(s) ((s)->vlen)
|
||||
#define schemaColAt(s, i) ((s)->columns + i)
|
||||
#define tdFreeSchema(s) tfree((s))
|
||||
|
||||
STSchema *tdDupSchema(STSchema *pSchema);
|
||||
int tdEncodeSchema(void **buf, STSchema *pSchema);
|
||||
void * tdDecodeSchema(void *buf, STSchema **pRSchema);
|
||||
|
||||
static FORCE_INLINE int comparColId(const void *key1, const void *key2) {
|
||||
if (*(int16_t *)key1 > ((STColumn *)key2)->colId) {
|
||||
return 1;
|
||||
} else if (*(int16_t *)key1 < ((STColumn *)key2)->colId) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static FORCE_INLINE STColumn *tdGetColOfID(STSchema *pSchema, int16_t colId) {
|
||||
void *ptr = bsearch(&colId, (void *)pSchema->columns, schemaNCols(pSchema), sizeof(STColumn), comparColId);
|
||||
if (ptr == NULL) return NULL;
|
||||
return (STColumn *)ptr;
|
||||
}
|
||||
|
||||
// ----------------- SCHEMA BUILDER DEFINITION
|
||||
typedef struct {
|
||||
int tCols;
|
||||
int nCols;
|
||||
int tlen;
|
||||
uint16_t flen;
|
||||
uint16_t vlen;
|
||||
int version;
|
||||
STColumn *columns;
|
||||
} STSchemaBuilder;
|
||||
|
||||
int tdInitTSchemaBuilder(STSchemaBuilder *pBuilder, int32_t version);
|
||||
void tdDestroyTSchemaBuilder(STSchemaBuilder *pBuilder);
|
||||
void tdResetTSchemaBuilder(STSchemaBuilder *pBuilder, int32_t version);
|
||||
int tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int16_t colId, int16_t bytes);
|
||||
STSchema *tdGetSchemaFromBuilder(STSchemaBuilder *pBuilder);
|
||||
|
||||
// ----------------- Semantic timestamp key definition
|
||||
typedef uint64_t TKEY;
|
||||
|
@ -134,7 +206,7 @@ SDataRow tdDataRowDup(SDataRow row);
|
|||
// offset here not include dataRow header length
|
||||
static FORCE_INLINE int tdAppendDataColVal(SDataRow row, const void *value, bool isCopyVarData, int8_t type,
|
||||
int32_t offset) {
|
||||
ASSERT(value != NULL);
|
||||
assert(value != NULL);
|
||||
int32_t toffset = offset + TD_DATA_ROW_HEAD_SIZE;
|
||||
|
||||
if (IS_VAR_DATA_TYPE(type)) {
|
||||
|
@ -145,7 +217,7 @@ static FORCE_INLINE int tdAppendDataColVal(SDataRow row, const void *value, bool
|
|||
dataRowLen(row) += varDataTLen(value);
|
||||
} else {
|
||||
if (offset == 0) {
|
||||
ASSERT(type == TSDB_DATA_TYPE_TIMESTAMP);
|
||||
assert(type == TSDB_DATA_TYPE_TIMESTAMP);
|
||||
TKEY tvalue = tdGetTKEY(*(TSKEY *)value);
|
||||
memcpy(POINTER_SHIFT(row, toffset), (const void *)(&tvalue), TYPE_BYTES[type]);
|
||||
} else {
|
||||
|
@ -199,7 +271,7 @@ static FORCE_INLINE void tdSetColOfRowNullBySchema(SDataRow row, STSchema *pSche
|
|||
|
||||
static FORCE_INLINE void tdCopyColOfRowBySchema(SDataRow dst, STSchema *pDstSchema, int dstIdx, SDataRow src, STSchema *pSrcSchema, int srcIdx) {
|
||||
int8_t type = pDstSchema->columns[dstIdx].type;
|
||||
ASSERT(type == pSrcSchema->columns[srcIdx].type);
|
||||
assert(type == pSrcSchema->columns[srcIdx].type);
|
||||
void *pData = tdGetPtrToCol(dst, pDstSchema, dstIdx);
|
||||
void *value = tdGetPtrToCol(src, pSrcSchema, srcIdx);
|
||||
|
||||
|
@ -285,7 +357,7 @@ static FORCE_INLINE const void *tdGetColDataOfRow(SDataCol *pCol, int row) {
|
|||
}
|
||||
|
||||
static FORCE_INLINE int32_t dataColGetNEleLen(SDataCol *pDataCol, int rows) {
|
||||
ASSERT(rows > 0);
|
||||
assert(rows > 0);
|
||||
|
||||
if (IS_VAR_DATA_TYPE(pDataCol->type)) {
|
||||
return pDataCol->dataOff[rows - 1] + varDataTLen(tdGetColDataOfRow(pDataCol, rows - 1));
|
||||
|
@ -315,7 +387,7 @@ static FORCE_INLINE TKEY dataColsTKeyFirst(SDataCols *pCols) {
|
|||
}
|
||||
|
||||
static FORCE_INLINE TSKEY dataColsKeyAtRow(SDataCols *pCols, int row) {
|
||||
ASSERT(row < pCols->numOfRows);
|
||||
assert(row < pCols->numOfRows);
|
||||
return dataColsKeyAt(pCols, row);
|
||||
}
|
||||
|
||||
|
@ -413,7 +485,7 @@ static FORCE_INLINE void *tdGetKVRowIdxOfCol(SKVRow row, int16_t colId) {
|
|||
// offset here not include kvRow header length
|
||||
static FORCE_INLINE int tdAppendKvColVal(SKVRow row, const void *value, bool isCopyValData, int16_t colId, int8_t type,
|
||||
int32_t offset) {
|
||||
ASSERT(value != NULL);
|
||||
assert(value != NULL);
|
||||
int32_t toffset = offset + TD_KV_ROW_HEAD_SIZE;
|
||||
SColIdx *pColIdx = (SColIdx *)POINTER_SHIFT(row, toffset);
|
||||
char * ptr = (char *)POINTER_SHIFT(row, kvRowLen(row));
|
||||
|
@ -428,7 +500,7 @@ static FORCE_INLINE int tdAppendKvColVal(SKVRow row, const void *value, bool isC
|
|||
kvRowLen(row) += varDataTLen(value);
|
||||
} else {
|
||||
if (offset == 0) {
|
||||
ASSERT(type == TSDB_DATA_TYPE_TIMESTAMP);
|
||||
assert(type == TSDB_DATA_TYPE_TIMESTAMP);
|
||||
TKEY tvalue = tdGetTKEY(*(TSKEY *)value);
|
||||
memcpy(ptr, (void *)(&tvalue), TYPE_BYTES[type]);
|
||||
} else {
|
||||
|
@ -741,4 +813,4 @@ static FORCE_INLINE char *payloadNextCol(char *pCol) { return (char *)POINTER_SH
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // _TD_DATA_FORMAT_H_
|
||||
#endif /*_TD_COMMON_DATA_FORMAT_H_*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TEXPR_H
|
||||
#define TDENGINE_TEXPR_H
|
||||
#ifndef _TD_COMMON_EXPR_H_
|
||||
#define _TD_COMMON_EXPR_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -104,4 +104,4 @@ void buildFilterSetFromBinary(void **q, const char *buf, int32_t len);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TEXPR_H
|
||||
#endif /*_TD_COMMON_EXPR_H_*/
|
|
@ -13,15 +13,15 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_COMMON_GLOBAL_H
|
||||
#define TDENGINE_COMMON_GLOBAL_H
|
||||
|
||||
#include "taosdef.h"
|
||||
#ifndef _TD_COMMON_GLOBAL_H_
|
||||
#define _TD_COMMON_GLOBAL_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "tdef.h"
|
||||
|
||||
// cluster
|
||||
extern char tsFirst[];
|
||||
extern char tsSecond[];
|
||||
|
@ -36,12 +36,9 @@ extern int32_t tsStatusInterval;
|
|||
extern int32_t tsNumOfMnodes;
|
||||
extern int8_t tsEnableVnodeBak;
|
||||
extern int8_t tsEnableTelemetryReporting;
|
||||
extern char tsEmail[];
|
||||
extern char tsArbitrator[];
|
||||
extern int8_t tsArbOnline;
|
||||
extern int64_t tsArbOnlineTimestamp;
|
||||
extern int32_t tsDnodeId;
|
||||
extern int64_t tsDnodeStartTime;
|
||||
|
||||
// common
|
||||
extern int tsRpcTimer;
|
||||
|
@ -55,9 +52,6 @@ extern float tsNumOfThreadsPerCore;
|
|||
extern int32_t tsNumOfCommitThreads;
|
||||
extern float tsRatioOfQueryCores;
|
||||
extern int8_t tsDaylight;
|
||||
extern char tsTimezone[];
|
||||
extern char tsLocale[];
|
||||
extern char tsCharset[]; // default encode string
|
||||
extern int8_t tsEnableCoreFile;
|
||||
extern int32_t tsCompressMsgSize;
|
||||
extern int32_t tsCompressColData;
|
||||
|
@ -152,27 +146,16 @@ extern int32_t tsMonitorInterval;
|
|||
extern int8_t tsEnableStream;
|
||||
|
||||
// internal
|
||||
extern int8_t tsCompactMnodeWal;
|
||||
extern int8_t tsPrintAuth;
|
||||
extern int8_t tscEmbedded;
|
||||
extern char configDir[];
|
||||
extern char tsVnodeDir[];
|
||||
extern char tsDnodeDir[];
|
||||
extern char tsMnodeDir[];
|
||||
extern char tsMnodeBakDir[];
|
||||
extern char tsMnodeTmpDir[];
|
||||
extern char tsDataDir[];
|
||||
extern char tsLogDir[];
|
||||
extern char tsScriptDir[];
|
||||
extern int64_t tsTickPerDay[3];
|
||||
extern int32_t tsTopicBianryLen;
|
||||
|
||||
// system info
|
||||
extern char tsOsName[];
|
||||
extern int64_t tsPageSize;
|
||||
extern int64_t tsOpenMax;
|
||||
extern int64_t tsStreamMax;
|
||||
extern int32_t tsNumOfCores;
|
||||
extern float tsTotalLogDirGB;
|
||||
extern float tsTotalTmpDirGB;
|
||||
extern float tsTotalDataDirGB;
|
||||
|
@ -183,7 +166,6 @@ extern float tsUsedDataDirGB;
|
|||
extern float tsMinimalLogDirGB;
|
||||
extern float tsReservedTmpDirectorySpace;
|
||||
extern float tsMinimalDataDirGB;
|
||||
extern int32_t tsTotalMemoryMB;
|
||||
extern uint32_t tsVersion;
|
||||
|
||||
// build info
|
||||
|
@ -193,28 +175,6 @@ extern char gitinfo[];
|
|||
extern char gitinfoOfInternal[];
|
||||
extern char buildinfo[];
|
||||
|
||||
// log
|
||||
extern int8_t tsAsyncLog;
|
||||
extern int32_t tsNumOfLogLines;
|
||||
extern int32_t tsLogKeepDays;
|
||||
extern int32_t dDebugFlag;
|
||||
extern int32_t vDebugFlag;
|
||||
extern int32_t mDebugFlag;
|
||||
extern uint32_t cDebugFlag;
|
||||
extern int32_t jniDebugFlag;
|
||||
extern int32_t tmrDebugFlag;
|
||||
extern int32_t sdbDebugFlag;
|
||||
extern int32_t httpDebugFlag;
|
||||
extern int32_t mqttDebugFlag;
|
||||
extern int32_t monDebugFlag;
|
||||
extern int32_t uDebugFlag;
|
||||
extern int32_t rpcDebugFlag;
|
||||
extern int32_t odbcDebugFlag;
|
||||
extern uint32_t qDebugFlag;
|
||||
extern int32_t wDebugFlag;
|
||||
extern int32_t cqDebugFlag;
|
||||
extern int32_t debugFlag;
|
||||
|
||||
#ifdef TD_TSZ
|
||||
// lossy
|
||||
extern char lossyColumns[];
|
||||
|
@ -239,7 +199,6 @@ extern SDiskCfg tsDiskCfg[];
|
|||
|
||||
void taosInitGlobalCfg();
|
||||
int32_t taosCheckGlobalCfg();
|
||||
void taosSetAllDebugFlag();
|
||||
bool taosCfgDynamicOptions(char *msg);
|
||||
int taosGetFqdnPortFromEp(const char *ep, char *fqdn, uint16_t *port);
|
||||
bool taosCheckBalanceCfgOptions(const char *option, int32_t *vnodeId, int32_t *dnodeId);
|
||||
|
@ -251,4 +210,4 @@ void taosPrintDataDirCfg();
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_COMMON_GLOBAL_H_*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_COMMON_LOCALE_H
|
||||
#define TDENGINE_COMMON_LOCALE_H
|
||||
#ifndef _TD_COMMON_LOCALE_H_
|
||||
#define _TD_COMMON_LOCALE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -24,6 +24,6 @@ void tsSetLocale();
|
|||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /*_TD_COMMON_LOCALE_H_*/
|
||||
|
||||
#endif
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_NAME_H
|
||||
#define TDENGINE_NAME_H
|
||||
#ifndef _TD_COMMON_NAME_H_
|
||||
#define _TD_COMMON_NAME_H_
|
||||
|
||||
#include "os.h"
|
||||
#include "taosmsg.h"
|
||||
|
@ -136,4 +136,4 @@ int32_t tNameSetAcctId(SName* dst, const char* acct);
|
|||
|
||||
int32_t tNameSetDbName(SName* dst, const char* acct, SStrToken* dbToken);
|
||||
|
||||
#endif // TDENGINE_NAME_H
|
||||
#endif /*_TD_COMMON_NAME_H_*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _TD_TROW_H_
|
||||
#define _TD_TROW_H_
|
||||
#ifndef _TD_COMMON_ROW_H_
|
||||
#define _TD_COMMON_ROW_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -24,4 +24,4 @@ extern "C" {
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /*_TD_TROW_H_*/
|
||||
#endif /*_TD_COMMON_ROW_H_*/
|
|
@ -13,54 +13,15 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_OS_TIME_H
|
||||
#define TDENGINE_OS_TIME_H
|
||||
#ifndef _TD_COMMON_TIME_H_
|
||||
#define _TD_COMMON_TIME_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "os.h"
|
||||
#include "taosdef.h"
|
||||
|
||||
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
|
||||
#ifdef _TD_GO_DLL_
|
||||
#define MILLISECOND_PER_SECOND (1000LL)
|
||||
#else
|
||||
#define MILLISECOND_PER_SECOND (1000i64)
|
||||
#endif
|
||||
#else
|
||||
#define MILLISECOND_PER_SECOND ((int64_t)1000L)
|
||||
#endif
|
||||
|
||||
#define MILLISECOND_PER_MINUTE (MILLISECOND_PER_SECOND * 60)
|
||||
#define MILLISECOND_PER_HOUR (MILLISECOND_PER_MINUTE * 60)
|
||||
#define MILLISECOND_PER_DAY (MILLISECOND_PER_HOUR * 24)
|
||||
#define MILLISECOND_PER_WEEK (MILLISECOND_PER_DAY * 7)
|
||||
|
||||
//@return timestamp in second
|
||||
int32_t taosGetTimestampSec();
|
||||
|
||||
//@return timestamp in millisecond
|
||||
static FORCE_INLINE int64_t taosGetTimestampMs() {
|
||||
struct timeval systemTime;
|
||||
gettimeofday(&systemTime, NULL);
|
||||
return (int64_t)systemTime.tv_sec * 1000L + (int64_t)systemTime.tv_usec / 1000;
|
||||
}
|
||||
|
||||
//@return timestamp in microsecond
|
||||
static FORCE_INLINE int64_t taosGetTimestampUs() {
|
||||
struct timeval systemTime;
|
||||
gettimeofday(&systemTime, NULL);
|
||||
return (int64_t)systemTime.tv_sec * 1000000L + (int64_t)systemTime.tv_usec;
|
||||
}
|
||||
|
||||
//@return timestamp in nanosecond
|
||||
static FORCE_INLINE int64_t taosGetTimestampNs() {
|
||||
struct timespec systemTime = {0};
|
||||
clock_gettime(CLOCK_REALTIME, &systemTime);
|
||||
return (int64_t)systemTime.tv_sec * 1000000000L + (int64_t)systemTime.tv_nsec;
|
||||
}
|
||||
#include "taosmsg.h"
|
||||
|
||||
/*
|
||||
* @return timestamp decided by global conf variable, tsTimePrecision
|
||||
|
@ -77,22 +38,6 @@ static FORCE_INLINE int64_t taosGetTimestamp(int32_t precision) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
typedef struct SInterval {
|
||||
int32_t tz; // query client timezone
|
||||
char intervalUnit;
|
||||
char slidingUnit;
|
||||
char offsetUnit;
|
||||
int64_t interval;
|
||||
int64_t sliding;
|
||||
int64_t offset;
|
||||
} SInterval;
|
||||
|
||||
typedef struct SSessionWindow {
|
||||
int64_t gap; // gap between two session window(in microseconds)
|
||||
int32_t primaryColId; // primary timestamp column
|
||||
} SSessionWindow;
|
||||
|
||||
int64_t taosTimeAdd(int64_t t, int64_t duration, char unit, int32_t precision);
|
||||
int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precision);
|
||||
int32_t taosTimeCountInterval(int64_t skey, int64_t ekey, int64_t interval, char unit, int32_t precision);
|
||||
|
@ -104,8 +49,10 @@ int32_t taosParseTime(char* timestr, int64_t* time, int32_t len, int32_t timePre
|
|||
void deltaToUtcInitOnce();
|
||||
|
||||
int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrecision);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TTIME_H
|
||||
#endif /*_TD_COMMON_TIME_H_*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_COMMON_TIMEZONE_H
|
||||
#define TDENGINE_COMMON_TIMEZONE_H
|
||||
#ifndef _TD_COMMON_TIMEZONE_H_
|
||||
#define _TD_COMMON_TIMEZONE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -26,4 +26,4 @@ void tsSetTimeZone();
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_COMMON_TIMEZONE_H_*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TTOKEN_H
|
||||
#define TDENGINE_TTOKEN_H
|
||||
#ifndef _TD_COMMON_TOKEN_H_
|
||||
#define _TD_COMMON_TOKEN_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -189,4 +189,4 @@ SStrToken taosTokenDup(SStrToken* pToken, char* buf, int32_t len);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TTOKEN_H
|
||||
#endif /*_TD_COMMON_TOKEN_H_*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TTOKENDEF_H
|
||||
#define TDENGINE_TTOKENDEF_H
|
||||
#ifndef _TD_COMMON_TOKEN_DEF_H_
|
||||
#define _TD_COMMON_TOKEN_DEF_H_
|
||||
|
||||
#define TK_ID 1
|
||||
#define TK_BOOL 2
|
||||
|
@ -223,6 +223,6 @@
|
|||
#define TK_FILE 306
|
||||
#define TK_QUESTION 307 // denoting the placeholder of "?",when invoking statement bind query
|
||||
|
||||
#endif
|
||||
#endif /*_TD_COMMON_TOKEN_DEF_H_*/
|
||||
|
||||
|
|
@ -1,51 +1,12 @@
|
|||
#ifndef TDENGINE_TTYPE_H
|
||||
#define TDENGINE_TTYPE_H
|
||||
#ifndef _TD_COMMON_TYPE_H_
|
||||
#define _TD_COMMON_TYPE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "taosdef.h"
|
||||
|
||||
// ----------------- For variable data types such as TSDB_DATA_TYPE_BINARY and TSDB_DATA_TYPE_NCHAR
|
||||
typedef int32_t VarDataOffsetT;
|
||||
typedef int16_t VarDataLenT; // maxVarDataLen: 32767
|
||||
typedef uint16_t TDRowLenT; // not including overhead: 0 ~ 65535
|
||||
typedef uint32_t TDRowTLenT; // total length, including overhead
|
||||
|
||||
typedef struct tstr {
|
||||
VarDataLenT len;
|
||||
char data[];
|
||||
} tstr;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
typedef struct {
|
||||
VarDataLenT len;
|
||||
uint8_t data;
|
||||
} SBinaryNullT;
|
||||
|
||||
typedef struct {
|
||||
VarDataLenT len;
|
||||
uint32_t data;
|
||||
} SNCharNullT;
|
||||
#pragma pack(pop)
|
||||
|
||||
#define VARSTR_HEADER_SIZE sizeof(VarDataLenT)
|
||||
|
||||
#define varDataLen(v) ((VarDataLenT *)(v))[0]
|
||||
#define varDataTLen(v) (sizeof(VarDataLenT) + varDataLen(v))
|
||||
#define varDataVal(v) ((void *)((char *)v + VARSTR_HEADER_SIZE))
|
||||
#define varDataCopy(dst, v) memcpy((dst), (void*) (v), varDataTLen(v))
|
||||
#define varDataLenByData(v) (*(VarDataLenT *)(((char*)(v)) - VARSTR_HEADER_SIZE))
|
||||
#define varDataSetLen(v, _len) (((VarDataLenT *)(v))[0] = (VarDataLenT) (_len))
|
||||
#define IS_VAR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_BINARY) || ((t) == TSDB_DATA_TYPE_NCHAR))
|
||||
|
||||
#define varDataNetLen(v) (htons(((VarDataLenT *)(v))[0]))
|
||||
#define varDataNetTLen(v) (sizeof(VarDataLenT) + varDataNetLen(v))
|
||||
|
||||
|
||||
// this data type is internally used only in 'in' query to hold the values
|
||||
#define TSDB_DATA_TYPE_POINTER_ARRAY (1000)
|
||||
#define TSDB_DATA_TYPE_VALUE_ARRAY (1001)
|
||||
|
@ -215,4 +176,4 @@ int32_t tStrToInteger(const char* z, int16_t type, int32_t n, int64_t* value, bo
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TTYPE_H
|
||||
#endif /*_TD_COMMON_TYPE_H_*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TVARIANT_H
|
||||
#define TDENGINE_TVARIANT_H
|
||||
#ifndef _TD_COMMON_VARIANT_H_
|
||||
#define _TD_COMMON_VARIANT_H_
|
||||
|
||||
#include "tarray.h"
|
||||
#include "ttoken.h"
|
||||
|
@ -61,4 +61,4 @@ int32_t tVariantTypeSetType(tVariant *pVariant, char type);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TVARIANT_H
|
||||
#endif /*_TD_COMMON_VARIANT_H_*/
|
|
@ -21,17 +21,47 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <float.h>
|
||||
#include <inttypes.h>
|
||||
#include <locale.h>
|
||||
#include <math.h>
|
||||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sched.h>
|
||||
#include <time.h>
|
||||
#include <wctype.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include "osAtomic.h"
|
||||
#include "osDef.h"
|
||||
#include "osDir.h"
|
||||
#include "osEndian.h"
|
||||
#include "osEnv.h"
|
||||
#include "osFile.h"
|
||||
#include "osLz4.h"
|
||||
#include "osMath.h"
|
||||
#include "osMemory.h"
|
||||
#include "osRand.h"
|
||||
#include "osSemaphore.h"
|
||||
#include "osSignal.h"
|
||||
#include "osSleep.h"
|
||||
#include "osSocket.h"
|
||||
#include "osString.h"
|
||||
#include "osSysinfo.h"
|
||||
#include "osSystem.h"
|
||||
#include "osThread.h"
|
||||
#include "osTime.h"
|
||||
#include "osTimer.h"
|
||||
|
||||
void osInit();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_OS_ATOMIC_H
|
||||
#define TDENGINE_OS_ATOMIC_H
|
||||
#ifndef _TD_OS_ATOMIC_H_
|
||||
#define _TD_OS_ATOMIC_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -355,4 +355,4 @@ extern "C" {
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_OS_ATOMIC_H_*/
|
||||
|
|
|
@ -20,12 +20,164 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(_TD_DARWIN_64)
|
||||
// specific
|
||||
typedef int(*__compar_fn_t)(const void *, const void *);
|
||||
|
||||
// for send function in tsocket.c
|
||||
#if defined(MSG_NOSIGNAL)
|
||||
#undef MSG_NOSIGNAL
|
||||
#endif
|
||||
|
||||
#define MSG_NOSIGNAL 0
|
||||
|
||||
#define SO_NO_CHECK 0x1234
|
||||
#define SOL_TCP 0x1234
|
||||
#define TCP_KEEPIDLE 0x1234
|
||||
|
||||
#ifndef PTHREAD_MUTEX_RECURSIVE_NP
|
||||
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_ALPINE)
|
||||
typedef int(*__compar_fn_t)(const void *, const void *);
|
||||
void error (int, int, const char *);
|
||||
#ifndef PTHREAD_MUTEX_RECURSIVE_NP
|
||||
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
|
||||
char *stpcpy (char *dest, const char *src);
|
||||
char *stpncpy (char *dest, const char *src, size_t n);
|
||||
|
||||
// specific
|
||||
typedef int (*__compar_fn_t)(const void *, const void *);
|
||||
#define ssize_t int
|
||||
#define bzero(ptr, size) memset((ptr), 0, (size))
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#define wcsncasecmp _wcsnicmp
|
||||
#define strtok_r strtok_s
|
||||
#define snprintf _snprintf
|
||||
#define in_addr_t unsigned long
|
||||
#define socklen_t int
|
||||
|
||||
struct tm *localtime_r(const time_t *timep, struct tm *result);
|
||||
char * strptime(const char *buf, const char *fmt, struct tm *tm);
|
||||
char * strsep(char **stringp, const char *delim);
|
||||
char * getpass(const char *prefix);
|
||||
char * strndup(const char *s, size_t n);
|
||||
|
||||
#endif
|
||||
|
||||
#define POINTER_SHIFT(p, b) ((void *)((char *)(p) + (b)))
|
||||
#define POINTER_DISTANCE(p1, p2) ((char *)(p1) - (char *)(p2))
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define ASSERT(x) assert(x)
|
||||
#else
|
||||
#define ASSERT(x)
|
||||
#endif
|
||||
|
||||
#ifndef UNUSED
|
||||
#define UNUSED(x) ((void)(x))
|
||||
#endif
|
||||
|
||||
#ifdef UNUSED_FUNC
|
||||
#undefine UNUSED_FUNC
|
||||
#endif
|
||||
|
||||
#ifdef UNUSED_PARAM
|
||||
#undef UNUSED_PARAM
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define UNUSED_PARAM(x) _UNUSED##x __attribute__((unused))
|
||||
#define UNUSED_FUNC __attribute__((unused))
|
||||
#else
|
||||
#define UNUSED_PARAM(x) x
|
||||
#define UNUSED_FUNC
|
||||
#endif
|
||||
|
||||
#ifdef tListLen
|
||||
#undefine tListLen
|
||||
#endif
|
||||
#define tListLen(x) (sizeof(x) / sizeof((x)[0]))
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define FORCE_INLINE inline __attribute__((always_inline))
|
||||
#else
|
||||
#define FORCE_INLINE
|
||||
#endif
|
||||
|
||||
#define DEFAULT_UNICODE_ENCODEC "UCS-4LE"
|
||||
|
||||
#define DEFAULT_COMP(x, y) \
|
||||
do { \
|
||||
if ((x) == (y)) { \
|
||||
return 0; \
|
||||
} else { \
|
||||
return (x) < (y) ? -1 : 1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define DEFAULT_DOUBLE_COMP(x, y) \
|
||||
do { \
|
||||
if (isnan(x) && isnan(y)) { return 0; } \
|
||||
if (isnan(x)) { return -1; } \
|
||||
if (isnan(y)) { return 1; } \
|
||||
if ((x) == (y)) { \
|
||||
return 0; \
|
||||
} else { \
|
||||
return (x) < (y) ? -1 : 1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define DEFAULT_FLOAT_COMP(x, y) DEFAULT_DOUBLE_COMP(x, y)
|
||||
|
||||
#define ALIGN_NUM(n, align) (((n) + ((align)-1)) & (~((align)-1)))
|
||||
|
||||
// align to 8bytes
|
||||
#define ALIGN8(n) ALIGN_NUM(n, 8)
|
||||
|
||||
#undef threadlocal
|
||||
#ifdef _ISOC11_SOURCE
|
||||
#define threadlocal _Thread_local
|
||||
#elif defined(__APPLE__)
|
||||
#define threadlocal __thread
|
||||
#elif defined(__GNUC__) && !defined(threadlocal)
|
||||
#define threadlocal __thread
|
||||
#else
|
||||
#define threadlocal __declspec( thread )
|
||||
#endif
|
||||
|
||||
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
|
||||
#define PRIzu "ld"
|
||||
#else
|
||||
#define PRIzu "zu"
|
||||
#endif
|
||||
|
||||
#if defined(_TD_LINUX_64) || defined(_TD_LINUX_32) || defined(_TD_MIPS_64) || defined(_TD_ARM_32) || defined(_TD_ARM_64) || defined(_TD_DARWIN_64)
|
||||
#if defined(_TD_DARWIN_64)
|
||||
// MacOS
|
||||
#if !defined(_GNU_SOURCE)
|
||||
#define setThreadName(name) do { pthread_setname_np((name)); } while (0)
|
||||
#else
|
||||
// pthread_setname_np not defined
|
||||
#define setThreadName(name)
|
||||
#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
|
||||
// Windows
|
||||
#define setThreadName(name)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -13,21 +13,22 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_DNODE_STEP_H
|
||||
#define TDENGINE_DNODE_STEP_H
|
||||
#ifndef _TD_OS_DIR_H_
|
||||
#define _TD_OS_DIR_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "dnodeInt.h"
|
||||
|
||||
int32_t dnodeStepInit(SStep *pSteps, int32_t stepSize);
|
||||
void dnodeStepCleanup(SStep *pSteps, int32_t stepSize);
|
||||
void dnodeReportStep(char *name, char *desc, int8_t finished);
|
||||
void dnodeSendStartupStep(SRpcMsg *pMsg);
|
||||
void taosRemoveDir(char *dirname);
|
||||
bool taosDirExist(char *dirname);
|
||||
bool taosMkDir(char *dirname);
|
||||
void taosRemoveOldFiles(char *dirname, int32_t keepDays);
|
||||
bool taosExpandDir(char *dirname, char *outname, int32_t maxlen);
|
||||
bool taosRealPath(char *dirname, int32_t maxlen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_OS_DIR_H_*/
|
|
@ -13,19 +13,22 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_DNODE_MAIN_H
|
||||
#define TDENGINE_DNODE_MAIN_H
|
||||
#ifndef _TD_OS_ENV_H_
|
||||
#define _TD_OS_ENV_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "dnodeInt.h"
|
||||
|
||||
int32_t dnodeInitSystem();
|
||||
void dnodeCleanUpSystem();
|
||||
extern char tsOsName[];
|
||||
extern char tsDnodeDir[];
|
||||
extern char tsDataDir[];
|
||||
extern char tsLogDir[];
|
||||
extern char tsScriptDir[];
|
||||
extern char configDir[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_OS_ENV_H_*/
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* 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_OS_FILE_H_
|
||||
#define _TD_OS_FILE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "osSocket.h"
|
||||
|
||||
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
|
||||
typedef int32_t FileFd;
|
||||
#else
|
||||
typedef int32_t FileFd;
|
||||
#endif
|
||||
|
||||
#define FD_INITIALIZER ((int32_t)-1)
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 256
|
||||
#endif
|
||||
|
||||
int32_t taosLockFile(FileFd fd);
|
||||
int32_t taosUnLockFile(FileFd fd);
|
||||
|
||||
int32_t taosUmaskFile(FileFd fd);
|
||||
|
||||
int32_t taosStatFile(const char *path, int64_t *size, int32_t *mtime);
|
||||
int32_t taosFStatFile(FileFd fd, int64_t *size, int32_t *mtime);
|
||||
|
||||
FileFd taosOpenFileWrite(const char *path);
|
||||
FileFd taosOpenFileCreateWrite(const char *path);
|
||||
FileFd taosOpenFileCreateWriteTrunc(const char *path);
|
||||
FileFd taosOpenFileCreateWriteAppend(const char *path);
|
||||
FileFd taosOpenFileRead(const char *path);
|
||||
FileFd taosOpenFileReadWrite(const char *path);
|
||||
|
||||
int64_t taosLSeekFile(FileFd fd, int64_t offset, int32_t whence);
|
||||
int32_t taosFtruncateFile(FileFd fd, int64_t length);
|
||||
int32_t taosFsyncFile(FileFd fd);
|
||||
|
||||
int64_t taosReadFile(FileFd fd, void *buf, int64_t count);
|
||||
int64_t taosWriteFile(FileFd fd, void *buf, int64_t count);
|
||||
|
||||
void taosCloseFile(FileFd fd);
|
||||
|
||||
int32_t taosRenameFile(char *oldName, char *newName);
|
||||
int64_t taosCopyFile(char *from, char *to);
|
||||
|
||||
void taosGetTmpfilePath(const char *inputTmpDir, const char *fileNamePrefix, char *dstPath);
|
||||
|
||||
int64_t taosSendFile(SocketFd dfd, FileFd sfd, int64_t *offset, int64_t size);
|
||||
int64_t taosFSendFile(FILE *outfile, FILE *infile, int64_t *offset, int64_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_TD_OS_FILE_H_*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_OS_LZ4_H
|
||||
#define TDENGINE_OS_LZ4_H
|
||||
#ifndef _TD_OS_LZ4_H_
|
||||
#define _TD_OS_LZ4_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -46,4 +46,4 @@ extern "C" {
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_OS_LZ4_H_*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_OS_MATH_H
|
||||
#define TDENGINE_OS_MATH_H
|
||||
#ifndef _TD_OS_MATH_H_
|
||||
#define _TD_OS_MATH_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -62,4 +62,4 @@ extern "C" {
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_OS_MATH_H_*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_OS_RAND_H
|
||||
#define TDENGINE_OS_RAND_H
|
||||
#ifndef _TD_OS_RAND_H_
|
||||
#define _TD_OS_RAND_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -28,4 +28,4 @@ uint32_t taosSafeRand(void);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_OS_RAND_H_*/
|
|
@ -13,13 +13,15 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_OS_SEMAPHORE_H
|
||||
#define TDENGINE_OS_SEMAPHORE_H
|
||||
#ifndef _TD_OS_SEMPHONE_H_
|
||||
#define _TD_OS_SEMPHONE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <semaphore.h>
|
||||
|
||||
#if defined (_TD_DARWIN_64)
|
||||
typedef struct tsem_s *tsem_t;
|
||||
int tsem_init(tsem_t *sem, int pshared, unsigned int value);
|
||||
|
@ -61,4 +63,4 @@ int32_t taosGetCurrentAPPName(char* name, int32_t* len);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_OS_SEMPHONE_H_*/
|
|
@ -13,15 +13,13 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_OS_SIGNAL_H
|
||||
#define TDENGINE_OS_SIGNAL_H
|
||||
#ifndef _TD_OS_SIGNAL_H_
|
||||
#define _TD_OS_SIGNAL_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#ifndef SIGALRM
|
||||
#define SIGALRM 1234
|
||||
#endif
|
||||
|
@ -55,4 +53,4 @@ void taosDflSignal(int32_t signum);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_OS_SIGNAL_H
|
||||
#endif /*_TD_OS_SIGNAL_H_*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_OS_SLEEP_H
|
||||
#define TDENGINE_OS_SLEEP_H
|
||||
#ifndef _TD_OS_SLEEP_H_
|
||||
#define _TD_OS_SLEEP_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -26,4 +26,4 @@ void taosMsleep(int32_t ms);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_OS_SLEEP_H_*/
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* 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_OS_SOCKET_H_
|
||||
#define _TD_OS_SOCKET_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
|
||||
#include "winsock2.h"
|
||||
#include <WS2tcpip.h>
|
||||
#include <winbase.h>
|
||||
#include <Winsock2.h>
|
||||
#else
|
||||
#include <netinet/in.h>
|
||||
#include <sys/epoll.h>
|
||||
#endif
|
||||
|
||||
#define TAOS_EPOLL_WAIT_TIME 500
|
||||
typedef int32_t SOCKET;
|
||||
typedef SOCKET EpollFd;
|
||||
#define EpollClose(pollFd) taosCloseSocket(pollFd)
|
||||
|
||||
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
|
||||
typedef SOCKET SocketFd;
|
||||
#else
|
||||
typedef int32_t SocketFd;
|
||||
#endif
|
||||
|
||||
int32_t taosSendto(SocketFd fd, void * msg, int len, unsigned int flags, const struct sockaddr * to, int tolen);
|
||||
int32_t taosWriteSocket(SocketFd fd, void *msg, int len);
|
||||
int32_t taosReadSocket(SocketFd fd, void *msg, int len);
|
||||
int32_t taosCloseSocketNoCheck(SocketFd fd);
|
||||
int32_t taosCloseSocket(SocketFd fd);
|
||||
void taosShutDownSocketRD(SOCKET fd);
|
||||
void taosShutDownSocketWR(SOCKET fd);
|
||||
int32_t taosSetNonblocking(SOCKET sock, int32_t on);
|
||||
void taosIgnSIGPIPE();
|
||||
void taosBlockSIGPIPE();
|
||||
void taosSetMaskSIGPIPE();
|
||||
int32_t taosSetSockOpt(SOCKET socketfd, int32_t level, int32_t optname, void *optval, int32_t optlen);
|
||||
int32_t taosGetSockOpt(SOCKET socketfd, int32_t level, int32_t optname, void *optval, int32_t *optlen);
|
||||
|
||||
uint32_t taosInetAddr(char *ipAddr);
|
||||
const char *taosInetNtoa(struct in_addr ipInt);
|
||||
|
||||
#if (defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32))
|
||||
#define htobe64 htonll
|
||||
#if defined(_TD_GO_DLL_)
|
||||
uint64_t htonll(uint64_t val);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_TD_DARWIN_64)
|
||||
#define htobe64 htonll
|
||||
#endif
|
||||
|
||||
int32_t taosReadn(SOCKET sock, char *buffer, int32_t len);
|
||||
int32_t taosWriteMsg(SOCKET fd, void *ptr, int32_t nbytes);
|
||||
int32_t taosReadMsg(SOCKET fd, void *ptr, int32_t nbytes);
|
||||
int32_t taosNonblockwrite(SOCKET fd, char *ptr, int32_t nbytes);
|
||||
int64_t taosCopyFds(SOCKET sfd, int32_t dfd, int64_t len);
|
||||
int32_t taosSetNonblocking(SOCKET sock, int32_t on);
|
||||
|
||||
SOCKET taosOpenUdpSocket(uint32_t localIp, uint16_t localPort);
|
||||
SOCKET taosOpenTcpClientSocket(uint32_t ip, uint16_t port, uint32_t localIp);
|
||||
SOCKET taosOpenTcpServerSocket(uint32_t ip, uint16_t port);
|
||||
int32_t taosKeepTcpAlive(SOCKET sockFd);
|
||||
|
||||
int32_t taosGetFqdn(char *);
|
||||
uint32_t taosGetIpv4FromFqdn(const char *);
|
||||
void tinet_ntoa(char *ipstr, uint32_t ip);
|
||||
uint32_t ip2uint(const char *const ip_addr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_TD_OS_SOCKET_H_*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_OS_STRING_H
|
||||
#define TDENGINE_OS_STRING_H
|
||||
#ifndef _TD_OS_STRING_H_
|
||||
#define _TD_OS_STRING_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -43,7 +43,7 @@ int64_t taosStr2int64(char *str);
|
|||
// USE_LIBICONV
|
||||
int32_t taosUcs4ToMbs(void *ucs4, int32_t ucs4_max_len, char *mbs);
|
||||
bool taosMbsToUcs4(char *mbs, size_t mbs_len, char *ucs4, int32_t ucs4_max_len, int32_t *len);
|
||||
int32_t tasoUcs4Compare(void *f1_ucs4, void *f2_ucs4, int32_t bytes);
|
||||
int32_t tasoUcs4Compare(void *f1_ucs4, void *f2_ucs4, int32_t bytes, int8_t ncharSize);
|
||||
bool taosValidateEncodec(const char *encodec);
|
||||
char * taosCharsetReplace(char *charsetstr);
|
||||
|
||||
|
@ -51,4 +51,4 @@ char * taosCharsetReplace(char *charsetstr);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_OS_STRING_H_*/
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* 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_OS_SYSINFO_H_
|
||||
#define _TD_OS_SYSINFO_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define TSDB_LOCALE_LEN 64
|
||||
#define TSDB_TIMEZONE_LEN 96
|
||||
|
||||
extern int64_t tsPageSize;
|
||||
extern int64_t tsOpenMax;
|
||||
extern int64_t tsStreamMax;
|
||||
extern int32_t tsNumOfCores;
|
||||
extern int32_t tsTotalMemoryMB;
|
||||
extern char tsTimezone[];
|
||||
extern char tsLocale[];
|
||||
extern char tsCharset[]; // default encode string
|
||||
|
||||
typedef struct {
|
||||
int64_t tsize;
|
||||
int64_t used;
|
||||
int64_t avail;
|
||||
} SysDiskSize;
|
||||
|
||||
int32_t taosGetDiskSize(char *dataDir, SysDiskSize *diskSize);
|
||||
int32_t taosGetCpuCores();
|
||||
void taosGetSystemInfo();
|
||||
bool taosReadProcIO(int64_t *rchars, int64_t *wchars);
|
||||
bool taosGetProcIO(float *readKB, float *writeKB);
|
||||
bool taosGetCardInfo(int64_t *bytes, int64_t *rbytes, int64_t *tbytes);
|
||||
bool taosGetBandSpeed(float *bandSpeedKb);
|
||||
void taosGetDisk();
|
||||
bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage);
|
||||
bool taosGetProcMemory(float *memoryUsedMB);
|
||||
bool taosGetSysMemory(float *memoryUsedMB);
|
||||
void taosPrintOsInfo();
|
||||
int taosSystem(const char *cmd);
|
||||
void taosKillSystem();
|
||||
bool taosGetSystemUid(char *uid, int32_t uidlen);
|
||||
char * taosGetCmdlineByPID(int pid);
|
||||
void taosSetCoreDump(bool enable);
|
||||
|
||||
typedef struct {
|
||||
const char *sysname;
|
||||
const char *nodename;
|
||||
const char *release;
|
||||
const char *version;
|
||||
const char *machine;
|
||||
} SysNameInfo;
|
||||
|
||||
SysNameInfo taosGetSysNameInfo();
|
||||
|
||||
int64_t taosGetPid();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -13,21 +13,21 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_OS_SYSTEM_H
|
||||
#define TDENGINE_OS_SYSTEM_H
|
||||
#ifndef _TD_OS_SYSTEM_H_
|
||||
#define _TD_OS_SYSTEM_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void* taosLoadDll(const char *filename);
|
||||
void* taosLoadDll(const char* filename);
|
||||
void* taosLoadSym(void* handle, char* name);
|
||||
void taosCloseDll(void *handle);
|
||||
void taosCloseDll(void* handle);
|
||||
|
||||
int taosSetConsoleEcho(bool on);
|
||||
int32_t taosSetConsoleEcho(bool on);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_OS_SYSTEM_H_*/
|
|
@ -13,18 +13,17 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_MODULE
|
||||
#define TDENGINE_MODULE
|
||||
#ifndef _TD_OS_THREAD_H_
|
||||
#define _TD_OS_THREAD_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int32_t moduleStart();
|
||||
void moduleStop();
|
||||
#include <pthread.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_OS_THREAD_H_*/
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* 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_OS_TIME_H_
|
||||
#define _TD_OS_TIME_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
|
||||
#ifdef _TD_GO_DLL_
|
||||
#define MILLISECOND_PER_SECOND (1000LL)
|
||||
#else
|
||||
#define MILLISECOND_PER_SECOND (1000i64)
|
||||
#endif
|
||||
#else
|
||||
#define MILLISECOND_PER_SECOND ((int64_t)1000L)
|
||||
#endif
|
||||
|
||||
#define MILLISECOND_PER_MINUTE (MILLISECOND_PER_SECOND * 60)
|
||||
#define MILLISECOND_PER_HOUR (MILLISECOND_PER_MINUTE * 60)
|
||||
#define MILLISECOND_PER_DAY (MILLISECOND_PER_HOUR * 24)
|
||||
#define MILLISECOND_PER_WEEK (MILLISECOND_PER_DAY * 7)
|
||||
|
||||
int32_t taosGetTimeOfDay(struct timeval *tv);
|
||||
|
||||
//@return timestamp in second
|
||||
int32_t taosGetTimestampSec();
|
||||
|
||||
//@return timestamp in millisecond
|
||||
static FORCE_INLINE int64_t taosGetTimestampMs() {
|
||||
struct timeval systemTime;
|
||||
taosGetTimeOfDay(&systemTime);
|
||||
return (int64_t)systemTime.tv_sec * 1000L + (int64_t)systemTime.tv_usec / 1000;
|
||||
}
|
||||
|
||||
//@return timestamp in microsecond
|
||||
static FORCE_INLINE int64_t taosGetTimestampUs() {
|
||||
struct timeval systemTime;
|
||||
taosGetTimeOfDay(&systemTime);
|
||||
return (int64_t)systemTime.tv_sec * 1000000L + (int64_t)systemTime.tv_usec;
|
||||
}
|
||||
|
||||
//@return timestamp in nanosecond
|
||||
static FORCE_INLINE int64_t taosGetTimestampNs() {
|
||||
struct timespec systemTime = {0};
|
||||
clock_gettime(CLOCK_REALTIME, &systemTime);
|
||||
return (int64_t)systemTime.tv_sec * 1000000000L + (int64_t)systemTime.tv_nsec;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_TD_OS_TIME_H_*/
|
|
@ -13,18 +13,22 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_OS_TIMER_H
|
||||
#define TDENGINE_OS_TIMER_H
|
||||
#ifndef _TD_OS_TIMER_H_
|
||||
#define _TD_OS_TIMER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int taosInitTimer(void (*callback)(int), int ms);
|
||||
void taosUninitTimer();
|
||||
#define MSECONDS_PER_TICK 5
|
||||
|
||||
int32_t taosInitTimer(void (*callback)(int32_t), int32_t ms);
|
||||
void taosUninitTimer();
|
||||
int64_t taosGetMonotonicMs();
|
||||
const char *taosMonotonicInit();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_OS_TIMER_H_*/
|
|
@ -20,56 +20,55 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct SRpcMsg;
|
||||
struct SRpcEpSet;
|
||||
|
||||
struct SRpcMsg;
|
||||
/**
|
||||
* Initialize and start the dnode module
|
||||
*
|
||||
* @return Error Code
|
||||
* Initialize and start the dnode module.
|
||||
*
|
||||
* @return Error code.
|
||||
*/
|
||||
int32_t dnodeInit();
|
||||
|
||||
/**
|
||||
* Stop and cleanup dnode module
|
||||
* Stop and cleanup dnode module.
|
||||
*/
|
||||
void dnodeCleanup();
|
||||
|
||||
/**
|
||||
* Send messages to other dnodes, such as create vnode message.
|
||||
*
|
||||
* @param epSet The endpoint list of the dnodes.
|
||||
* @param rpcMsg Message to be sent.
|
||||
* @param epSet, the endpoint list of the dnodes.
|
||||
* @param rpcMsg, message to be sent.
|
||||
*/
|
||||
void dnodeSendMsgToDnode(SRpcEpSet *epSet, SRpcMsg *rpcMsg);
|
||||
void dnodeSendMsgToDnode(struct SRpcEpSet *epSet, struct SRpcMsg *rpcMsg);
|
||||
|
||||
/**
|
||||
* Send messages to mnode, such as config message.
|
||||
*
|
||||
* @param rpcMsg Message to be sent.
|
||||
* @param rpcMsg, message to be sent.
|
||||
*/
|
||||
void dnodeSendMsgToMnode(SRpcMsg *rpcMsg);
|
||||
void dnodeSendMsgToMnode(struct SRpcMsg *rpcMsg);
|
||||
|
||||
/**
|
||||
* Send redirect message to dnode or shell.
|
||||
*
|
||||
* @param rpcMsg, message to be sent.
|
||||
* @param forShell, used to identify whether to send to shell or dnode.
|
||||
*/
|
||||
void dnodeSendRedirectMsg(struct SRpcMsg *rpcMsg, bool forShell);
|
||||
|
||||
/**
|
||||
* Get the corresponding endpoint information from dnodeId.
|
||||
*
|
||||
* @param dnodeId
|
||||
* @param ep The endpoint of dnode
|
||||
* @param fqdn The fqdn of dnode
|
||||
* @param port The port of dnode
|
||||
* @param dnodeId, the id ot dnode.
|
||||
* @param ep, the endpoint of dnode.
|
||||
* @param fqdn, the fqdn of dnode.
|
||||
* @param port, the port of dnode.
|
||||
*/
|
||||
void dnodeGetDnodeEp(int32_t dnodeId, char *ep, char *fqdn, uint16_t *port);
|
||||
|
||||
/**
|
||||
* Report to dnode the start-up steps of other modules
|
||||
*
|
||||
* @param name Name of the start-up phase.
|
||||
* @param desc Description of the start-up phase.
|
||||
*/
|
||||
void dnodeReportStartup(char *name, char *desc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_TD_DNODE_H_*/
|
||||
#endif /*_TD_DNODE_H_*/
|
||||
|
|
|
@ -20,49 +20,125 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct SRpcMsg;
|
||||
typedef struct {
|
||||
/**
|
||||
* Send messages to other dnodes, such as create vnode message.
|
||||
*
|
||||
* @param epSet, the endpoint list of the dnodes.
|
||||
* @param rpcMsg, message to be sent.
|
||||
*/
|
||||
void (*SendMsgToDnode)(struct SRpcEpSet *epSet, struct SRpcMsg *rpcMsg);
|
||||
|
||||
/**
|
||||
* Send messages to mnode, such as config message.
|
||||
*
|
||||
* @param rpcMsg, message to be sent.
|
||||
*/
|
||||
void (*SendMsgToMnode)(struct SRpcMsg *rpcMsg);
|
||||
|
||||
/**
|
||||
* Send redirect message to dnode or shell.
|
||||
*
|
||||
* @param rpcMsg, message to be sent.
|
||||
* @param forShell, used to identify whether to send to shell or dnode.
|
||||
*/
|
||||
void (*SendRedirectMsg)(struct SRpcMsg *rpcMsg, bool forShell);
|
||||
|
||||
/**
|
||||
* Get the corresponding endpoint information from dnodeId.
|
||||
*
|
||||
* @param dnode, the instance of dDnode module.
|
||||
* @param dnodeId, the id ot dnode.
|
||||
* @param ep, the endpoint of dnode.
|
||||
* @param fqdn, the fqdn of dnode.
|
||||
* @param port, the port of dnode.
|
||||
*/
|
||||
void (*GetDnodeEp)(int32_t dnodeId, char *ep, char *fqdn, uint16_t *port);
|
||||
|
||||
} SMnodeFp;
|
||||
|
||||
typedef struct {
|
||||
SMnodeFp fp;
|
||||
char clusterId[TSDB_CLUSTER_ID_LEN];
|
||||
int32_t dnodeId;
|
||||
} SMnodePara;
|
||||
|
||||
/**
|
||||
* Deploy Mnode instances in Dnode.
|
||||
*
|
||||
* Initialize and start mnode module.
|
||||
*
|
||||
* @param para, initialization parameters.
|
||||
* @return Error code.
|
||||
*/
|
||||
int32_t mnodeInit(SMnodePara para);
|
||||
|
||||
/**
|
||||
* Stop and cleanup mnode module.
|
||||
*/
|
||||
void mnodeCleanup();
|
||||
|
||||
/**
|
||||
* Deploy mnode instances in dnode.
|
||||
*
|
||||
* @param minfos, server information used to deploy the mnode instance.
|
||||
* @return Error Code.
|
||||
*/
|
||||
int32_t mnodeDeploy();
|
||||
int32_t mnodeDeploy(struct SMInfos *minfos);
|
||||
|
||||
/**
|
||||
* Delete the Mnode instance deployed in Dnode.
|
||||
* Delete the mnode instance deployed in dnode.
|
||||
*/
|
||||
void mnodeUnDeploy();
|
||||
|
||||
/**
|
||||
* Start Mnode service.
|
||||
*
|
||||
* @return Error Code.
|
||||
*/
|
||||
int32_t mnodeStart();
|
||||
|
||||
/**
|
||||
* Stop Mnode service.
|
||||
*/
|
||||
int32_t mnodeStop();
|
||||
|
||||
/**
|
||||
* Interface for processing messages.
|
||||
*
|
||||
* @param pMsg Message to be processed.
|
||||
* @return Error code
|
||||
*/
|
||||
int32_t mnodeProcessMsg(SRpcMsg *pMsg);
|
||||
|
||||
/**
|
||||
* Whether the Mnode is in service.
|
||||
*
|
||||
* Whether the mnode is in service.
|
||||
*
|
||||
* @return Server status.
|
||||
*/
|
||||
bool mnodeIsServing();
|
||||
|
||||
typedef struct {
|
||||
int64_t numOfDnode;
|
||||
int64_t numOfMnode;
|
||||
int64_t numOfVgroup;
|
||||
int64_t numOfDatabase;
|
||||
int64_t numOfSuperTable;
|
||||
int64_t numOfChildTable;
|
||||
int64_t numOfColumn;
|
||||
int64_t totalPoints;
|
||||
int64_t totalStorage;
|
||||
int64_t compStorage;
|
||||
} SMnodeStat;
|
||||
|
||||
/**
|
||||
* Get the statistical information of Mnode.
|
||||
*
|
||||
* @param stat, statistical information.
|
||||
* @return Error Code.
|
||||
*/
|
||||
int32_t mnodeGetStatistics(SMnodeStat *stat);
|
||||
|
||||
/**
|
||||
* Get the statistical information of Mnode.
|
||||
*
|
||||
* @param user, username.
|
||||
* @param spi, security parameter index.
|
||||
* @param encrypt, encrypt algorithm.
|
||||
* @param secret, key for authentication.
|
||||
* @param ckey, ciphering key.
|
||||
* @return Error Code.
|
||||
*/
|
||||
int32_t mnodeRetriveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey);
|
||||
|
||||
/**
|
||||
* Interface for processing messages.
|
||||
*
|
||||
* @param rpcMsg, message to be processed.
|
||||
* @return Error code.
|
||||
*/
|
||||
void mnodeProcessMsg(SRpcMsg *rpcMsg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_TD_MNODE_H_*/
|
||||
#endif /*_TD_MNODE_H_*/
|
||||
|
|
|
@ -20,43 +20,87 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct SRpcMsg;
|
||||
typedef struct {
|
||||
/**
|
||||
* Send messages to other dnodes, such as create vnode message.
|
||||
*
|
||||
* @param epSet, the endpoint list of dnodes.
|
||||
* @param rpcMsg, message to be sent.
|
||||
*/
|
||||
void (*SendMsgToDnode)(struct SRpcEpSet *epSet, struct SRpcMsg *rpcMsg);
|
||||
|
||||
/**
|
||||
* Send messages to mnode, such as config message.
|
||||
*
|
||||
* @param rpcMsg, message to be sent.
|
||||
*/
|
||||
void (*SendMsgToMnode)(struct SRpcMsg *rpcMsg);
|
||||
|
||||
/**
|
||||
* Get the corresponding endpoint information from dnodeId.
|
||||
*
|
||||
* @param dnodeId, the id ot dnode.
|
||||
* @param ep, the endpoint of dnode.
|
||||
* @param fqdn, the fqdn of dnode.
|
||||
* @param port, the port of dnode.
|
||||
*/
|
||||
void (*GetDnodeEp)(int32_t dnodeId, char *ep, char *fqdn, uint16_t *port);
|
||||
|
||||
} SVnodeFp;
|
||||
|
||||
typedef struct {
|
||||
SVnodeFp fp;
|
||||
} SVnodePara;
|
||||
|
||||
/**
|
||||
* Start Initialize Vnode module.
|
||||
* Start initialize vnode module.
|
||||
*
|
||||
* @return Error Code.
|
||||
* @param para, initialization parameters.
|
||||
* @return Error code.
|
||||
*/
|
||||
int32_t vnodeInit();
|
||||
|
||||
int32_t vnodeInit(SVnodePara para);
|
||||
|
||||
/**
|
||||
* Cleanup Vnode module.
|
||||
* Cleanup vnode module.
|
||||
*/
|
||||
void vnodeCleanup();
|
||||
|
||||
|
||||
typedef struct {
|
||||
int64_t queryMsgCount;
|
||||
int64_t writeMsgCount;
|
||||
int32_t unused;
|
||||
} SVnodeStat;
|
||||
|
||||
|
||||
/**
|
||||
* Get the statistical information of Vnode
|
||||
* Get the statistical information of vnode.
|
||||
*
|
||||
* @param stat Statistical information.
|
||||
* @param stat, statistical information.
|
||||
* @return Error Code.
|
||||
*/
|
||||
int32_t vnodeGetStatistics(SVnodeStat *stat);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get the status of all vnodes.
|
||||
*
|
||||
* @param status, status msg.
|
||||
*/
|
||||
void vnodeGetStatus(struct SStatusMsg *status);
|
||||
|
||||
/**
|
||||
* Set access permissions for all vnodes.
|
||||
*
|
||||
* @param access, access permissions of vnodes.
|
||||
* @param numOfVnodes, the size of vnodes.
|
||||
*/
|
||||
void vnodeSetAccess(struct SVgroupAccess *access, int32_t numOfVnodes);
|
||||
|
||||
/**
|
||||
* Interface for processing messages.
|
||||
*
|
||||
* @param pMsg Message to be processed.
|
||||
* @return Error code
|
||||
* @param msg, message to be processed.
|
||||
*/
|
||||
int32_t vnodeProcessMsg(SRpcMsg *pMsg);
|
||||
void vnodeProcessMsg(SRpcMsg *msg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_TD_VNODE_H_*/
|
||||
#endif /*_TD_VNODE_H_*/
|
||||
|
|
|
@ -13,13 +13,10 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_EXCEPTION_H
|
||||
#define TDENGINE_EXCEPTION_H
|
||||
#ifndef _TD_UTIL_EXCEPTION_H
|
||||
#define _TD_UTIL_EXCEPTION_H
|
||||
|
||||
#include <setjmp.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <assert.h>
|
||||
#include "os.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -125,4 +122,4 @@ void exceptionThrow( int32_t code );
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_UTIL_EXCEPTION_H*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_HASH_H
|
||||
#define TDENGINE_HASH_H
|
||||
#ifndef _TD_UTIL_HASH_H
|
||||
#define _TD_UTIL_HASH_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -178,4 +178,4 @@ uint32_t taosHashGetDataKeyLen(SHashObj *pHashObj, void *data);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_HASH_H
|
||||
#endif /*_TD_UTIL_HASH_H*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_HASHUTIL_H
|
||||
#define TDENGINE_HASHUTIL_H
|
||||
#ifndef _TD_UTIL_HASHFUNC_H
|
||||
#define _TD_UTIL_HASHFUNC_H
|
||||
|
||||
#include "os.h"
|
||||
|
||||
|
@ -48,4 +48,4 @@ _hash_fn_t taosGetDefaultHashFunction(int32_t type);
|
|||
|
||||
_equal_fn_t taosGetDefaultEqualFunction(int32_t type);
|
||||
|
||||
#endif //TDENGINE_HASHUTIL_H
|
||||
#endif /*_TD_UTIL_HASHFUNC_H*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TALGO_H
|
||||
#define TDENGINE_TALGO_H
|
||||
#ifndef _TD_UTIL_TALGO_H
|
||||
#define _TD_UTIL_TALGO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -95,4 +95,4 @@ void taosheapsort(void *base, int32_t size, int32_t len, const void *parcompar,
|
|||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // TDENGINE_TALGO_H
|
||||
#endif /*_TD_UTIL_TALGO_H*/
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TAOSARRAY_H
|
||||
#define TDENGINE_TAOSARRAY_H
|
||||
#ifndef _TD_UTIL_ARRAY_H
|
||||
#define _TD_UTIL_ARRAY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -228,6 +228,4 @@ void taosArraySortPWithExt(SArray* pArray, __ext_compar_fn_t fn, const void *par
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif // TDENGINE_TAOSARRAY_H
|
||||
#endif /*_TD_UTIL_ARRAY_H*/
|
||||
|
|
|
@ -13,11 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TBUFFER_H
|
||||
#define TDENGINE_TBUFFER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#ifndef _TD_UTIL_BUFFER_H
|
||||
#define _TD_UTIL_BUFFER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -175,4 +172,4 @@ void tbufWriteDoubleAt( SBufferWriter* buf, size_t pos, double data );
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_UTIL_BUFFER_H*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TCACHE_H
|
||||
#define TDENGINE_TCACHE_H
|
||||
#ifndef _TD_UTIL_CACHE_H
|
||||
#define _TD_UTIL_CACHE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -188,4 +188,4 @@ void taosStopCacheRefreshWorker();
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TCACHE_H
|
||||
#endif /*_TD_UTIL_CACHE_H*/
|
|
@ -13,22 +13,14 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TCHECKSUM_H
|
||||
#define TDENGINE_TCHECKSUM_H
|
||||
#ifndef _TD_UTIL_CHECKSUM_H
|
||||
#define _TD_UTIL_CHECKSUM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <pthread.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include "os.h"
|
||||
#include "tcrc32c.h"
|
||||
#include "tutil.h"
|
||||
|
||||
|
@ -64,4 +56,4 @@ static FORCE_INLINE int taosCheckChecksumWhole(const uint8_t *stream, uint32_t s
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TCHECKSUM_H
|
||||
#endif /*_TD_UTIL_CHECKSUM_H*/
|
|
@ -12,14 +12,14 @@
|
|||
* 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_CODING_H_
|
||||
#define _TD_CODING_H_
|
||||
#ifndef _TD_UTIL_CODING_H
|
||||
#define _TD_UTIL_CODING_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "os.h "
|
||||
#include "os.h"
|
||||
|
||||
#define ENCODE_LIMIT (((uint8_t)1) << 7)
|
||||
#define ZIGZAGE(T, v) ((u##T)((v) >> (sizeof(T) * 8 - 1))) ^ (((u##T)(v)) << 1) // zigzag encode
|
||||
|
@ -361,4 +361,4 @@ static FORCE_INLINE void *taosDecodeString(void *buf, char **value) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_UTIL_CODING_H*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TCOMPARE_H
|
||||
#define TDENGINE_TCOMPARE_H
|
||||
#ifndef _TD_UTIL_COMPARE_H
|
||||
#define _TD_UTIL_COMPARE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -93,4 +93,4 @@ int32_t compareWStrPatternComp(const void* pLeft, const void* pRight);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TCOMPARE_H
|
||||
#endif /*_TD_UTIL_COMPARE_H*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_CFG_H
|
||||
#define TDENGINE_CFG_H
|
||||
#ifndef _TD_UTIL_CONFIG_H
|
||||
#define _TD_UTIL_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -87,11 +87,11 @@ bool taosReadGlobalCfg();
|
|||
void taosPrintGlobalCfg();
|
||||
void taosDumpGlobalCfg();
|
||||
|
||||
void taosInitConfigOption(SGlobalCfg cfg);
|
||||
SGlobalCfg * taosGetConfigOption(const char *option);
|
||||
void taosInitConfigOption(SGlobalCfg cfg);
|
||||
SGlobalCfg *taosGetConfigOption(const char *option);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TGLOBALCFG_H
|
||||
#endif /*_TD_UTIL_CONFIG_H*/
|
|
@ -18,10 +18,8 @@
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TCRC32C_H
|
||||
#define TDENGINE_TCRC32C_H
|
||||
|
||||
#include <stdint.h>
|
||||
#ifndef _TD_UTIL_CRC32_H
|
||||
#define _TD_UTIL_CRC32_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -41,4 +39,4 @@ void taosResolveCRC();
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TCRC32C_H
|
||||
#endif /*_TD_UTIL_CRC32_H*/
|
|
@ -13,17 +13,15 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TAOS_DEF_H
|
||||
#define TDENGINE_TAOS_DEF_H
|
||||
#ifndef _TD_UTIL_DEF_H
|
||||
#define _TD_UTIL_DEF_H
|
||||
|
||||
#include "os.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "taos.h"
|
||||
|
||||
#define TSDB__packed
|
||||
|
||||
#ifdef TSKEY32
|
||||
|
@ -32,10 +30,6 @@ extern "C" {
|
|||
#define TSKEY int64_t
|
||||
#endif
|
||||
|
||||
#define TSWINDOW_INITIALIZER ((STimeWindow) {INT64_MIN, INT64_MAX})
|
||||
#define TSWINDOW_DESC_INITIALIZER ((STimeWindow) {INT64_MAX, INT64_MIN})
|
||||
#define IS_TSWINDOW_SPECIFIED(win) (((win).skey != INT64_MIN) || ((win).ekey != INT64_MAX))
|
||||
|
||||
#define TSKEY_INITIAL_VAL INT64_MIN
|
||||
|
||||
// Bytes for each type.
|
||||
|
@ -84,6 +78,8 @@ extern const int32_t TYPE_BYTES[15];
|
|||
#define TSDB_DEFAULT_PASS "powerdb"
|
||||
#elif (_TD_TQ_ == true)
|
||||
#define TSDB_DEFAULT_PASS "tqueue"
|
||||
#elif (_TD_PRO_ == true)
|
||||
#define TSDB_DEFAULT_PASS "prodb"
|
||||
#else
|
||||
#define TSDB_DEFAULT_PASS "taosdata"
|
||||
#endif
|
||||
|
@ -219,8 +215,6 @@ do { \
|
|||
#define TSDB_AUTH_LEN 16
|
||||
#define TSDB_KEY_LEN 16
|
||||
#define TSDB_VERSION_LEN 12
|
||||
#define TSDB_LOCALE_LEN 64
|
||||
#define TSDB_TIMEZONE_LEN 96
|
||||
#define TSDB_LABEL_LEN 8
|
||||
|
||||
#define TSDB_CLUSTER_ID_LEN 40
|
||||
|
@ -403,54 +397,63 @@ do { \
|
|||
|
||||
#define TSDB_ARB_DUMMY_TIME 4765104000000 // 2121-01-01 00:00:00.000, :P
|
||||
|
||||
typedef enum {
|
||||
TAOS_QTYPE_RPC = 0,
|
||||
TAOS_QTYPE_FWD = 1,
|
||||
TAOS_QTYPE_WAL = 2,
|
||||
TAOS_QTYPE_CQ = 3,
|
||||
TAOS_QTYPE_QUERY = 4
|
||||
} EQType;
|
||||
|
||||
#define TSDB_MAX_TIERS 3
|
||||
#define TSDB_MAX_DISKS_PER_TIER 16
|
||||
#define TSDB_MAX_DISKS (TSDB_MAX_TIERS * TSDB_MAX_DISKS_PER_TIER)
|
||||
|
||||
typedef enum {
|
||||
TSDB_SUPER_TABLE = 0, // super table
|
||||
TSDB_CHILD_TABLE = 1, // table created from super table
|
||||
TSDB_NORMAL_TABLE = 2, // ordinary table
|
||||
TSDB_STREAM_TABLE = 3, // table created from stream computing
|
||||
TSDB_TEMP_TABLE = 4, // temp table created by nest query
|
||||
TSDB_TABLE_MAX = 5
|
||||
} ETableType;
|
||||
#define TSDB_DATA_TYPE_NULL 0 // 1 bytes
|
||||
#define TSDB_DATA_TYPE_BOOL 1 // 1 bytes
|
||||
#define TSDB_DATA_TYPE_TINYINT 2 // 1 byte
|
||||
#define TSDB_DATA_TYPE_SMALLINT 3 // 2 bytes
|
||||
#define TSDB_DATA_TYPE_INT 4 // 4 bytes
|
||||
#define TSDB_DATA_TYPE_BIGINT 5 // 8 bytes
|
||||
#define TSDB_DATA_TYPE_FLOAT 6 // 4 bytes
|
||||
#define TSDB_DATA_TYPE_DOUBLE 7 // 8 bytes
|
||||
#define TSDB_DATA_TYPE_BINARY 8 // string
|
||||
#define TSDB_DATA_TYPE_TIMESTAMP 9 // 8 bytes
|
||||
#define TSDB_DATA_TYPE_NCHAR 10 // unicode string
|
||||
#define TSDB_DATA_TYPE_UTINYINT 11 // 1 byte
|
||||
#define TSDB_DATA_TYPE_USMALLINT 12 // 2 bytes
|
||||
#define TSDB_DATA_TYPE_UINT 13 // 4 bytes
|
||||
#define TSDB_DATA_TYPE_UBIGINT 14 // 8 bytes
|
||||
|
||||
typedef enum {
|
||||
TSDB_MOD_MNODE = 0,
|
||||
TSDB_MOD_HTTP = 1,
|
||||
TSDB_MOD_MONITOR = 2,
|
||||
TSDB_MOD_MQTT = 3,
|
||||
TSDB_MOD_MAX = 4
|
||||
} EModuleType;
|
||||
// ----------------- For variable data types such as TSDB_DATA_TYPE_BINARY and TSDB_DATA_TYPE_NCHAR
|
||||
|
||||
typedef enum {
|
||||
TSDB_CHECK_ITEM_NETWORK,
|
||||
TSDB_CHECK_ITEM_MEM,
|
||||
TSDB_CHECK_ITEM_CPU,
|
||||
TSDB_CHECK_ITEM_DISK,
|
||||
TSDB_CHECK_ITEM_OS,
|
||||
TSDB_CHECK_ITEM_ACCESS,
|
||||
TSDB_CHECK_ITEM_VERSION,
|
||||
TSDB_CHECK_ITEM_DATAFILE,
|
||||
TSDB_CHECK_ITEM_MAX
|
||||
} ECheckItemType;
|
||||
typedef int32_t VarDataOffsetT;
|
||||
typedef int16_t VarDataLenT; // maxVarDataLen: 32767
|
||||
typedef uint16_t TDRowLenT; // not including overhead: 0 ~ 65535
|
||||
typedef uint32_t TDRowTLenT; // total length, including overhead
|
||||
|
||||
typedef enum {
|
||||
TD_ROW_DISCARD_UPDATE = 0,
|
||||
TD_ROW_OVERWRITE_UPDATE = 1,
|
||||
TD_ROW_PARTIAL_UPDATE = 2
|
||||
} TDUpdateConfig;
|
||||
typedef struct tstr {
|
||||
VarDataLenT len;
|
||||
char data[];
|
||||
} tstr;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
typedef struct {
|
||||
VarDataLenT len;
|
||||
uint8_t data;
|
||||
} SBinaryNullT;
|
||||
|
||||
typedef struct {
|
||||
VarDataLenT len;
|
||||
uint32_t data;
|
||||
} SNCharNullT;
|
||||
#pragma pack(pop)
|
||||
|
||||
#define VARSTR_HEADER_SIZE sizeof(VarDataLenT)
|
||||
|
||||
#define varDataLen(v) ((VarDataLenT *)(v))[0]
|
||||
#define varDataTLen(v) (sizeof(VarDataLenT) + varDataLen(v))
|
||||
#define varDataVal(v) ((void *)((char *)v + VARSTR_HEADER_SIZE))
|
||||
#define varDataCopy(dst, v) memcpy((dst), (void*) (v), varDataTLen(v))
|
||||
#define varDataLenByData(v) (*(VarDataLenT *)(((char*)(v)) - VARSTR_HEADER_SIZE))
|
||||
#define varDataSetLen(v, _len) (((VarDataLenT *)(v))[0] = (VarDataLenT) (_len))
|
||||
#define IS_VAR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_BINARY) || ((t) == TSDB_DATA_TYPE_NCHAR))
|
||||
|
||||
#define varDataNetLen(v) (htons(((VarDataLenT *)(v))[0]))
|
||||
#define varDataNetTLen(v) (sizeof(VarDataLenT) + varDataNetLen(v))
|
||||
|
||||
extern char *qtypeStr[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TFILE_H
|
||||
#define TDENGINE_TFILE_H
|
||||
#ifndef _TD_UTIL_FILE_H
|
||||
#define _TD_UTIL_FILE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -28,8 +28,10 @@ void tfCleanup();
|
|||
|
||||
// the same syntax as UNIX standard open/close/read/write
|
||||
// but FD is int64_t and will never be reused
|
||||
int64_t tfOpen(const char *pathname, int32_t flags);
|
||||
int64_t tfOpenM(const char *pathname, int32_t flags, mode_t mode);
|
||||
int64_t tfOpenReadWrite(const char *pathname);
|
||||
int64_t tfOpenCreateWrite(const char *pathname);
|
||||
int64_t tfOpenCreateWriteAppend(const char *pathname);
|
||||
|
||||
int64_t tfClose(int64_t tfd);
|
||||
int64_t tfWrite(int64_t tfd, void *buf, int64_t count);
|
||||
int64_t tfRead(int64_t tfd, void *buf, int64_t count);
|
||||
|
@ -42,4 +44,4 @@ int32_t tfFtruncate(int64_t tfd, int64_t length);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TFILE_H
|
||||
#endif /*_TD_UTIL_FILE_H*/
|
|
@ -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/>.
|
||||
*/
|
||||
#ifndef TD_TFUNCTIONAL_H
|
||||
#define TD_TFUNCTIONAL_H
|
||||
#ifndef _TD_UTIL_FUNCTIONAL_H
|
||||
#define _TD_UTIL_FUNCTIONAL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -53,4 +53,4 @@ void voidInvoke(tVoidSavedFunc* const pSavedFunc);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_UTIL_FUNCTIONAL_H*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TIDPOOL_H
|
||||
#define TDENGINE_TIDPOOL_H
|
||||
#ifndef _TD_UTIL_IDPOOL_H
|
||||
#define _TD_UTIL_IDPOOL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -40,4 +40,4 @@ bool taosIdPoolMarkStatus(void *handle, int id);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_UTIL_IDPOOL_H*/
|
|
@ -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/>.
|
||||
*/
|
||||
#ifndef TDENGINE_TKEY_H
|
||||
#define TDENGINE_TKEY_H
|
||||
#ifndef _TD_UTIL_KEY_H
|
||||
#define _TD_UTIL_KEY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -28,4 +28,4 @@ char * taosDesDecode(int64_t key, char *src, int len);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_UTIL_KEY_H*/
|
|
@ -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/>.
|
||||
*/
|
||||
#ifndef _TD_LIST_
|
||||
#define _TD_LIST_
|
||||
#ifndef _TD_UTIL_LIST_H
|
||||
#define _TD_UTIL_LIST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -69,4 +69,4 @@ SListNode *tdListNext(SListIter *pIter);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_UTIL_LIST_H*/
|
|
@ -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/>.
|
||||
*/
|
||||
#ifndef __TD_LOCK_FREE_H__
|
||||
#define __TD_LOCK_FREE_H__
|
||||
#ifndef _TD_UTIL_LOCK_FREE_H
|
||||
#define _TD_UTIL_LOCK_FREE_H
|
||||
|
||||
#include "os.h"
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
// reference counting
|
||||
typedef void (*_ref_fn_t)(const void* pObj);
|
||||
|
||||
|
@ -106,9 +105,8 @@ void taosRUnLockLatch(SRWLatch *pLatch);
|
|||
break; \
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_UTIL_LOCK_FREE_H*/
|
||||
|
|
|
@ -13,13 +13,37 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TLOG_H
|
||||
#define TDENGINE_TLOG_H
|
||||
#ifndef _TD_UTIL_LOG_H
|
||||
#define _TD_UTIL_LOG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// log
|
||||
extern int8_t tsAsyncLog;
|
||||
extern int32_t tsNumOfLogLines;
|
||||
extern int32_t tsLogKeepDays;
|
||||
extern int32_t dDebugFlag;
|
||||
extern int32_t vDebugFlag;
|
||||
extern int32_t mDebugFlag;
|
||||
extern int32_t cDebugFlag;
|
||||
extern int32_t jniDebugFlag;
|
||||
extern int32_t tmrDebugFlag;
|
||||
extern int32_t sdbDebugFlag;
|
||||
extern int32_t httpDebugFlag;
|
||||
extern int32_t mqttDebugFlag;
|
||||
extern int32_t monDebugFlag;
|
||||
extern int32_t uDebugFlag;
|
||||
extern int32_t rpcDebugFlag;
|
||||
extern int32_t odbcDebugFlag;
|
||||
extern int32_t qDebugFlag;
|
||||
extern int32_t wDebugFlag;
|
||||
extern int32_t sDebugFlag;
|
||||
extern int32_t tsdbDebugFlag;
|
||||
extern int32_t cqDebugFlag;
|
||||
extern int32_t debugFlag;
|
||||
|
||||
#define DEBUG_FATAL 1U
|
||||
#define DEBUG_ERROR DEBUG_FATAL
|
||||
#define DEBUG_WARN 2U
|
||||
|
@ -53,4 +77,4 @@ void taosDumpData(unsigned char *msg, int32_t len);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_UTIL_LOG_H*/
|
||||
|
|
|
@ -13,15 +13,13 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TLOSERTREE_H
|
||||
#define TDENGINE_TLOSERTREE_H
|
||||
#ifndef _TD_UTIL_LOSERTREE_H
|
||||
#define _TD_UTIL_LOSERTREE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef int (*__merge_compare_fn_t)(const void *, const void *, void *param);
|
||||
|
||||
typedef struct SLoserTreeNode {
|
||||
|
@ -51,4 +49,4 @@ void tLoserTreeDisplay(SLoserTreeInfo *pTree);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TLOSERTREE_H
|
||||
#endif /*_TD_UTIL_LOSERTREE_H*/
|
|
@ -22,10 +22,8 @@
|
|||
***********************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _taos_md5_header_
|
||||
#define _taos_md5_header_
|
||||
|
||||
#include <stdint.h>
|
||||
#ifndef _TD_UTIL_MD5_H
|
||||
#define _TD_UTIL_MD5_H
|
||||
|
||||
typedef struct {
|
||||
uint32_t i[2]; /* number of _bits_ handled mod 2^64 */
|
||||
|
@ -38,4 +36,4 @@ void MD5Init(MD5_CTX *mdContext);
|
|||
void MD5Update(MD5_CTX *mdContext, uint8_t *inBuf, unsigned int inLen);
|
||||
void MD5Final(MD5_CTX *mdContext);
|
||||
|
||||
#endif
|
||||
#endif /*_TD_UTIL_MD5_H*/
|
|
@ -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/>.
|
||||
*/
|
||||
#ifndef TDENGINE_TMEMPOOL_H
|
||||
#define TDENGINE_TMEMPOOL_H
|
||||
#ifndef _TD_UTIL_MEMPOOL_H
|
||||
#define _TD_UTIL_MEMPOOL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -33,4 +33,4 @@ void taosMemPoolCleanUp(mpool_h handle);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_UTIL_MEMPOOL_H*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TNOTE_H
|
||||
#define TDENGINE_TNOTE_H
|
||||
#ifndef _TD_UTIL_NOTE_H
|
||||
#define _TD_UTIL_NOTE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -61,4 +61,4 @@ void taosNotePrintBuffer(SNoteObj *pNote, char *buffer, int32_t len);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_UTIL_NOTE_H*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TAOS_QUEUE_H
|
||||
#define TAOS_QUEUE_H
|
||||
#ifndef _TD_UTIL_QUEUE_H
|
||||
#define _TD_UTIL_QUEUE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -71,6 +71,6 @@ int taosGetQsetItemsNumber(taos_qset param);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_UTIL_QUEUE_H*/
|
||||
|
||||
|
|
@ -14,8 +14,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TREF_H
|
||||
#define TDENGINE_TREF_H
|
||||
#ifndef _TD_UTIL_REF_H
|
||||
#define _TD_UTIL_REF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -74,4 +74,4 @@ void demoIterateRefs(int rsetId) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TREF_H
|
||||
#endif /*_TD_UTIL_REF_H*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TSCHED_H
|
||||
#define TDENGINE_TSCHED_H
|
||||
#ifndef _TD_UTIL_SCHED_H
|
||||
#define _TD_UTIL_SCHED_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -68,4 +68,4 @@ void taosScheduleTask(void *queueScheduler, SSchedMsg *pMsg);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TSCHED_H
|
||||
#endif /*_TD_UTIL_SCHED_H*/
|
|
@ -13,14 +13,14 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TSCOMPRESSION_H
|
||||
#define TDENGINE_TSCOMPRESSION_H
|
||||
#ifndef _TD_UTIL_COMPRESSION_H
|
||||
#define _TD_UTIL_COMPRESSION_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "taosdef.h"
|
||||
#include "tdef.h"
|
||||
#include "tutil.h"
|
||||
|
||||
#define COMP_OVERFLOW_BYTES 2
|
||||
|
@ -366,4 +366,4 @@ static FORCE_INLINE int tsDecompressTimestamp(const char *const input, int compr
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TSCOMPRESSION_H
|
||||
#endif /*_TD_UTIL_COMPRESSION_H*/
|
|
@ -13,15 +13,15 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TSKIPLIST_H
|
||||
#define TDENGINE_TSKIPLIST_H
|
||||
#ifndef _TD_UTIL_SKILIST_H
|
||||
#define _TD_UTIL_SKILIST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "os.h"
|
||||
#include "taosdef.h"
|
||||
#include "tdef.h"
|
||||
#include "tarray.h"
|
||||
#include "tfunctional.h"
|
||||
|
||||
|
@ -159,4 +159,4 @@ void tSkipListRemoveNode(SSkipList *pSkipList, SSkipListNode *pNod
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TSKIPLIST_H
|
||||
#endif /*_TD_UTIL_SKILIST_H*/
|
|
@ -13,22 +13,24 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_OS_DIR_H
|
||||
#define TDENGINE_OS_DIR_H
|
||||
#ifndef _TD_UTIL_STEP_H_
|
||||
#define _TD_UTIL_STEP_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void taosRemoveDir(char *rootDir);
|
||||
bool taosDirExist(const char* dirname);
|
||||
int32_t taosMkDir(const char *pathname, mode_t mode);
|
||||
void taosRemoveOldLogFiles(char *rootDir, int32_t keepDays);
|
||||
int32_t taosRename(char *oldName, char *newName);
|
||||
int32_t taosCompressFile(char *srcFileName, char *destFileName);
|
||||
typedef int32_t (*InitFp)(void **obj);
|
||||
typedef void (*CleanupFp)(void **obj);
|
||||
typedef void (*ReportFp)(char *name, char *desc);
|
||||
|
||||
struct SSteps *taosStepInit(int32_t maxsize, ReportFp fp);
|
||||
int32_t taosStepExec(struct SSteps *steps);
|
||||
void taosStepCleanup(struct SSteps *steps);
|
||||
int32_t taosStepAdd(struct SSteps *steps, char *name, void **obj, InitFp initFp, CleanupFp cleanupFp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_UTIL_STEP_H_*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_STRING_BUILDER_H
|
||||
#define TDENGINE_STRING_BUILDER_H
|
||||
#ifndef _TD_UTIL_STRING_BUILDER_H
|
||||
#define _TD_UTIL_STRING_BUILDER_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
@ -49,4 +49,4 @@ void taosStringBuilderAppendDouble(SStringBuilder* sb, double v);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_UTIL_STRING_BUILDER_H*/
|
|
@ -13,15 +13,15 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TTHREAD_H
|
||||
#define TDENGINE_TTHREAD_H
|
||||
#ifndef _TD_UTIL_THREAD_H
|
||||
#define _TD_UTIL_THREAD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "os.h"
|
||||
#include "taosdef.h"
|
||||
#include "tdef.h"
|
||||
|
||||
// create new thread
|
||||
pthread_t* taosCreateThread( void *(*__start_routine) (void *), void* param);
|
||||
|
@ -34,4 +34,4 @@ bool taosThreadRunning(pthread_t* pthread);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TTHREAD_H
|
||||
#endif /*_TD_UTIL_THREAD_H*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TTIMER_H
|
||||
#define TDENGINE_TTIMER_H
|
||||
#ifndef _TD_UTIL_TIMER_H
|
||||
#define _TD_UTIL_TIMER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -48,4 +48,4 @@ void taosUninitTimer();
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TTIMER_H
|
||||
#endif /*_TD_UTIL_TIMER_H*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TUTIL_H
|
||||
#define TDENGINE_TUTIL_H
|
||||
#ifndef _TD_UTIL_UTIL_H
|
||||
#define _TD_UTIL_UTIL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -23,7 +23,7 @@ extern "C" {
|
|||
#include "os.h"
|
||||
#include "tmd5.h"
|
||||
#include "tcrc32c.h"
|
||||
#include "taosdef.h"
|
||||
#include "tdef.h"
|
||||
|
||||
int32_t strdequote(char *src);
|
||||
int32_t strRmquote(char *z, int32_t len);
|
||||
|
@ -58,4 +58,4 @@ static FORCE_INLINE void taosEncryptPass(uint8_t *inBuf, size_t inLen, char *tar
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_TUTIL_H
|
||||
#endif /*_TD_UTIL_UTIL_H*/
|
|
@ -13,30 +13,33 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TWORKER_H
|
||||
#define TDENGINE_TWORKER_H
|
||||
#ifndef _TD_UTIL_WORKER_H
|
||||
#define _TD_UTIL_WORKER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void *(*FWorkerThread)(void *pWorker);
|
||||
typedef int32_t (*ProcessReqFp)(void *ahandle, void *msg);
|
||||
typedef void (*SendRspFp)(void *ahandle, void *msg, int32_t qtype, int32_t code);
|
||||
|
||||
struct SWorkerPool;
|
||||
|
||||
typedef struct {
|
||||
pthread_t thread; // thread
|
||||
int32_t id; // worker ID
|
||||
struct SWorkerPool *pPool;
|
||||
pthread_t thread; // thread
|
||||
int32_t id; // worker ID
|
||||
struct SWorkerPool *pool;
|
||||
} SWorker;
|
||||
|
||||
typedef struct SWorkerPool {
|
||||
int32_t max; // max number of workers
|
||||
int32_t min; // min number of workers
|
||||
int32_t num; // current number of workers
|
||||
void * qset;
|
||||
char * name;
|
||||
SWorker *worker;
|
||||
FWorkerThread workerFp;
|
||||
int32_t max; // max number of workers
|
||||
int32_t min; // min number of workers
|
||||
int32_t num; // current number of workers
|
||||
void * qset;
|
||||
const char * name;
|
||||
SWorker * workers;
|
||||
ProcessReqFp reqFp;
|
||||
SendRspFp rspFp;
|
||||
pthread_mutex_t mutex;
|
||||
} SWorkerPool;
|
||||
|
||||
|
@ -49,4 +52,4 @@ void tWorkerFreeQueue(SWorkerPool *pPool, void *pQueue);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_UTIL_WORKER_H*/
|
|
@ -13,8 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_COMMON_ULOG_H
|
||||
#define TDENGINE_COMMON_ULOG_H
|
||||
#ifndef _TD_UTIL_ULOG_H
|
||||
#define _TD_UTIL_ULOG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -39,4 +39,4 @@ extern int8_t tscEmbedded;
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /*_TD_UTIL_ULOG_H*/
|
|
@ -4,4 +4,9 @@ target_include_directories(
|
|||
common
|
||||
PUBLIC "${CMAKE_SOURCE_DIR}/include/common"
|
||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
|
||||
)
|
||||
target_link_libraries(
|
||||
common
|
||||
PUBLIC os
|
||||
PUBLIC util
|
||||
)
|
|
@ -13,7 +13,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "tdataformat.h"
|
||||
#include "tulog.h"
|
||||
#include "ulog.h"
|
||||
#include "talgo.h"
|
||||
#include "tcoding.h"
|
||||
#include "wchar.h"
|
|
@ -23,7 +23,9 @@
|
|||
#include "tarray.h"
|
||||
#include "tbuffer.h"
|
||||
#include "tcompare.h"
|
||||
#include "tsdb.h"
|
||||
#include "tname.h"
|
||||
#include "hash.h"
|
||||
// #include "tsdb.h"
|
||||
#include "tskiplist.h"
|
||||
#include "texpr.h"
|
||||
#include "tarithoperator.h"
|
|
@ -17,15 +17,14 @@
|
|||
#include "os.h"
|
||||
#include "taosdef.h"
|
||||
#include "taoserror.h"
|
||||
#include "tulog.h"
|
||||
#include "ulog.h"
|
||||
#include "tlog.h"
|
||||
#include "tconfig.h"
|
||||
#include "tglobal.h"
|
||||
#include "monitor.h"
|
||||
#include "tsocket.h"
|
||||
#include "tutil.h"
|
||||
#include "tlocale.h"
|
||||
#include "ttimezone.h"
|
||||
#include "tcompare.h"
|
||||
#include "tutil.h"
|
||||
#include "ttimezone.h"
|
||||
#include "tlocale.h"
|
||||
|
||||
// cluster
|
||||
char tsFirst[TSDB_EP_LEN] = {0};
|
||||
|
@ -59,9 +58,6 @@ float tsNumOfThreadsPerCore = 1.0f;
|
|||
int32_t tsNumOfCommitThreads = 4;
|
||||
float tsRatioOfQueryCores = 1.0f;
|
||||
int8_t tsDaylight = 0;
|
||||
char tsTimezone[TSDB_TIMEZONE_LEN] = {0};
|
||||
char tsLocale[TSDB_LOCALE_LEN] = {0};
|
||||
char tsCharset[TSDB_LOCALE_LEN] = {0}; // default encode string
|
||||
int8_t tsEnableCoreFile = 0;
|
||||
int32_t tsMaxBinaryDisplayWidth = 30;
|
||||
|
||||
|
@ -201,15 +197,11 @@ int8_t tsEnableStream = 1;
|
|||
int8_t tsCompactMnodeWal = 0;
|
||||
int8_t tsPrintAuth = 0;
|
||||
int8_t tscEmbedded = 0;
|
||||
char configDir[PATH_MAX] = {0};
|
||||
char tsVnodeDir[PATH_MAX] = {0};
|
||||
char tsDnodeDir[PATH_MAX] = {0};
|
||||
char tsMnodeDir[PATH_MAX] = {0};
|
||||
char tsMnodeTmpDir[PATH_MAX] = {0};
|
||||
char tsMnodeBakDir[PATH_MAX] = {0};
|
||||
char tsDataDir[PATH_MAX] = {0};
|
||||
char tsScriptDir[PATH_MAX] = {0};
|
||||
char tsTempDir[PATH_MAX] = "/tmp/";
|
||||
|
||||
int32_t tsDiskCfgNum = 0;
|
||||
int32_t tsTopicBianryLen = 16000;
|
||||
|
@ -229,11 +221,6 @@ SDiskCfg tsDiskCfg[TSDB_MAX_DISKS];
|
|||
int64_t tsTickPerDay[] = {86400000L, 86400000000L, 86400000000000L};
|
||||
|
||||
// system info
|
||||
char tsOsName[10] = "Linux";
|
||||
int64_t tsPageSize;
|
||||
int64_t tsOpenMax;
|
||||
int64_t tsStreamMax;
|
||||
int32_t tsNumOfCores = 1;
|
||||
float tsTotalTmpDirGB = 0;
|
||||
float tsTotalDataDirGB = 0;
|
||||
float tsAvailTmpDirectorySpace = 0;
|
||||
|
@ -244,28 +231,6 @@ float tsMinimalDataDirGB = 2.0f;
|
|||
int32_t tsTotalMemoryMB = 0;
|
||||
uint32_t tsVersion = 0;
|
||||
|
||||
// log
|
||||
int32_t tsNumOfLogLines = 10000000;
|
||||
int32_t mDebugFlag = 131;
|
||||
int32_t sdbDebugFlag = 131;
|
||||
int32_t dDebugFlag = 135;
|
||||
int32_t vDebugFlag = 135;
|
||||
uint32_t cDebugFlag = 131;
|
||||
int32_t jniDebugFlag = 131;
|
||||
int32_t odbcDebugFlag = 131;
|
||||
int32_t httpDebugFlag = 131;
|
||||
int32_t mqttDebugFlag = 131;
|
||||
int32_t monDebugFlag = 131;
|
||||
uint32_t qDebugFlag = 131;
|
||||
int32_t rpcDebugFlag = 131;
|
||||
int32_t uDebugFlag = 131;
|
||||
int32_t debugFlag = 0;
|
||||
int32_t sDebugFlag = 135;
|
||||
int32_t wDebugFlag = 135;
|
||||
int32_t tsdbDebugFlag = 131;
|
||||
int32_t cqDebugFlag = 131;
|
||||
int32_t fsDebugFlag = 135;
|
||||
|
||||
#ifdef TD_TSZ
|
||||
//
|
||||
// lossy compress 6
|
||||
|
@ -419,23 +384,6 @@ static void taosCheckDataDirCfg() {
|
|||
}
|
||||
}
|
||||
|
||||
static int32_t taosCheckTmpDir(void) {
|
||||
if (strlen(tsTempDir) <= 0){
|
||||
uError("tempDir is not set");
|
||||
return -1;
|
||||
}
|
||||
|
||||
DIR *dir = opendir(tsTempDir);
|
||||
if (dir == NULL) {
|
||||
uError("can not open tempDir:%s, error:%s", tsTempDir, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void doInitGlobalConfig(void) {
|
||||
osInit();
|
||||
srand(taosSafeRand());
|
||||
|
@ -1096,7 +1044,7 @@ static void doInitGlobalConfig(void) {
|
|||
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW | TSDB_CFG_CTYPE_B_CLIENT;
|
||||
cfg.minValue = 0;
|
||||
cfg.maxValue = 0;
|
||||
cfg.ptrLength = tListLen(tsTimezone);
|
||||
cfg.ptrLength = TSDB_TIMEZONE_LEN;
|
||||
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
||||
taosInitConfigOption(cfg);
|
||||
|
||||
|
@ -1106,7 +1054,7 @@ static void doInitGlobalConfig(void) {
|
|||
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW | TSDB_CFG_CTYPE_B_CLIENT;
|
||||
cfg.minValue = 0;
|
||||
cfg.maxValue = 0;
|
||||
cfg.ptrLength = tListLen(tsLocale);
|
||||
cfg.ptrLength = TSDB_LOCALE_LEN;
|
||||
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
||||
taosInitConfigOption(cfg);
|
||||
|
||||
|
@ -1116,7 +1064,7 @@ static void doInitGlobalConfig(void) {
|
|||
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW | TSDB_CFG_CTYPE_B_CLIENT;
|
||||
cfg.minValue = 0;
|
||||
cfg.maxValue = 0;
|
||||
cfg.ptrLength = tListLen(tsCharset);
|
||||
cfg.ptrLength = TSDB_LOCALE_LEN;
|
||||
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
||||
taosInitConfigOption(cfg);
|
||||
|
||||
|
@ -1612,7 +1560,7 @@ static void doInitGlobalConfig(void) {
|
|||
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT;
|
||||
cfg.minValue = 0;
|
||||
cfg.maxValue = 0;
|
||||
cfg.ptrLength = tListLen(tsTempDir);
|
||||
cfg.ptrLength = PATH_MAX;
|
||||
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
||||
taosInitConfigOption(cfg);
|
||||
|
||||
|
@ -1732,7 +1680,7 @@ int32_t taosCheckGlobalCfg() {
|
|||
|
||||
taosCheckDataDirCfg();
|
||||
|
||||
if (taosCheckTmpDir()) {
|
||||
if (!taosDirExist(tsTempDir)) {
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#define _DEFAULT_SOURCE
|
||||
#include "os.h"
|
||||
#include "tulog.h"
|
||||
#include "ulog.h"
|
||||
#include "tglobal.h"
|
||||
#include "tconfig.h"
|
||||
#include "tutil.h"
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "os.h"
|
||||
#include "taosdef.h"
|
||||
#include "ttime.h"
|
||||
#include "tutil.h"
|
||||
|
||||
/*
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#define _DEFAULT_SOURCE
|
||||
#include "os.h"
|
||||
#include "tulog.h"
|
||||
#include "ulog.h"
|
||||
#include "tglobal.h"
|
||||
#include "tconfig.h"
|
||||
#include "tutil.h"
|
|
@ -17,6 +17,7 @@
|
|||
#include "hash.h"
|
||||
#include "taos.h"
|
||||
#include "taosdef.h"
|
||||
#include "ttime.h"
|
||||
#include "ttoken.h"
|
||||
#include "ttokendef.h"
|
||||
#include "ttype.h"
|
|
@ -4,4 +4,12 @@ target_include_directories(
|
|||
transport
|
||||
PUBLIC "${CMAKE_SOURCE_DIR}/include/libs/transport"
|
||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
transport
|
||||
PUBLIC lz4_static
|
||||
PUBLIC os
|
||||
PUBLIC util
|
||||
PUBLIC common
|
||||
)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue