dnode.h 2.1 KB
Newer Older
S
Shengliang Guan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/*
 * 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_DNODE_H_
#define _TD_DNODE_H_

#ifdef __cplusplus
extern "C" {
#endif

/**
 * Initialize and start the dnode module
25 26
 *
 * @return Instance of dnode module
S
Shengliang Guan 已提交
27
 */
28
struct Dnode *dnodeCreateInstance();
S
Shengliang Guan 已提交
29 30 31

/**
 * Stop and cleanup dnode module
32 33
 *
 * @param dnode Instance of dnode module
S
Shengliang Guan 已提交
34
 */
35
void dnodeCleanupInstance(struct Dnode *dnode);
S
Shengliang Guan 已提交
36 37 38 39

/**
 * Send messages to other dnodes, such as create vnode message.
 *
40
 * @param dnode The instance of Dnode module
S
Shengliang Guan 已提交
41 42 43
 * @param epSet The endpoint list of the dnodes.
 * @param rpcMsg Message to be sent.
 */
44
void dnodeSendMsgToDnode(struct Dnode *dnode, struct SRpcEpSet *epSet, struct SRpcMsg *rpcMsg);
S
Shengliang Guan 已提交
45 46 47 48

/**
 * Send messages to mnode, such as config message.
 *
49
 * @param dnode The instance of dnode module
S
Shengliang Guan 已提交
50 51
 * @param rpcMsg Message to be sent.
 */
52
void dnodeSendMsgToMnode(struct Dnode *dnode, struct SRpcMsg *rpcMsg);
S
Shengliang Guan 已提交
53 54

/**
55
 * Send redirect message to dnode or shell.
S
Shengliang Guan 已提交
56
 *
57 58 59
 * @param dnode The instance of dnode module
 * @param rpcMsg Message to be sent.
 * @param forShell Used to identify whether to send to shell or dnode.
S
Shengliang Guan 已提交
60
 */
61
void dnodeSendRedirectMsg(struct Dnode *dnode, struct SRpcMsg *rpcMsg, bool forShell);
S
Shengliang Guan 已提交
62 63

/**
64
 * Get the corresponding endpoint information from dnodeId.
S
Shengliang Guan 已提交
65
 *
66 67 68 69 70
 * @param dnode The instance of Dnode module
 * @param dnodeId The id ot dnode
 * @param ep The endpoint of dnode
 * @param fqdn The fqdn of dnode
 * @param port The port of dnode
S
Shengliang Guan 已提交
71
 */
72
void dnodeGetDnodeEp(struct Dnode *dnode, int32_t dnodeId, char *ep, char *fqdn, uint16_t *port);
S
Shengliang Guan 已提交
73 74 75 76 77

#ifdef __cplusplus
}
#endif

78
#endif /*_TD_DNODE_H_*/