TDengine/include/server/vnode/vnode.h

107 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-09-22 12:29:24 +00:00
*/
#ifndef _TD_VNODE_H_
#define _TD_VNODE_H_
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
/**
* Send messages to other dnodes, such as create vnode message.
*
* @param epSet, the endpoint list of dnodes.
* @param rpcMsg, message to be sent.
*/
2021-10-05 05:16:54 +00:00
void (*SendMsgToDnode)(struct SRpcEpSet *epSet, struct SRpcMsg *rpcMsg);
/**
* Send messages to mnode, such as config message.
*
* @param rpcMsg, message to be sent.
*/
2021-10-05 05:16:54 +00:00
void (*SendMsgToMnode)(struct SRpcMsg *rpcMsg);
/**
* Get the corresponding endpoint information from dnodeId.
*
* @param dnodeId, the id ot dnode.
* @param ep, the endpoint of dnode.
* @param fqdn, the fqdn of dnode.
* @param port, the port of dnode.
*/
2021-10-05 05:16:54 +00:00
void (*GetDnodeEp)(int32_t dnodeId, char *ep, char *fqdn, uint16_t *port);
} SVnodeFp;
typedef struct {
SVnodeFp fp;
} SVnodePara;
2021-09-22 12:29:24 +00:00
/**
* Start initialize vnode module.
2021-09-22 12:29:24 +00:00
*
* @param para, initialization parameters.
2021-10-05 05:16:54 +00:00
* @return Error code.
2021-09-22 12:29:24 +00:00
*/
2021-10-05 05:16:54 +00:00
int32_t vnodeInit(SVnodePara para);
2021-09-22 12:29:24 +00:00
/**
* Cleanup vnode module.
2021-09-22 12:29:24 +00:00
*/
2021-10-05 05:16:54 +00:00
void vnodeCleanup();
2021-09-22 12:29:24 +00:00
typedef struct {
int32_t unused;
2021-09-22 12:29:24 +00:00
} SVnodeStat;
2021-09-22 12:29:24 +00:00
/**
* Get the statistical information of vnode.
2021-09-22 12:29:24 +00:00
*
2021-10-05 05:16:54 +00:00
* @param stat, statistical information.
2021-09-22 12:29:24 +00:00
* @return Error Code.
*/
2021-10-05 05:16:54 +00:00
int32_t vnodeGetStatistics(SVnodeStat *stat);
2021-09-22 12:29:24 +00:00
/**
* Get the status of all vnodes.
*
* @param status, status msg.
*/
2021-10-05 05:16:54 +00:00
void vnodeGetStatus(struct SStatusMsg *status);
/**
* Set access permissions for all vnodes.
*
* @param access, access permissions of vnodes.
* @param numOfVnodes, the size of vnodes.
2021-09-22 12:29:24 +00:00
*/
2021-10-05 05:16:54 +00:00
void vnodeSetAccess(struct SVgroupAccess *access, int32_t numOfVnodes);
2021-09-22 12:29:24 +00:00
2021-09-29 11:40:40 +00:00
/**
* Interface for processing messages.
*
* @param msg, message to be processed.
*/
2021-10-05 05:16:54 +00:00
void vnodeProcessMsg(SRpcMsg *msg);
2021-09-29 11:40:40 +00:00
2021-09-22 12:29:24 +00:00
#ifdef __cplusplus
}
#endif
#endif /*_TD_VNODE_H_*/