[TD-10430] interface of dnode/mnode/vnode module
This commit is contained in:
parent
3e995bd371
commit
daafc0feb7
|
@ -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.
|
||||
*
|
||||
* Initialize and start mnode module.
|
||||
*
|
||||
* @param para, initialization parameters.
|
||||
* @return Instance of mnode module.
|
||||
*/
|
||||
struct Mnode *mnodeCreateInstance(SMnodePara para);
|
||||
|
||||
/**
|
||||
* Stop and cleanup mnode module.
|
||||
*
|
||||
* @param mnode, instance of mnode module.
|
||||
*/
|
||||
void mnodeCleanupInstance(struct Mnode *vnode);
|
||||
|
||||
/**
|
||||
* 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 mnodeDeploy();
|
||||
int32_t mnodeDeploy(struct Mnode *mnode, struct SMInfos *minfos);
|
||||
|
||||
/**
|
||||
* Delete the Mnode instance deployed in Dnode.
|
||||
* Delete the mnode instance deployed in dnode.
|
||||
*
|
||||
* @param mnode, instance of mnode module.
|
||||
*/
|
||||
void mnodeUnDeploy();
|
||||
|
||||
/**
|
||||
* Start Mnode service.
|
||||
*
|
||||
* @return Error Code.
|
||||
*/
|
||||
int32_t mnodeStart();
|
||||
|
||||
/**
|
||||
* Stop Mnode service.
|
||||
*/
|
||||
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_*/
|
||||
#endif /*_TD_MNODE_H_*/
|
||||
|
|
|
@ -20,43 +20,99 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct SRpcMsg;
|
||||
struct Dnode;
|
||||
|
||||
/**
|
||||
* Start Initialize Vnode module.
|
||||
*
|
||||
* @return Error Code.
|
||||
*/
|
||||
int32_t vnodeInit();
|
||||
|
||||
/**
|
||||
* Cleanup Vnode module.
|
||||
*/
|
||||
void vnodeCleanup();
|
||||
|
||||
typedef struct {
|
||||
int64_t queryMsgCount;
|
||||
int64_t writeMsgCount;
|
||||
} SVnodeStat;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Get the statistical information of Vnode
|
||||
* Start initialize vnode module.
|
||||
*
|
||||
* @param stat Statistical information.
|
||||
* @param para, initialization parameters.
|
||||
* @return Instance of vnode module.
|
||||
*/
|
||||
struct Vnode *vnodeCreateInstance(SVnodePara para);
|
||||
|
||||
/**
|
||||
* Cleanup vnode module.
|
||||
*
|
||||
* @param vnode, instance of vnode module.
|
||||
*/
|
||||
void vnodeCleanupInstance(struct Vnode *vnode);
|
||||
|
||||
typedef struct {
|
||||
int32_t unused;
|
||||
} SVnodeStat;
|
||||
|
||||
/**
|
||||
* Get the statistical information of vnode.
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
int32_t vnodeProcessMsg(SRpcMsg *pMsg);
|
||||
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.
|
||||
*/
|
||||
void vnodeSetAccess(struct Vnode *vnode, struct SVgroupAccess *access, int32_t numOfVnodes);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_TD_VNODE_H_*/
|
||||
#endif /*_TD_VNODE_H_*/
|
||||
|
|
Loading…
Reference in New Issue