TDengine/include/dnode/mnode/mnode.h

111 lines
2.6 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-03-21 11:08:25 +00:00
int32_t dnodeId;
int64_t clusterId;
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);
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-03-02 09:48:39 +00:00
* @param pClusterInfo
* @param pVgroupInfo
* @param pGrantInfo
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-03-02 09:48:39 +00:00
int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgroupInfo *pVgroupInfo,
SMonGrantInfo *pGrantInfo);
2021-09-22 12:29:24 +00:00
2021-11-20 16:13:35 +00:00
/**
2021-11-29 12:24:16 +00:00
* @brief Get user authentication info.
2021-11-20 16:13:35 +00:00
*
2021-11-29 12:24:16 +00:00
* @param pMnode The mnode object.
2021-11-20 16:13:35 +00:00
* @param user
* @param spi
* @param encrypt
* @param secret
* @param ckey
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
*/
2021-11-29 04:09:18 +00:00
int32_t mndRetriveAuth(SMnode *pMnode, char *user, char *spi, char *encrypt, char *secret, char *ckey);
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-03-15 12:53:29 +00:00
int32_t mndProcessMsg(SNodeMsg *pMsg);
2021-11-20 16:13:35 +00:00
2021-09-22 05:21:07 +00:00
#ifdef __cplusplus
}
#endif
2021-11-27 15:02:20 +00:00
#endif /*_TD_MND_H_*/