TDengine/include/dnode/mnode/mnode.h

103 lines
2.4 KiB
C
Raw Normal View History

2021-09-22 05:21:07 +00:00
/*
* 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/>.
*/
2021-11-27 15:02:20 +00:00
#ifndef _TD_MND_H_
#define _TD_MND_H_
2021-09-22 05:21:07 +00:00
2022-03-02 09:48:39 +00:00
#include "monitor.h"
2022-03-24 03:34:43 +00:00
#include "tmsg.h"
2022-03-21 11:08:25 +00:00
#include "tmsgcb.h"
2022-03-24 03:34:43 +00:00
#include "trpc.h"
2022-03-02 09:48:39 +00:00
2021-09-22 05:21:07 +00:00
#ifdef __cplusplus
extern "C" {
#endif
2021-11-20 16:13:35 +00:00
/* ------------------------ TYPES EXPOSED ------------------------ */
2022-03-21 11:08:25 +00:00
typedef struct SMnode SMnode;
2021-11-05 07:42:19 +00:00
typedef struct {
2022-04-01 08:36:36 +00:00
bool deploy;
2022-03-21 11:08:25 +00:00
int8_t replica;
int8_t selfIndex;
SReplica replicas[TSDB_MAX_REPLICA];
SMsgCb msgCb;
2021-11-26 08:28:38 +00:00
} SMnodeOpt;
2021-11-20 16:13:35 +00:00
/* ------------------------ SMnode ------------------------ */
/**
* @brief Open a mnode.
*
2021-11-29 12:24:16 +00:00
* @param path Path of the mnode.
* @param pOption Option of the mnode.
* @return SMnode* The mnode object.
2021-11-20 16:13:35 +00:00
*/
2021-11-29 04:09:18 +00:00
SMnode *mndOpen(const char *path, const SMnodeOpt *pOption);
2021-11-20 16:13:35 +00:00
/**
2021-11-29 12:24:16 +00:00
* @brief Close a mnode.
2021-11-20 16:13:35 +00:00
*
2021-11-29 12:24:16 +00:00
* @param pMnode The mnode object to close.
2021-11-20 16:13:35 +00:00
*/
2021-11-29 04:09:18 +00:00
void mndClose(SMnode *pMnode);
2021-11-20 16:13:35 +00:00
/**
2021-11-29 12:24:16 +00:00
* @brief Close a mnode.
2021-11-20 16:13:35 +00:00
*
2021-11-29 12:24:16 +00:00
* @param pMnode The mnode object to close.
* @param pOption Options of the mnode.
* @return int32_t 0 for success, -1 for failure.
2021-11-20 16:13:35 +00:00
*/
2021-11-29 04:09:18 +00:00
int32_t mndAlter(SMnode *pMnode, const SMnodeOpt *pOption);
2021-11-20 16:13:35 +00:00
/**
2022-03-19 16:25:37 +00:00
* @brief Start mnode
2021-11-20 16:13:35 +00:00
*
2022-03-19 16:25:37 +00:00
* @param pMnode The mnode object.
2021-11-20 16:13:35 +00:00
*/
2022-03-19 16:25:37 +00:00
int32_t mndStart(SMnode *pMnode);
2022-04-13 07:52:14 +00:00
void mndStop(SMnode *pMnode);
2021-11-20 16:13:35 +00:00
/**
2022-03-02 09:48:39 +00:00
* @brief Get mnode monitor info.
2021-11-20 16:13:35 +00:00
*
2021-11-29 12:24:16 +00:00
* @param pMnode The mnode object.
2022-04-14 10:28:05 +00:00
* @param pCluster
* @param pVgroup
* @param pGrant
2021-11-29 12:24:16 +00:00
* @return int32_t 0 for success, -1 for failure.
2021-11-20 16:13:35 +00:00
*/
2022-04-14 10:28:05 +00:00
int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pCluster, SMonVgroupInfo *pVgroup, SMonGrantInfo *pGrant);
2022-04-19 13:39:42 +00:00
int32_t mndGetLoad(SMnode *pMnode, SMnodeLoad *pLoad);
2021-11-04 12:24:34 +00:00
2021-11-20 16:13:35 +00:00
/**
2021-12-28 09:38:15 +00:00
* @brief Process the read, write, sync request.
2021-11-20 16:13:35 +00:00
*
2021-11-29 12:24:16 +00:00
* @param pMsg The request msg.
* @return int32_t 0 for success, -1 for failure.
2021-11-20 16:13:35 +00:00
*/
2022-05-16 06:55:31 +00:00
int32_t mndProcessMsg(SRpcMsg *pMsg);
2021-11-20 16:13:35 +00:00
2022-04-14 05:44:40 +00:00
/**
* @brief Generate machine code
*/
void mndGenerateMachineCode();
2021-09-22 05:21:07 +00:00
#ifdef __cplusplus
}
#endif
2021-11-27 15:02:20 +00:00
#endif /*_TD_MND_H_*/