mndInt.h 2.0 KB
Newer Older
H
refact  
Hongze Cheng 已提交
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/>.
 */

S
Shengliang Guan 已提交
16 17
#ifndef _TD_MND_INT_H_
#define _TD_MND_INT_H_
H
refact  
Hongze Cheng 已提交
18

S
Shengliang Guan 已提交
19
#include "mndDef.h"
S
Shengliang Guan 已提交
20
#include "sdb.h"
S
Shengliang Guan 已提交
21
#include "tstep.h"
S
Shengliang Guan 已提交
22

H
refact  
Hongze Cheng 已提交
23 24 25 26
#ifdef __cplusplus
extern "C" {
#endif

S
Shengliang Guan 已提交
27
typedef int32_t (*MndMsgFp)(SMnode *pMnode, SMnodeMsg *pMsg);
S
Shengliang Guan 已提交
28

S
Shengliang Guan 已提交
29
typedef struct SMnodeBak {
S
Shengliang Guan 已提交
30 31 32 33 34 35 36
  int32_t   dnodeId;
  int64_t   clusterId;
  tmr_h     timer;
  SSteps   *pInitSteps;
  SSteps   *pStartSteps;
  SMnodeOpt para;
  MndMsgFp  msgFp[TSDB_MSG_TYPE_MAX];
S
Shengliang Guan 已提交
37 38
} SMnodeBak;

S
Shengliang Guan 已提交
39
typedef struct SMnode {
S
Shengliang Guan 已提交
40 41 42 43 44 45 46 47
  int32_t           dnodeId;
  int64_t           clusterId;
  int8_t            replica;
  int8_t            selfIndex;
  SReplica          replicas[TSDB_MAX_REPLICA];
  tmr_h             timer;
  SSteps           *pInitSteps;
  SSteps           *pStartSteps;
S
Shengliang Guan 已提交
48
  struct SSdb      *pSdb;
S
Shengliang Guan 已提交
49
  struct SDnode    *pServer;
S
Shengliang Guan 已提交
50
  MndMsgFp          msgFp[TSDB_MSG_TYPE_MAX];
S
Shengliang Guan 已提交
51 52 53 54
  PutMsgToMnodeQFp  putMsgToApplyMsgFp;
  SendMsgToDnodeFp  sendMsgToDnodeFp;
  SendMsgToMnodeFp  sendMsgToMnodeFp;
  SendRedirectMsgFp sendRedirectMsgFp;
S
Shengliang Guan 已提交
55
} SMnode;
S
Shengliang Guan 已提交
56

S
Shengliang Guan 已提交
57 58 59
tmr_h   mnodeGetTimer();
int32_t mnodeGetDnodeId();
int64_t mnodeGetClusterId();
S
Shengliang Guan 已提交
60

S
Shengliang Guan 已提交
61 62 63
void mnodeSendMsgToDnode(SMnode *pMnode, struct SEpSet *epSet, struct SRpcMsg *rpcMsg);
void mnodeSendMsgToMnode(SMnode *pMnode, struct SRpcMsg *rpcMsg);
void mnodeSendRedirectMsg(SMnode *pMnode, struct SRpcMsg *rpcMsg, bool forShell);
S
Shengliang Guan 已提交
64
void mnodeSetMsgHandle(SMnode *pMnode, int32_t msgType, MndMsgFp fp);
S
Shengliang Guan 已提交
65

H
refact  
Hongze Cheng 已提交
66 67 68 69
#ifdef __cplusplus
}
#endif

S
Shengliang Guan 已提交
70
#endif /*_TD_MND_INT_H_*/