cmdnodes.h 5.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * 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/>.
 */

16 17
#ifndef _TD_CMD_NODES_H_
#define _TD_CMD_NODES_H_
18 19 20 21 22

#ifdef __cplusplus
extern "C" {
#endif

X
Xiaoyu Wang 已提交
23
#include "querynodes.h"
24

25
typedef struct SDatabaseOptions {
X
Xiaoyu Wang 已提交
26
  ENodeType type;
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
  int32_t numOfBlocks;
  int32_t cacheBlockSize;
  int8_t cachelast;
  int32_t compressionLevel;
  int32_t daysPerFile;
  int32_t fsyncPeriod;
  int32_t maxRowsPerBlock;
  int32_t minRowsPerBlock;
  int32_t keep;
  int32_t precision;
  int32_t quorum;
  int32_t replica;
  int32_t ttl;
  int32_t walLevel;
  int32_t numOfVgroups;
  int8_t singleStable;
  int8_t streamMode;
} SDatabaseOptions;
45

46 47 48 49
typedef struct SCreateDatabaseStmt {
  ENodeType type;
  char dbName[TSDB_DB_NAME_LEN];
  bool ignoreExists;
X
Xiaoyu Wang 已提交
50
  SDatabaseOptions* pOptions;
51
} SCreateDatabaseStmt;
52

53 54 55 56 57
typedef struct SUseDatabaseStmt {
  ENodeType type;
  char dbName[TSDB_DB_NAME_LEN];
} SUseDatabaseStmt;

58 59 60 61 62 63
typedef struct SDropDatabaseStmt {
  ENodeType type;
  char dbName[TSDB_DB_NAME_LEN];
  bool ignoreNotExists;
} SDropDatabaseStmt;

64 65 66 67 68 69
typedef struct SAlterDatabaseStmt {
  ENodeType type;
  char dbName[TSDB_DB_NAME_LEN];
  SDatabaseOptions* pOptions;
} SAlterDatabaseStmt;

X
Xiaoyu Wang 已提交
70
typedef struct STableOptions {
X
Xiaoyu Wang 已提交
71
  ENodeType type;
X
Xiaoyu Wang 已提交
72 73 74
  int32_t keep;
  int32_t ttl;
  char comments[TSDB_STB_COMMENT_LEN];
75
  SNodeList* pSma;
X
Xiaoyu Wang 已提交
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
} STableOptions;

typedef struct SColumnDefNode {
  ENodeType type;
  char colName[TSDB_COL_NAME_LEN];
  SDataType dataType;
  char comments[TSDB_STB_COMMENT_LEN];
} SColumnDefNode;

typedef struct SCreateTableStmt {
  ENodeType type;
  char dbName[TSDB_DB_NAME_LEN];
  char tableName[TSDB_TABLE_NAME_LEN];
  bool ignoreExists;
  SNodeList* pCols;
91
  SNodeList* pTags;
X
Xiaoyu Wang 已提交
92
  STableOptions* pOptions;
X
Xiaoyu Wang 已提交
93 94
} SCreateTableStmt;

95
typedef struct SCreateSubTableClause {
96 97 98 99 100 101 102 103
  ENodeType type;
  char dbName[TSDB_DB_NAME_LEN];
  char tableName[TSDB_TABLE_NAME_LEN];
  char useDbName[TSDB_DB_NAME_LEN];
  char useTableName[TSDB_TABLE_NAME_LEN];
  bool ignoreExists;
  SNodeList* pSpecificTags;
  SNodeList* pValsOfTags;
104
} SCreateSubTableClause;
105 106 107 108 109

typedef struct SCreateMultiTableStmt {
  ENodeType type;
  SNodeList* pSubTables;
} SCreateMultiTableStmt;
X
Xiaoyu Wang 已提交
110

111 112 113 114 115 116 117 118 119 120 121 122
typedef struct SDropTableClause {
  ENodeType type;
  char dbName[TSDB_DB_NAME_LEN];
  char tableName[TSDB_TABLE_NAME_LEN];
  bool ignoreNotExists;
} SDropTableClause;

typedef struct SDropTableStmt {
  ENodeType type;
  SNodeList* pTables;
} SDropTableStmt;

123 124 125 126 127 128 129
typedef struct SDropSuperTableStmt {
  ENodeType type;
  char dbName[TSDB_DB_NAME_LEN];
  char tableName[TSDB_TABLE_NAME_LEN];
  bool ignoreNotExists;
} SDropSuperTableStmt;

130 131 132 133
typedef struct SAlterTableStmt {
  ENodeType type;
  char dbName[TSDB_DB_NAME_LEN];
  char tableName[TSDB_TABLE_NAME_LEN];
134 135 136 137 138 139
  int8_t alterType;
  char colName[TSDB_COL_NAME_LEN];
  char newColName[TSDB_COL_NAME_LEN];
  STableOptions* pOptions;
  SDataType dataType;
  SValueNode* pVal;
140 141
} SAlterTableStmt;

142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
typedef struct SCreateUserStmt {
  ENodeType type;
  char useName[TSDB_USER_LEN];
  char password[TSDB_USET_PASSWORD_LEN];
} SCreateUserStmt;

typedef struct SAlterUserStmt {
  ENodeType type;
  char useName[TSDB_USER_LEN];
  char password[TSDB_USET_PASSWORD_LEN];
  int8_t alterType;
} SAlterUserStmt;

typedef struct SDropUserStmt {
  ENodeType type;
  char useName[TSDB_USER_LEN];
} SDropUserStmt;

typedef struct SCreateDnodeStmt {
  ENodeType type;
  char fqdn[TSDB_FQDN_LEN];
  int32_t port;
} SCreateDnodeStmt;

typedef struct SDropDnodeStmt {
  ENodeType type;
  int32_t dnodeId;
  char fqdn[TSDB_FQDN_LEN];
  int32_t port;
} SDropDnodeStmt;

173 174 175 176 177 178 179
typedef struct SAlterDnodeStmt {
  ENodeType type;
  int32_t dnodeId;
  char config[TSDB_DNODE_CONFIG_LEN];
  char value[TSDB_DNODE_VALUE_LEN];
} SAlterDnodeStmt;

180 181
typedef struct SShowStmt {
  ENodeType type;
X
Xiaoyu Wang 已提交
182 183
  SNode* pDbName;        // SValueNode
  SNode* pTbNamePattern; // SValueNode
184 185
} SShowStmt;

X
Xiaoyu Wang 已提交
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
typedef enum EIndexType {
  INDEX_TYPE_SMA = 1,
  INDEX_TYPE_FULLTEXT
} EIndexType;

typedef struct SIndexOptions {
  ENodeType type;
  SNodeList* pFuncs;
  SNode* pInterval;
  SNode* pOffset;
  SNode* pSliding;
} SIndexOptions;

typedef struct SCreateIndexStmt {
  ENodeType type;
  EIndexType indexType;
X
Xiaoyu Wang 已提交
202
  bool ignoreExists;
X
Xiaoyu Wang 已提交
203 204 205 206 207 208
  char indexName[TSDB_INDEX_NAME_LEN];
  char tableName[TSDB_TABLE_NAME_LEN];
  SNodeList* pCols;
  SIndexOptions* pOptions;
} SCreateIndexStmt;

209 210
typedef struct SDropIndexStmt {
  ENodeType type;
X
Xiaoyu Wang 已提交
211
  bool ignoreNotExists;
212 213 214 215
  char indexName[TSDB_INDEX_NAME_LEN];
  char tableName[TSDB_TABLE_NAME_LEN];
} SDropIndexStmt;

X
Xiaoyu Wang 已提交
216 217 218 219 220
typedef struct SCreateQnodeStmt {
  ENodeType type;
  int32_t dnodeId;
} SCreateQnodeStmt;

221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
typedef struct SDropQnodeStmt {
  ENodeType type;
  int32_t dnodeId;
} SDropQnodeStmt;

typedef struct SCreateTopicStmt {
  ENodeType type;
  char topicName[TSDB_TABLE_NAME_LEN];
  char subscribeDbName[TSDB_DB_NAME_LEN];
  bool ignoreExists;
  SNode* pQuery;
} SCreateTopicStmt;

typedef struct SDropTopicStmt {
  ENodeType type;
  char topicName[TSDB_TABLE_NAME_LEN];
  bool ignoreNotExists;
} SDropTopicStmt;

240 241 242 243 244 245
typedef struct SAlterLocalStmt {
  ENodeType type;
  char config[TSDB_DNODE_CONFIG_LEN];
  char value[TSDB_DNODE_VALUE_LEN];
} SAlterLocalStmt;

246 247 248 249
#ifdef __cplusplus
}
#endif

250
#endif /*_TD_CMD_NODES_H_*/