提交 36086393 编写于 作者: S Shengliang Guan

shm

上级 c8a4d491
...@@ -41,17 +41,17 @@ typedef struct SDnodeMgmt { ...@@ -41,17 +41,17 @@ typedef struct SDnodeMgmt {
SDnode *pDnode; SDnode *pDnode;
} SDnodeMgmt; } SDnodeMgmt;
// dmFile.h
void dmGetMnodeEpSet(SDnode *pDnode, SEpSet *pEpSet);
// dmHandle.h
void dmProcessStartupReq(SDnode *pDnode, SRpcMsg *pMsg);
// dmInt.h // dmInt.h
SMgmtFp dmGetMgmtFp(); SMgmtFp dmGetMgmtFp();
int32_t dmGetDnodeId(SDnode *pDnode); int32_t dmGetDnodeId(SDnode *pDnode);
int64_t dmGetClusterId(SDnode *pDnode); int64_t dmGetClusterId(SDnode *pDnode);
// dmMgmt.h
void dmGetMnodeEpSet(SDnode *pDnode, SEpSet *pEpSet);
// dmHandle.h
void dmProcessStartupReq(SDnode *pDnode, SRpcMsg *pMsg);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -22,12 +22,10 @@ ...@@ -22,12 +22,10 @@
extern "C" { extern "C" {
#endif #endif
int32_t dmInitMgmt(SDnode *pDnode); int32_t dmInit(SMgmtWrapper *pWrapper);
void dmStopMgmt(SDnode *pDnode); void dmCleanup(SMgmtWrapper *pWrapper);
void dmCleanupMgmt(SDnode *pDnode); bool dmRequire(SMgmtWrapper *pWrapper);
int32_t dmGetDnodeId(SDnode *pDnode);
int64_t dmGetClusterId(SDnode *pDnode);
void dmGetDnodeEp(SDnode *pDnode, int32_t dnodeId, char *pEp, char *pFqdn, uint16_t *pPort); void dmGetDnodeEp(SDnode *pDnode, int32_t dnodeId, char *pEp, char *pFqdn, uint16_t *pPort);
void dmGetMnodeEpSet(SDnode *pDnode, SEpSet *pEpSet); void dmGetMnodeEpSet(SDnode *pDnode, SEpSet *pEpSet);
......
/*
* 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/>.
*/
#define _DEFAULT_SOURCE
#include "dmInt.h"
#include "dmHandle.h"
#include "dmMgmt.h"
int32_t dmGetDnodeId(SDnode *pDnode) {
SMgmtWrapper *pWrapper = dndGetWrapper(pDnode, DNODE);
SDnodeMgmt *pMgmt = pWrapper->pMgmt;
taosRLockLatch(&pMgmt->latch);
int32_t dnodeId = pMgmt->dnodeId;
taosRUnLockLatch(&pMgmt->latch);
return dnodeId;
}
int64_t dmGetClusterId(SDnode *pDnode) {
SMgmtWrapper *pWrapper = dndGetWrapper(pDnode, DNODE);
SDnodeMgmt *pMgmt = pWrapper->pMgmt;
taosRLockLatch(&pMgmt->latch);
int64_t clusterId = pMgmt->clusterId;
taosRUnLockLatch(&pMgmt->latch);
return clusterId;
}
SMgmtFp dmGetMgmtFp() {
SMgmtFp mgmtFp = {0};
mgmtFp.openFp = dmInit;
mgmtFp.closeFp = dmCleanup;
mgmtFp.requiredFp = dmRequire;
mgmtFp.getMsgHandleFp = dmGetMsgHandle;
return mgmtFp;
}
...@@ -38,22 +38,6 @@ static void dndProcessStatusRsp(SDnode *pDnode, SRpcMsg *pRsp); ...@@ -38,22 +38,6 @@ static void dndProcessStatusRsp(SDnode *pDnode, SRpcMsg *pRsp);
static void dndProcessAuthRsp(SDnode *pDnode, SRpcMsg *pRsp); static void dndProcessAuthRsp(SDnode *pDnode, SRpcMsg *pRsp);
static void dndProcessGrantRsp(SDnode *pDnode, SRpcMsg *pRsp); static void dndProcessGrantRsp(SDnode *pDnode, SRpcMsg *pRsp);
int32_t dmGetDnodeId(SDnode *pDnode) {
SDnodeMgmt *pMgmt = &pDnode->dmgmt;
taosRLockLatch(&pMgmt->latch);
int32_t dnodeId = pMgmt->dnodeId;
taosRUnLockLatch(&pMgmt->latch);
return dnodeId;
}
int64_t dmGetClusterId(SDnode *pDnode) {
SDnodeMgmt *pMgmt = &pDnode->dmgmt;
taosRLockLatch(&pMgmt->latch);
int64_t clusterId = pMgmt->clusterId;
taosRUnLockLatch(&pMgmt->latch);
return clusterId;
}
void dmGetDnodeEp(SDnode *pDnode, int32_t dnodeId, char *pEp, char *pFqdn, uint16_t *pPort) { void dmGetDnodeEp(SDnode *pDnode, int32_t dnodeId, char *pEp, char *pFqdn, uint16_t *pPort) {
SDnodeMgmt *pMgmt = &pDnode->dmgmt; SDnodeMgmt *pMgmt = &pDnode->dmgmt;
taosRLockLatch(&pMgmt->latch); taosRLockLatch(&pMgmt->latch);
...@@ -289,7 +273,7 @@ void dmGetMnodeEpSet(SDnode *pDnode, SEpSet *pEpSet) {} ...@@ -289,7 +273,7 @@ void dmGetMnodeEpSet(SDnode *pDnode, SEpSet *pEpSet) {}
void dmProcessStartupReq(SDnode *pDnode, SRpcMsg *pReq){} void dmProcessStartupReq(SDnode *pDnode, SRpcMsg *pReq){}
void dmProcessMgmtMsg(SDnode *pDnode, SMgmtWrapper *pWrapper, SNodeMsg *pMsg){} void dmProcessMgmtMsg(SDnode *pDnode, SMgmtWrapper *pWrapper, SNodeMsg *pMsg){}
static int32_t dmInit(SMgmtWrapper *pWrapper) { int32_t dmInit(SMgmtWrapper *pWrapper) {
SDnodeMgmt *pMgmt = calloc(1, sizeof(SDnodeMgmt)); SDnodeMgmt *pMgmt = calloc(1, sizeof(SDnodeMgmt));
pMgmt->dnodeId = 0; pMgmt->dnodeId = 0;
...@@ -352,17 +336,6 @@ static int32_t dmInit(SMgmtWrapper *pWrapper) { ...@@ -352,17 +336,6 @@ static int32_t dmInit(SMgmtWrapper *pWrapper) {
#endif #endif
} }
static void dmCleanup(SMgmtWrapper *pWrapper){ void dmCleanup(SMgmtWrapper *pWrapper) {}
} bool dmRequire(SMgmtWrapper *pWrapper) { return true; }
static bool dmRequire(SMgmtWrapper *pWrapper) { return true; }
SMgmtFp dmGetMgmtFp() {
SMgmtFp mgmtFp = {0};
mgmtFp.openFp = dmInit;
mgmtFp.closeFp = dmCleanup;
mgmtFp.requiredFp = dmRequire;
mgmtFp.getMsgHandleFp = dmGetMsgHandle;
return mgmtFp;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册