dmInt.h 2.1 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/>.
 */

S
shm  
Shengliang Guan 已提交
16 17
#ifndef _TD_DND_DNODE_INT_H_
#define _TD_DND_DNODE_INT_H_
S
Shengliang Guan 已提交
18

S
Shengliang Guan 已提交
19
#include "dndInt.h"
20 21 22 23

#ifdef __cplusplus
extern "C" {
#endif
S
Shengliang Guan 已提交
24

S
shm  
Shengliang Guan 已提交
25
typedef struct SDnodeMgmt {
S
shm  
Shengliang Guan 已提交
26 27 28 29 30 31
  int64_t       dver;
  int64_t       updateTime;
  int8_t        statusSent;
  SEpSet        mnodeEpSet;
  SHashObj     *dnodeHash;
  SArray       *dnodeEps;
S
Shengliang Guan 已提交
32
  TdThread     *threadId;
S
shm  
Shengliang Guan 已提交
33
  SRWLatch      latch;
S
Shengliang Guan 已提交
34
  SSingleWorker mgmtWorker;
35
  SSingleWorker monitorWorker;
S
Shengliang Guan 已提交
36
  SMsgCb        msgCb;
S
shm  
Shengliang Guan 已提交
37 38 39
  const char   *path;
  SDnode       *pDnode;
  SMgmtWrapper *pWrapper;
S
shm  
Shengliang Guan 已提交
40 41
} SDnodeMgmt;

S
shm  
Shengliang Guan 已提交
42 43 44 45
// dmFile.c
int32_t dmReadFile(SDnodeMgmt *pMgmt);
int32_t dmWriteFile(SDnodeMgmt *pMgmt);
void    dmUpdateDnodeEps(SDnodeMgmt *pMgmt, SArray *pDnodeEps);
S
shm  
Shengliang Guan 已提交
46

S
Shengliang Guan 已提交
47
// dmHandle.c
S
Shengliang Guan 已提交
48
void    dmInitMsgHandle(SMgmtWrapper *pWrapper);
S
shm  
Shengliang Guan 已提交
49 50 51 52 53
void    dmSendStatusReq(SDnodeMgmt *pMgmt);
int32_t dmProcessConfigReq(SDnodeMgmt *pMgmt, SNodeMsg *pMsg);
int32_t dmProcessStatusRsp(SDnodeMgmt *pMgmt, SNodeMsg *pMsg);
int32_t dmProcessAuthRsp(SDnodeMgmt *pMgmt, SNodeMsg *pMsg);
int32_t dmProcessGrantRsp(SDnodeMgmt *pMgmt, SNodeMsg *pMsg);
S
Shengliang Guan 已提交
54
int32_t dmProcessCDnodeReq(SDnode *pDnode, SNodeMsg *pMsg);
S
shm  
Shengliang Guan 已提交
55

S
Shengliang Guan 已提交
56
// dmMonitor.c
57 58
void dmGetVnodeLoads(SMgmtWrapper *pWrapper, SMonVloadInfo *pInfo);
void dmSendMonitorReport(SDnode *pDnode);
S
Shengliang Guan 已提交
59

S
shm  
Shengliang Guan 已提交
60
// dmWorker.c
S
Shengliang Guan 已提交
61
int32_t dmStartThread(SDnodeMgmt *pMgmt);
S
shm  
Shengliang Guan 已提交
62
int32_t dmStartWorker(SDnodeMgmt *pMgmt);
S
shm  
Shengliang Guan 已提交
63
void    dmStopWorker(SDnodeMgmt *pMgmt);
S
Shengliang Guan 已提交
64
int32_t dmProcessMgmtMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg);
65
int32_t dmProcessMonitorMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg);
S
shm  
Shengliang Guan 已提交
66

67 68 69 70
#ifdef __cplusplus
}
#endif

S
shm  
Shengliang Guan 已提交
71
#endif /*_TD_DND_DNODE_INT_H_*/