mnode.h 2.0 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;
45
  struct SMnodeMsg *pBatchMasterMsg;
S
Shengliang Guan 已提交
46
  SMnodeRsp rpcRsp;
47 48 49 50
  int16_t   received;
  int16_t   successed;
  int16_t   expected;
  int16_t   retry;
S
TD-1793  
Shengliang Guan 已提交
51
  int32_t   incomingTs;
52
  int32_t   code;
S
Shengliang Guan 已提交
53
  void *    pObj;
S
TD-1915  
Shengliang Guan 已提交
54
  SRpcMsg   rpcMsg;
S
TD-1915  
Shengliang Guan 已提交
55
  char      pCont[];
S
Shengliang Guan 已提交
56 57
} SMnodeMsg;

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

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

H
hzcheng 已提交
76 77 78 79
#ifdef __cplusplus
}
#endif

S
#1177  
slguan 已提交
80
#endif