dnode.h 1.8 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
struct SRpcEpSet;
struct SRpcMsg;
S
Shengliang Guan 已提交
25
/**
26
 * Initialize and start the dnode module.
27
 *
28
 * @return Error code.
S
Shengliang Guan 已提交
29
 */
30
int32_t dnodeInit();
S
Shengliang Guan 已提交
31 32

/**
33
 * Stop and cleanup dnode module.
S
Shengliang Guan 已提交
34
 */
35
void dnodeCleanup();
S
Shengliang Guan 已提交
36 37 38 39

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

/**
 * Send messages to mnode, such as config message.
 *
48
 * @param rpcMsg, message to be sent.
S
Shengliang Guan 已提交
49
 */
50
void dnodeSendMsgToMnode(struct SRpcMsg *rpcMsg);
S
Shengliang Guan 已提交
51 52

/**
53
 * Send redirect message to dnode or shell.
S
Shengliang Guan 已提交
54
 *
55 56
 * @param rpcMsg, message to be sent.
 * @param forShell, used to identify whether to send to shell or dnode.
S
Shengliang Guan 已提交
57
 */
58
void dnodeSendRedirectMsg(struct SRpcMsg *rpcMsg, bool forShell);
S
Shengliang Guan 已提交
59 60

/**
61
 * Get the corresponding endpoint information from dnodeId.
S
Shengliang Guan 已提交
62
 *
63 64 65 66
 * @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 已提交
67
 */
S
Shengliang Guan 已提交
68
void dnodeGetEp(int32_t dnodeId, char *ep, char *fqdn, uint16_t *port);
S
Shengliang Guan 已提交
69 70 71 72 73

#ifdef __cplusplus
}
#endif

74
#endif /*_TD_DNODE_H_*/