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
/*
 * 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

S
Shengliang Guan 已提交
23 24 25 26
struct SRpcEpSet;
struct SRpcMsg;
struct Dnode;

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

/**
35
 * Stop and cleanup dnode module.
36
 *
37
 * @param dnode, instance of dnode module.
S
Shengliang Guan 已提交
38
 */
S
Shengliang Guan 已提交
39
void dnodeDropInstance(struct Dnode *dnode);
S
Shengliang Guan 已提交
40 41 42 43

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

/**
 * Send messages to mnode, such as config message.
 *
53 54
 * @param dnode, the instance of dnode module.
 * @param rpcMsg, message to be sent.
S
Shengliang Guan 已提交
55
 */
56
void dnodeSendMsgToMnode(struct Dnode *dnode, struct SRpcMsg *rpcMsg);
S
Shengliang Guan 已提交
57 58

/**
59
 * Send redirect message to dnode or shell.
S
Shengliang Guan 已提交
60
 *
61 62 63
 * @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 已提交
64
 */
65
void dnodeSendRedirectMsg(struct Dnode *dnode, struct SRpcMsg *rpcMsg, bool forShell);
S
Shengliang Guan 已提交
66 67

/**
68
 * Get the corresponding endpoint information from dnodeId.
S
Shengliang Guan 已提交
69
 *
70 71 72 73 74
 * @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 已提交
75
 */
76
void dnodeGetDnodeEp(struct Dnode *dnode, int32_t dnodeId, char *ep, char *fqdn, uint16_t *port);
S
Shengliang Guan 已提交
77 78 79 80 81

#ifdef __cplusplus
}
#endif

82
#endif /*_TD_DNODE_H_*/