TDengine/source/dnode/vnode/meta/src/metaTable.c

53 lines
1.3 KiB
C
Raw Normal View History

2021-11-02 05:57:16 +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-02 07:24:55 +00:00
*/
2021-11-03 06:49:20 +00:00
#include "metaDef.h"
2021-11-02 07:24:55 +00:00
2021-11-29 03:37:26 +00:00
int metaCreateTable(SMeta *pMeta, STbCfg *pTbCfg) {
2021-11-03 06:49:20 +00:00
// Validate the tbOptions
2021-12-25 08:54:28 +00:00
if (metaValidateTbCfg(pMeta, pTbCfg) < 0) {
2021-11-03 06:49:20 +00:00
// TODO: handle error
return -1;
}
// TODO: add atomicity
2021-11-26 05:43:38 +00:00
if (metaSaveTableToDB(pMeta, pTbCfg) < 0) {
2021-11-03 06:49:20 +00:00
// TODO: handle error
return -1;
}
2021-11-26 05:43:38 +00:00
if (metaSaveTableToIdx(pMeta, pTbCfg) < 0) {
2021-11-03 06:49:20 +00:00
// TODO: handle error
return -1;
}
2021-11-02 07:24:55 +00:00
return 0;
}
2021-11-29 03:53:31 +00:00
int metaDropTable(SMeta *pMeta, tb_uid_t uid) {
2021-11-03 06:49:20 +00:00
if (metaRemoveTableFromIdx(pMeta, uid) < 0) {
// TODO: handle error
return -1;
}
if (metaRemoveTableFromIdx(pMeta, uid) < 0) {
// TODO
return -1;
}
2021-11-02 07:24:55 +00:00
return 0;
}