提交 daafc0fe 编写于 作者: S Shengliang Guan

[TD-10430] interface of dnode/mnode/vnode module

上级 3e995bd3
......@@ -21,53 +21,53 @@ extern "C" {
#endif
/**
* Initialize and start the dnode module
* Initialize and start the dnode module.
*
* @return Instance of dnode module
* @return Instance of dnode module.
*/
struct Dnode *dnodeCreateInstance();
/**
* Stop and cleanup dnode module
* Stop and cleanup dnode module.
*
* @param dnode Instance of dnode module
* @param dnode, instance of dnode module.
*/
void dnodeCleanupInstance(struct Dnode *dnode);
/**
* Send messages to other dnodes, such as create vnode message.
*
* @param dnode The instance of Dnode module
* @param epSet The endpoint list of the dnodes.
* @param rpcMsg Message to be sent.
* @param dnode, the instance of Dnode module.
* @param epSet, the endpoint list of the dnodes.
* @param rpcMsg, message to be sent.
*/
void dnodeSendMsgToDnode(struct Dnode *dnode, struct SRpcEpSet *epSet, struct SRpcMsg *rpcMsg);
/**
* Send messages to mnode, such as config message.
*
* @param dnode The instance of dnode module
* @param rpcMsg Message to be sent.
* @param dnode, the instance of dnode module.
* @param rpcMsg, message to be sent.
*/
void dnodeSendMsgToMnode(struct Dnode *dnode, struct SRpcMsg *rpcMsg);
/**
* Send redirect message to dnode or shell.
*
* @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.
* @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.
*/
void dnodeSendRedirectMsg(struct Dnode *dnode, struct SRpcMsg *rpcMsg, bool forShell);
/**
* Get the corresponding endpoint information from dnodeId.
*
* @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
* @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.
*/
void dnodeGetDnodeEp(struct Dnode *dnode, int32_t dnodeId, char *ep, char *fqdn, uint16_t *port);
......
......@@ -20,49 +20,140 @@
extern "C" {
#endif
struct SRpcMsg;
struct Dnode;
typedef struct {
/**
* Send messages to other dnodes, such as create vnode message.
*
* @param dnode, the instance of dnode module.
* @param epSet, the endpoint list of the dnodes.
* @param rpcMsg, message to be sent.
*/
void (*SendMsgToDnode)(struct Dnode *dnode, struct SRpcEpSet *epSet, struct SRpcMsg *rpcMsg);
/**
* Send messages to mnode, such as config message.
*
* @param dnode, the instance of dnode module.
* @param rpcMsg, message to be sent.
*/
void (*SendMsgToMnode)(struct Dnode *dnode, struct SRpcMsg *rpcMsg);
/**
* Send redirect message to dnode or shell.
*
* @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.
*/
void (*SendRedirectMsg)(struct Dnode *dnode, struct SRpcMsg *rpcMsg, bool forShell);
/**
* Get the corresponding endpoint information from dnodeId.
*
* @param dnode, the instance of dDnode 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.
*/
void (*GetDnodeEp)(struct Dnode *dnode, int32_t dnodeId, char *ep, char *fqdn, uint16_t *port);
} SMnodeFp;
typedef struct {
struct Dnode *dnode;
SMnodeFp fp;
char clusterId[TSDB_CLUSTER_ID_LEN];
int32_t dnodeId;
} SMnodePara;
/**
* Deploy Mnode instances in Dnode.
*
* @return Error Code.
* Initialize and start mnode module.
*
* @param para, initialization parameters.
* @return Instance of mnode module.
*/
int32_t mnodeDeploy();
struct Mnode *mnodeCreateInstance(SMnodePara para);
/**
* Delete the Mnode instance deployed in Dnode.
* Stop and cleanup mnode module.
*
* @param mnode, instance of mnode module.
*/
void mnodeUnDeploy();
void mnodeCleanupInstance(struct Mnode *vnode);
/**
* Start Mnode service.
*
* Deploy mnode instances in dnode.
*
* @param mnode, instance of mnode module.
* @param minfos, server information used to deploy the mnode instance.
* @return Error Code.
*/
int32_t mnodeStart();
int32_t mnodeDeploy(struct Mnode *mnode, struct SMInfos *minfos);
/**
* Stop Mnode service.
* Delete the mnode instance deployed in dnode.
*
* @param mnode, instance of mnode module.
*/
int32_t mnodeStop();
void mnodeUnDeploy(struct Mnode *mnode);
/**
* Interface for processing messages.
*
* @param pMsg Message to be processed.
* @return Error code
*
* @param mnode, instance of mnode module.
* @param rpcMsg, message to be processed.
* @return Error code.
*/
int32_t mnodeProcessMsg(SRpcMsg *pMsg);
void mnodeProcessMsg(struct Mnode *mnode, SRpcMsg *rpcMsg);
/**
* Whether the Mnode is in service.
*
* Whether the mnode is in service.
*
* @param mnode, instance of mnode module.
* @return Server status.
*/
bool mnodeIsServing();
bool mnodeIsServing(struct Mnode *mnode);
typedef struct {
int64_t numOfDnode;
int64_t numOfMnode;
int64_t numOfVgroup;
int64_t numOfDatabase;
int64_t numOfSuperTable;
int64_t numOfChildTable;
int64_t numOfColumn;
int64_t totalPoints;
int64_t totalStorage;
int64_t compStorage;
} SMnodeStat;
/**
* Get the statistical information of Mnode.
*
* @param mnode, instance of mnode module.
* @param stat, statistical information.
* @return Error Code.
*/
int32_t mnodeGetStatistics(struct Mnode *mnode, SMnodeStat *stat);
/**
* Get the statistical information of Mnode.
*
* @param mnode, instance of mnode module.
* @param user, username.
* @param spi, security parameter index.
* @param encrypt, encrypt algorithm.
* @param secret, key for authentication.
* @param ckey, ciphering key.
* @return Error Code.
*/
int32_t mnodeRetriveAuth(struct Mnode *mnode, char *user, char *spi, char *encrypt, char *secret, char *ckey);
#ifdef __cplusplus
}
#endif
#endif /*_TD_MNODE_H_*/
\ No newline at end of file
#endif /*_TD_MNODE_H_*/
......@@ -20,43 +20,99 @@
extern "C" {
#endif
struct SRpcMsg;
struct Dnode;
typedef struct {
/**
* Send messages to other dnodes, such as create vnode message.
*
* @param dnode, the instance of dnode module.
* @param epSet, the endpoint list of dnodes.
* @param rpcMsg, message to be sent.
*/
void (*SendMsgToDnode)(struct Dnode *dnode, struct SRpcEpSet *epSet, struct SRpcMsg *rpcMsg);
/**
* Send messages to mnode, such as config message.
*
* @param dnode, the instance of dnode module.
* @param rpcMsg, message to be sent.
*/
void (*SendMsgToMnode)(struct Dnode *dnode, struct SRpcMsg *rpcMsg);
/**
* Get the corresponding endpoint information from dnodeId.
*
* @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.
*/
void (*GetDnodeEp)(struct Dnode *dnode, int32_t dnodeId, char *ep, char *fqdn, uint16_t *port);
} SVnodeFp;
typedef struct {
struct Dnode *dnode;
SVnodeFp fp;
} SVnodePara;
/**
* Start Initialize Vnode module.
* Start initialize vnode module.
*
* @return Error Code.
* @param para, initialization parameters.
* @return Instance of vnode module.
*/
int32_t vnodeInit();
struct Vnode *vnodeCreateInstance(SVnodePara para);
/**
* Cleanup Vnode module.
* Cleanup vnode module.
*
* @param vnode, instance of vnode module.
*/
void vnodeCleanup();
void vnodeCleanupInstance(struct Vnode *vnode);
typedef struct {
int64_t queryMsgCount;
int64_t writeMsgCount;
int32_t unused;
} SVnodeStat;
/**
* Get the statistical information of Vnode
* Get the statistical information of vnode.
*
* @param stat Statistical information.
* @param vnode, instance of vnode module.
* @param sta, statistical information.
* @return Error Code.
*/
int32_t vnodeGetStatistics(SVnodeStat *stat);
int32_t vnodeGetStatistics(struct Vnode *vnode, SVnodeStat *stat);
/**
/**
* Interface for processing messages.
*
* @param pMsg Message to be processed.
* @return Error code
* @param vnode, instance of vnode module.
* @param msg, message to be processed.
*/
void vnodeProcessMsg(struct Vnode *vnode, SRpcMsg *msg);
/**
* Get the status of all vnodes.
*
* @param vnode, instance of vnode module.
* @param status, status msg.
*/
void vnodeGetStatus(struct Vnode *vnode, struct SStatusMsg *status);
/**
* Set access permissions for all vnodes.
*
* @param vnode, instance of vnode module.
* @param access, access permissions of vnodes.
* @param numOfVnodes, the size of vnodes.
*/
int32_t vnodeProcessMsg(SRpcMsg *pMsg);
void vnodeSetAccess(struct Vnode *vnode, struct SVgroupAccess *access, int32_t numOfVnodes);
#ifdef __cplusplus
}
#endif
#endif /*_TD_VNODE_H_*/
\ No newline at end of file
#endif /*_TD_VNODE_H_*/
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册