dnode.h 2.2 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
/*
 * 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

/**
24
 * 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 41 42
 * @param dnode, the instance of Dnode module.
 * @param epSet, the endpoint list of the dnodes.
 * @param rpcMsg, message to be sent.
S
Shengliang Guan 已提交
43
 */
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 50
 * @param dnode, the instance of dnode module.
 * @param rpcMsg, message to be sent.
S
Shengliang Guan 已提交
51
 */
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_*/