TDengine/source/dnode/vnode/impl/src/vnodeMain.c

61 lines
1.6 KiB
C
Raw Normal View History

2021-11-07 07:58: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/>.
*/
#include "vnodeDef.h"
2021-11-08 02:04:24 +00:00
static SVnode *vnodeNew(const char *path, const SVnodeOptions *pVnodeOptions);
static void vnodeFree(SVnode *pVnode);
2021-11-07 07:58:32 +00:00
SVnode *vnodeOpen(const char *path, const SVnodeOptions *pVnodeOptions) {
SVnode *pVnode = NULL;
2021-11-08 02:04:24 +00:00
// Set default options
if (pVnodeOptions == NULL) {
pVnodeOptions = &defaultVnodeOptions;
}
// Validate options
if (vnodeValidateOptions(pVnodeOptions) < 0) {
// TODO
return NULL;
}
pVnode = vnodeNew(path, pVnodeOptions);
if (pVnode == NULL) {
// TODO: handle error
return NULL;
}
taosMkDir(path);
2021-11-07 07:58:32 +00:00
return pVnode;
}
2021-11-08 02:04:24 +00:00
void vnodeClose(SVnode *pVnode) { /* TODO */
}
void vnodeDestroy(const char *path) { taosRemoveDir(path); }
/* ------------------------ STATIC METHODS ------------------------ */
static SVnode *vnodeNew(const char *path, const SVnodeOptions *pVnodeOptions) {
// TODO
return NULL;
2021-11-07 07:58:32 +00:00
}
2021-11-08 02:04:24 +00:00
static void vnodeFree(SVnode *pVnode) {
if (pVnode) {
// TODO
}
}