TDengine/source/dnode/mnode/impl/inc/mndInt.h

108 lines
2.9 KiB
C
Raw Normal View History

2021-09-22 09:27:48 +00:00
/*
* 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/>.
*/
2021-11-27 15:02:20 +00:00
#ifndef _TD_MND_INT_H_
#define _TD_MND_INT_H_
2021-09-22 09:27:48 +00:00
2021-11-27 14:56:18 +00:00
#include "mndDef.h"
2021-11-09 06:27:17 +00:00
#include "sdb.h"
2021-12-02 11:56:43 +00:00
#include "tcache.h"
2021-12-29 07:10:50 +00:00
#include "tep.h"
2021-11-29 04:09:18 +00:00
#include "tqueue.h"
2021-12-09 08:47:23 +00:00
#include "ttime.h"
2021-10-16 07:16:05 +00:00
2021-09-22 09:27:48 +00:00
#ifdef __cplusplus
extern "C" {
#endif
2021-12-03 07:01:26 +00:00
typedef int32_t (*MndMsgFp)(SMnodeMsg *pMsg);
2021-11-29 04:09:18 +00:00
typedef int32_t (*MndInitFp)(SMnode *pMnode);
typedef void (*MndCleanupFp)(SMnode *pMnode);
2021-12-03 06:36:41 +00:00
typedef int32_t (*ShowMetaFp)(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *pMeta);
typedef int32_t (*ShowRetrieveFp)(SMnodeMsg *pMsg, SShowObj *pShow, char *data, int32_t rows);
2021-12-02 11:56:43 +00:00
typedef void (*ShowFreeIterFp)(SMnode *pMnode, void *pIter);
2021-11-19 06:46:06 +00:00
2021-11-29 04:09:18 +00:00
typedef struct {
const char *name;
MndInitFp initFp;
MndCleanupFp cleanupFp;
} SMnodeStep;
2021-11-19 09:15:24 +00:00
2021-12-02 11:56:43 +00:00
typedef struct {
int32_t showId;
ShowMetaFp metaFps[TSDB_MGMT_TABLE_MAX];
ShowRetrieveFp retrieveFps[TSDB_MGMT_TABLE_MAX];
ShowFreeIterFp freeIterFps[TSDB_MGMT_TABLE_MAX];
SCacheObj *cache;
} SShowMgmt;
2021-12-03 06:36:41 +00:00
typedef struct {
int32_t connId;
SCacheObj *cache;
} SProfileMgmt;
2021-12-06 11:57:13 +00:00
typedef struct {
int8_t enable;
pthread_mutex_t lock;
pthread_cond_t cond;
volatile int32_t exit;
pthread_t thread;
char email[TSDB_FQDN_LEN];
} STelemMgmt;
2021-12-25 06:40:43 +00:00
typedef struct {
int32_t errCode;
sem_t syncSem;
SSyncNode *pSyncNode;
ESyncState state;
} SSyncMgmt;
2021-11-19 06:46:06 +00:00
typedef struct SMnode {
2021-11-20 16:13:35 +00:00
int32_t dnodeId;
2021-12-27 02:57:31 +00:00
int64_t clusterId;
2021-11-20 16:13:35 +00:00
int8_t replica;
int8_t selfIndex;
SReplica replicas[TSDB_MAX_REPLICA];
tmr_h timer;
2021-12-26 15:46:22 +00:00
tmr_h transTimer;
2021-11-29 11:35:42 +00:00
char *path;
2021-12-06 11:57:13 +00:00
SMnodeCfg cfg;
int64_t checkTime;
2021-11-29 04:09:18 +00:00
SSdb *pSdb;
SDnode *pDnode;
2021-11-29 11:35:42 +00:00
SArray *pSteps;
2021-12-02 11:56:43 +00:00
SShowMgmt showMgmt;
2021-12-03 06:36:41 +00:00
SProfileMgmt profileMgmt;
2021-12-06 11:57:13 +00:00
STelemMgmt telemMgmt;
2021-12-25 06:40:43 +00:00
SSyncMgmt syncMgmt;
2021-12-24 07:00:51 +00:00
MndMsgFp msgFp[TDMT_MAX];
2021-11-19 09:15:24 +00:00
SendMsgToDnodeFp sendMsgToDnodeFp;
SendMsgToMnodeFp sendMsgToMnodeFp;
SendRedirectMsgFp sendRedirectMsgFp;
2021-11-19 06:46:06 +00:00
} SMnode;
2021-11-02 09:46:47 +00:00
2021-11-29 04:09:18 +00:00
void mndSendMsgToDnode(SMnode *pMnode, SEpSet *pEpSet, SRpcMsg *rpcMsg);
void mndSendMsgToMnode(SMnode *pMnode, SRpcMsg *pMsg);
void mndSendRedirectMsg(SMnode *pMnode, SRpcMsg *pMsg);
void mndSetMsgHandle(SMnode *pMnode, tmsg_t msgType, MndMsgFp fp);
2021-11-11 09:31:52 +00:00
2021-12-12 02:46:49 +00:00
uint64_t mndGenerateUid(char *name, int32_t len) ;
2021-09-22 09:27:48 +00:00
#ifdef __cplusplus
}
#endif
2021-11-27 15:02:20 +00:00
#endif /*_TD_MND_INT_H_*/