dmInt.h 1.8 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
shm  
Shengliang Guan 已提交
19
#include "dm.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
shm  
Shengliang Guan 已提交
36 37 38
  const char   *path;
  SDnode       *pDnode;
  SMgmtWrapper *pWrapper;
S
shm  
Shengliang Guan 已提交
39 40
} SDnodeMgmt;

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

S
shm  
Shengliang Guan 已提交
46 47 48 49 50 51 52 53
// dmMsg.c
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);

// dmWorker.c
S
shm  
Shengliang Guan 已提交
54
int32_t dmStartWorker(SDnodeMgmt *pMgmt);
S
shm  
Shengliang Guan 已提交
55
void    dmStopWorker(SDnodeMgmt *pMgmt);
S
shm  
Shengliang Guan 已提交
56
int32_t dmStartThread(SDnodeMgmt *pMgmt);
S
Shengliang Guan 已提交
57
int32_t dmProcessMgmtMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg);
S
shm  
Shengliang Guan 已提交
58

59 60 61 62
#ifdef __cplusplus
}
#endif

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