提交 63861e65 编写于 作者: S Shengliang Guan

shm

上级 2f7cdcd9
......@@ -16,7 +16,7 @@
#ifndef _TD_DND_BNODE_HANDLE_H_
#define _TD_DND_BNODE_HANDLE_H_
#include "mmInt.h"
#include "mm.h"
#ifdef __cplusplus
extern "C" {
......
......@@ -22,7 +22,7 @@
extern "C" {
#endif
// dndInt.h
// dndInt.c
int32_t dndInit();
void dndCleanup();
const char *dndStatStr(EDndStatus stat);
......@@ -30,14 +30,14 @@ void dndGetStartup(SDnode *pDnode, SStartupReq *pStartup);
TdFilePtr dndCheckRunning(char *dataDir);
void dndProcessStartupReq(SDnode *pDnode, SRpcMsg *pMsg);
// dndNode.h
// dndNode.c
SDnode *dndCreate(const SDnodeOpt *pOption);
void dndClose(SDnode *pDnode);
int32_t dndRun(SDnode *pDnode);
void dndHandleEvent(SDnode *pDnode, EDndEvent event);
void dndProcessRpcMsg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg, SEpSet *pEpSet);
// dndTransport.h
// dndTransport.c
int32_t dndInitServer(SDnode *pDnode);
void dndCleanupServer(SDnode *pDnode);
int32_t dndInitClient(SDnode *pDnode);
......
......@@ -17,7 +17,7 @@
#include "dndInt.h"
#include "dmInt.h"
#include "mmInt.h"
#include "mm.h"
#include "vmInt.h"
static int32_t dndGetMonitorDiskInfo(SDnode *pDnode, SMonDiskInfo *pInfo) {
......
......@@ -18,7 +18,7 @@
#include "bmInt.h"
#include "dmInt.h"
#include "mmInt.h"
#include "mm.h"
#include "qmInt.h"
#include "smInt.h"
#include "vmInt.h"
......
......@@ -17,7 +17,7 @@
#include "dndInt.h"
#include "dmInt.h"
#include "mmInt.h"
#include "mm.h"
#define INTERNAL_USER "_dnd"
#define INTERNAL_CKEY "_key"
......
......@@ -22,11 +22,12 @@
extern "C" {
#endif
void dmGetMgmtFp(SMgmtWrapper *pWrapper);
void dmGetMgmtFp(SMgmtWrapper *pWrapper);
void dmInitMsgHandles(SMgmtWrapper *pWrapper);
void dmGetMnodeEpSet(SMgmtWrapper *pWrapper, SEpSet *pEpSet);
void dmUpdateMnodeEpSet(SMgmtWrapper *pWrapper, SEpSet *pEpSet);
void dmSendRedirectRsp(SMgmtWrapper *pWrapper, SRpcMsg *pMsg);
void dmInitMsgHandles(SMgmtWrapper *pWrapper);
int32_t dmStart(SMgmtWrapper *pWrapper);
#ifdef __cplusplus
......
......@@ -43,8 +43,6 @@ int32_t dmReadFile(SDnodeMgmt *pMgmt);
int32_t dmWriteFile(SDnodeMgmt *pMgmt);
void dmUpdateDnodeEps(SDnodeMgmt *pMgmt, SArray *pDnodeEps);
// dmInt.c
// dmMsg.c
void dmSendStatusReq(SDnodeMgmt *pMgmt);
int32_t dmProcessConfigReq(SDnodeMgmt *pMgmt, SNodeMsg *pMsg);
......
......@@ -17,7 +17,7 @@
#include "dmInt.h"
#include "bmInt.h"
#include "mmInt.h"
#include "mm.h"
#include "qmInt.h"
#include "smInt.h"
#include "vmInt.h"
......@@ -62,9 +62,6 @@ static void dmProcessQueue(SDnode *pDnode, SNodeMsg *pMsg) {
case TDMT_DND_CREATE_MNODE:
code = mmProcessCreateReq(dndGetWrapper(pDnode, MNODE)->pMgmt, pMsg);
break;
case TDMT_DND_ALTER_MNODE:
code = mmProcessAlterReq(dndGetWrapper(pDnode, MNODE)->pMgmt, pMsg);
break;
case TDMT_DND_DROP_MNODE:
code = mmProcessDropReq(dndGetWrapper(pDnode, MNODE)->pMgmt, pMsg);
break;
......
......@@ -13,23 +13,27 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_DND_MNODE_MSG_H_
#define _TD_DND_MNODE_MSG_H_
#ifndef _TD_DND_MNODE_H_
#define _TD_DND_MNODE_H_
#include "mmInt.h"
#include "dnd.h"
#ifdef __cplusplus
extern "C" {
#endif
void mmGetMgmtFp(SMgmtWrapper *pMgmt);
void mmInitMsgHandles(SMgmtWrapper *pWrapper);
// int32_t mmProcessCreateReq(SDnode *pDnode, SRpcMsg *pRpcMsg);
// int32_t mmProcessAlterReq(SDnode *pDnode, SRpcMsg *pRpcMsg);
// int32_t mmProcessDropReq(SDnode *pDnode, SRpcMsg *pRpcMsg);
int32_t mmProcessCreateReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg);
int32_t mmProcessDropReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg);
int32_t mmGetUserAuth(SMgmtWrapper *pWrapper, char *user, char *spi, char *encrypt, char *secret, char *ckey);
int32_t mmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonClusterInfo *pClusterInfo, SMonVgroupInfo *pVgroupInfo,
SMonGrantInfo *pGrantInfo);
#ifdef __cplusplus
}
#endif
#endif /*_TD_DND_MNODE_MSG_H_*/
\ No newline at end of file
#endif /*_TD_DND_MNODE_H_*/
\ No newline at end of file
/*
* 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/>.
*/
#ifndef _TD_DND_MNODE_FILE_H_
#define _TD_DND_MNODE_FILE_H_
#include "mmInt.h"
#ifdef __cplusplus
extern "C" {
#endif
int32_t mmReadFile(SMnodeMgmt *pMgmt);
int32_t mmWriteFile(SMnodeMgmt *pMgmt);
#ifdef __cplusplus
}
#endif
#endif /*_TD_DND_MNODE_FILE_H_*/
\ No newline at end of file
......@@ -16,7 +16,7 @@
#ifndef _TD_DND_MNODE_INT_H_
#define _TD_DND_MNODE_INT_H_
#include "dnd.h"
#include "mm.h"
#ifdef __cplusplus
extern "C" {
......@@ -39,13 +39,11 @@ typedef struct SMnodeMgmt {
SDnodeWorker syncWorker;
} SMnodeMgmt;
// interface
void mmGetMgmtFp(SMgmtWrapper *pMgmt);
int32_t mmGetUserAuth(SMgmtWrapper *pWrapper, char *user, char *spi, char *encrypt, char *secret, char *ckey);
int32_t mmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonClusterInfo *pClusterInfo, SMonVgroupInfo *pVgroupInfo,
SMonGrantInfo *pGrantInfo);
// mmFile.c
int32_t mmReadFile(SMnodeMgmt *pMgmt);
int32_t mmWriteFile(SMnodeMgmt *pMgmt);
// mmInt.h
// mmInt.c
SMnode *mmAcquire(SMnodeMgmt *pMgmt);
void mmRelease(SMnodeMgmt *pMgmt, SMnode *pMnode);
int32_t mmOpen(SMnodeMgmt *pMgmt, SMnodeOpt *pOption);
......@@ -53,10 +51,18 @@ int32_t mmAlter(SMnodeMgmt *pMgmt, SMnodeOpt *pOption);
int32_t mmDrop(SMnodeMgmt *pMgmt);
int32_t mmBuildOptionFromReq(SMnodeMgmt *pMgmt, SMnodeOpt *pOption, SDCreateMnodeReq *pCreate);
// mmHandle.h
int32_t mmProcessCreateReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg);
// mmMsg.c
int32_t mmProcessAlterReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg);
int32_t mmProcessDropReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg);
// mmWorker.c
int32_t mmStartWorker(SMnodeMgmt *pMgmt);
void mmStopWorker(SMnodeMgmt *pMgmt);
int32_t mmProcessWriteMsg(SMnodeMgmt *pMgmt, SNodeMsg *pMsg);
int32_t mmProcessSyncMsg(SMnodeMgmt *pMgmt, SNodeMsg *pMsg);
int32_t mmProcessReadMsg(SMnodeMgmt *pMgmt, SNodeMsg *pMsg);
int32_t mmPutMsgToWriteQueue(void *wrapper, SRpcMsg *pRpcMsg);
int32_t mmPutMsgToReadQueue(void *wrapper, SRpcMsg *pRpcMsg);
#ifdef __cplusplus
}
......
/*
* 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/>.
*/
#ifndef _TD_DND_MNODE_WORKER_H_
#define _TD_DND_MNODE_WORKER_H_
#include "mmInt.h"
#ifdef __cplusplus
extern "C" {
#endif
int32_t mmStartWorker(SMnodeMgmt *pMgmt);
void mmStopWorker(SMnodeMgmt *pMgmt);
int32_t mmProcessWriteMsg(SMnodeMgmt *pMgmt, SNodeMsg *pMsg);
int32_t mmProcessSyncMsg(SMnodeMgmt *pMgmt, SNodeMsg *pMsg);
int32_t mmProcessReadMsg(SMnodeMgmt *pMgmt, SNodeMsg *pMsg);
int32_t mmPutMsgToWriteQueue(void *wrapper, SRpcMsg *pRpcMsg);
int32_t mmPutMsgToReadQueue(void *wrapper, SRpcMsg *pRpcMsg);
#ifdef __cplusplus
}
#endif
#endif /*_TD_DND_MNODE_WORKER_H_*/
\ No newline at end of file
......@@ -14,7 +14,7 @@
*/
#define _DEFAULT_SOURCE
#include "mmFile.h"
#include "mmInt.h"
int32_t mmReadFile(SMnodeMgmt *pMgmt) {
int32_t code = TSDB_CODE_DND_MNODE_READ_FILE_ERROR;
......
......@@ -15,10 +15,8 @@
#define _DEFAULT_SOURCE
#include "mmInt.h"
#include "dmInt.h"
#include "mmFile.h"
#include "mmMsg.h"
#include "mmWorker.h"
SMnode *mmAcquire(SMnodeMgmt *pMgmt) {
SMnode *pMnode = NULL;
......
......@@ -14,9 +14,8 @@
*/
#define _DEFAULT_SOURCE
#include "mmMsg.h"
#include "mmInt.h"
#include "dmInt.h"
#include "mmWorker.h"
int32_t mmProcessCreateReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg) {
SDnode *pDnode = pMgmt->pDnode;
......@@ -181,6 +180,7 @@ void mmInitMsgHandles(SMgmtWrapper *pWrapper) {
dndSetMsgHandle(pWrapper, TDMT_MND_KILL_TRANS, (NodeMsgFp)mmProcessWriteMsg);
dndSetMsgHandle(pWrapper, TDMT_MND_GRANT, (NodeMsgFp)mmProcessWriteMsg);
dndSetMsgHandle(pWrapper, TDMT_MND_AUTH, (NodeMsgFp)mmProcessReadMsg);
dndSetMsgHandle(pWrapper, TDMT_DND_ALTER_MNODE, (NodeMsgFp)mmProcessWriteMsg);
dndSetMsgHandle(pWrapper, TDMT_MND_CREATE_TOPIC, (NodeMsgFp)mmProcessWriteMsg);
dndSetMsgHandle(pWrapper, TDMT_MND_ALTER_TOPIC, (NodeMsgFp)mmProcessWriteMsg);
dndSetMsgHandle(pWrapper, TDMT_MND_DROP_TOPIC, (NodeMsgFp)mmProcessWriteMsg);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册