vnode.h 2.5 KB
Newer Older
H
refact  
Hongze Cheng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13
/*
 * 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/>.
S
Shengliang Guan 已提交
14 15 16 17 18 19 20 21 22
 */

#ifndef _TD_VNODE_H_
#define _TD_VNODE_H_

#ifdef __cplusplus
extern "C" {
#endif

23 24 25 26 27 28 29
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.
   */
30
  void (*SendMsgToDnode)(struct SRpcEpSet *epSet, struct SRpcMsg *rpcMsg);
31 32 33 34 35 36

  /**
   * Send messages to mnode, such as config message.
   *
   * @param rpcMsg, message to be sent.
   */
37
  void (*SendMsgToMnode)(struct SRpcMsg *rpcMsg);
38 39 40 41 42 43 44 45 46

  /**
   * 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.
   */
47
  void (*GetDnodeEp)(int32_t dnodeId, char *ep, char *fqdn, uint16_t *port);
48

S
Shengliang Guan 已提交
49 50 51 52 53
  /**
   * Report the startup progress.
   */
  void (*ReportStartup)(char *name, char *desc);

54 55 56
} SVnodeFp;

typedef struct {
57
  SVnodeFp fp;
58
} SVnodePara;
S
Shengliang Guan 已提交
59 60

/**
61
 * Start initialize vnode module.
S
Shengliang Guan 已提交
62
 *
63
 * @param para, initialization parameters.
64
 * @return Error code.
S
Shengliang Guan 已提交
65
 */
66
int32_t vnodeInit(SVnodePara para);
67

S
Shengliang Guan 已提交
68
/**
69
 * Cleanup vnode module.
S
Shengliang Guan 已提交
70
 */
71
void vnodeCleanup();
72

S
Shengliang Guan 已提交
73
typedef struct {
74
  int32_t unused;
S
Shengliang Guan 已提交
75
} SVnodeStat;
76

S
Shengliang Guan 已提交
77
/**
78
 * Get the statistical information of vnode.
S
Shengliang Guan 已提交
79
 *
80
 * @param stat, statistical information.
S
Shengliang Guan 已提交
81 82
 * @return Error Code.
 */
83
int32_t vnodeGetStatistics(SVnodeStat *stat);
S
Shengliang Guan 已提交
84

85 86 87 88 89
/**
 * Get the status of all vnodes.
 *
 * @param status, status msg.
 */
90
void vnodeGetStatus(struct SStatusMsg *status);
91 92 93 94 95 96

/**
 * Set access permissions for all vnodes.
 *
 * @param access, access permissions of vnodes.
 * @param numOfVnodes, the size of vnodes.
S
Shengliang Guan 已提交
97
 */
98
void vnodeSetAccess(struct SVgroupAccess *access, int32_t numOfVnodes);
S
Shengliang Guan 已提交
99

S
Shengliang Guan 已提交
100 101 102 103 104
/**
 * Interface for processing messages.
 *
 * @param msg, message to be processed.
 */
105
void vnodeProcessMsg(SRpcMsg *msg);
S
Shengliang Guan 已提交
106

S
Shengliang Guan 已提交
107 108 109 110
#ifdef __cplusplus
}
#endif

111
#endif /*_TD_VNODE_H_*/