2021-10-10 13:36:32 +00:00
|
|
|
/*
|
|
|
|
|
* 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/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2021-11-08 02:32:36 +00:00
|
|
|
#include "vnodeDef.h"
|
|
|
|
|
|
2021-11-11 03:41:16 +00:00
|
|
|
int vnodeProcessWMsgs(SVnode *pVnode, SArray *pMsgs) {
|
2021-11-08 02:32:36 +00:00
|
|
|
/* TODO */
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-11 03:41:16 +00:00
|
|
|
int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
|
2021-11-12 02:53:52 +00:00
|
|
|
#if 0
|
2021-11-09 07:10:08 +00:00
|
|
|
int reqType; /* TODO */
|
|
|
|
|
size_t reqSize; /* TODO */
|
|
|
|
|
uint64_t reqVersion = 0; /* TODO */
|
|
|
|
|
int code = 0;
|
2021-11-09 03:22:25 +00:00
|
|
|
|
|
|
|
|
// Copy the request to vnode buffer
|
2021-11-11 03:41:16 +00:00
|
|
|
void *pReq = mMalloc(pVnode->inuse, reqSize);
|
2021-11-09 03:22:25 +00:00
|
|
|
if (pReq == NULL) {
|
|
|
|
|
// TODO: handle error
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-11 03:41:16 +00:00
|
|
|
memcpy(pReq, pMsg, reqSize);
|
2021-11-09 03:45:01 +00:00
|
|
|
|
2021-11-09 03:22:25 +00:00
|
|
|
// Push the request to TQ so consumers can consume
|
|
|
|
|
tqPushMsg(pVnode->pTq, pReq, 0);
|
|
|
|
|
|
|
|
|
|
// Process the request
|
|
|
|
|
switch (reqType) {
|
|
|
|
|
case TSDB_MSG_TYPE_CREATE_TABLE:
|
|
|
|
|
code = metaCreateTable(pVnode->pMeta, NULL /* TODO */);
|
|
|
|
|
break;
|
|
|
|
|
case TSDB_MSG_TYPE_DROP_TABLE:
|
|
|
|
|
code = metaDropTable(pVnode->pMeta, 0 /* TODO */);
|
|
|
|
|
break;
|
2021-11-12 02:53:52 +00:00
|
|
|
case TSDB_MSG_TYPE_SUBMIT:
|
2021-11-09 03:22:25 +00:00
|
|
|
/* TODO */
|
2021-11-12 02:53:52 +00:00
|
|
|
break;
|
2021-11-09 03:22:25 +00:00
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (vnodeShouldCommit(pVnode)) {
|
|
|
|
|
if (vnodeAsyncCommit(pVnode) < 0) {
|
|
|
|
|
// TODO: handle error
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return code;
|
2021-11-12 02:53:52 +00:00
|
|
|
#endif
|
|
|
|
|
return 0;
|
2021-11-08 02:58:46 +00:00
|
|
|
}
|
|
|
|
|
|
2021-11-08 03:43:39 +00:00
|
|
|
/* ------------------------ STATIC METHODS ------------------------ */
|