mnode.h 1.9 KB
Newer Older
H
hzcheng 已提交
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/>.
 */

16 17
#ifndef TDENGINE_MNODE_H
#define TDENGINE_MNODE_H
H
hzcheng 已提交
18 19 20 21 22

#ifdef __cplusplus
extern "C" {
#endif

S
Shengliang Guan 已提交
23 24
#include "trpc.h"

25 26 27 28 29 30 31
struct SAcctObj;
struct SDnodeObj;
struct SUserObj;
struct SDbObj;
struct SVgObj;
struct STableObj;

S
Shengliang Guan 已提交
32
typedef struct {
S
Shengliang Guan 已提交
33 34
  int32_t len;
  void *  rsp;
S
Shengliang Guan 已提交
35 36
} SMnodeRsp;

37
typedef struct SMnodeMsg {
S
TD-1915  
Shengliang Guan 已提交
38 39 40 41 42 43 44
  struct SAcctObj * pAcct;
  struct SDnodeObj *pDnode;
  struct SUserObj * pUser;
  struct SDbObj *   pDb;
  struct SVgObj *   pVgroup;
  struct STableObj *pTable;
  struct SSTableObj*pSTable;
S
Shengliang Guan 已提交
45
  SMnodeRsp rpcRsp;
46 47 48 49
  int8_t    received;
  int8_t    successed;
  int8_t    expected;
  int8_t    retry;
S
TD-1793  
Shengliang Guan 已提交
50
  int32_t   incomingTs;
51
  int32_t   code;
S
Shengliang Guan 已提交
52
  void *    pObj;
S
TD-1915  
Shengliang Guan 已提交
53
  SRpcMsg   rpcMsg;
S
TD-1915  
Shengliang Guan 已提交
54
  char      pCont[];
S
Shengliang Guan 已提交
55 56
} SMnodeMsg;

S
TD-1915  
Shengliang Guan 已提交
57
void *  mnodeCreateMsg(SRpcMsg *pRpcMsg);
58 59
int32_t mnodeInitMsg(SMnodeMsg *pMsg);
void    mnodeCleanupMsg(SMnodeMsg *pMsg);
S
Shengliang Guan 已提交
60

61 62 63
int32_t mnodeInitSystem();
int32_t mnodeStartSystem();
void    mnodeCleanupSystem();
S
Shengliang Guan 已提交
64
void    mnodeStopSystem();
S
TD-1671  
Shengliang Guan 已提交
65
void    sdbUpdateAsync();
S
TD-1671  
Shengliang Guan 已提交
66
void    sdbUpdateSync(void *pMnodes);
S
Shengliang Guan 已提交
67 68 69
bool    mnodeIsRunning();
int32_t mnodeProcessRead(SMnodeMsg *pMsg);
int32_t mnodeProcessWrite(SMnodeMsg *pMsg);
70
int32_t mnodeProcessPeerReq(SMnodeMsg *pMsg);
S
Shengliang Guan 已提交
71
void    mnodeProcessPeerRsp(SRpcMsg *pMsg);
72
int32_t mnodeRetriveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey);
S
Shengliang Guan 已提交
73

H
hzcheng 已提交
74 75 76 77
#ifdef __cplusplus
}
#endif

S
#1177  
slguan 已提交
78
#endif