dmInt.h 2.2 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 "dnd.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 35
  SSingleWorker mgmtWorker;
  SSingleWorker statusWorker;
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
Shengliang Guan 已提交
42 43 44 45 46 47
// dmInt.c
void dmSetMgmtFp(SMgmtWrapper *pWrapper);
void dmGetMnodeEpSet(SDnodeMgmt *pMgmt, SEpSet *pEpSet);
void dmUpdateMnodeEpSet(SDnodeMgmt *pMgmt, SEpSet *pEpSet);
void dmSendRedirectRsp(SDnodeMgmt *pMgmt, const SRpcMsg *pMsg);

S
shm  
Shengliang Guan 已提交
48 49 50 51
// dmFile.c
int32_t dmReadFile(SDnodeMgmt *pMgmt);
int32_t dmWriteFile(SDnodeMgmt *pMgmt);
void    dmUpdateDnodeEps(SDnodeMgmt *pMgmt, SArray *pDnodeEps);
S
shm  
Shengliang Guan 已提交
52

S
Shengliang Guan 已提交
53
// dmHandle.c
S
Shengliang Guan 已提交
54
void    dmInitMsgHandle(SMgmtWrapper *pWrapper);
S
shm  
Shengliang Guan 已提交
55 56 57 58 59
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 已提交
60
int32_t dmProcessCDnodeMsg(SDnode *pDnode, SNodeMsg *pMsg);
S
shm  
Shengliang Guan 已提交
61 62

// dmWorker.c
S
Shengliang Guan 已提交
63
int32_t dmStartThread(SDnodeMgmt *pMgmt);
S
shm  
Shengliang Guan 已提交
64
int32_t dmStartWorker(SDnodeMgmt *pMgmt);
S
shm  
Shengliang Guan 已提交
65
void    dmStopWorker(SDnodeMgmt *pMgmt);
S
Shengliang Guan 已提交
66 67
int32_t dmPutMsgToMgmtWorker(SMgmtWrapper *pWrapper, SNodeMsg *pMsg);
int32_t dmPutMsgToStatusWorker(SMgmtWrapper *pWrapper, SNodeMsg *pMsg);
S
shm  
Shengliang Guan 已提交
68

69 70 71 72
#ifdef __cplusplus
}
#endif

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