提交 d7848099 编写于 作者: H Hongze Cheng

more

上级 113bfd51
......@@ -376,7 +376,7 @@ static void *dnodeOpenVnodeFunc(void *param) {
char path[PATH_MAX + 20] = {0};
snprintf(path, sizeof(path),"%s/vnode%d", tsVnodeDir, pVnode->vgId);
SVnode *pImpl = vnodeOpen(pVnode->vgId, path);
SVnode *pImpl = vnodeOpen(path, NULL);
if (pImpl == NULL) {
dError("vgId:%d, failed to open vnode by thread:%d", pVnode->vgId, pThread->threadIndex);
pThread->failed++;
......
......@@ -17,12 +17,18 @@
#define _TD_VNODE_DEF_H_
#include "vnode.h"
#include "vnodeOptions.h"
#ifdef __cplusplus
extern "C" {
#endif
struct SVnode {
char* path;
SVnodeOptions options;
SMeta* pMeta;
STsdb* pTsdb;
STQ* pTq;
};
#ifdef __cplusplus
......
/*
* 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/>.
*/
#ifndef _TD_VNODE_OPTIONS_H_
#define _TD_VNODE_OPTIONS_H_
#include "vnode.h"
#ifdef __cplusplus
extern "C" {
#endif
extern const SVnodeOptions defaultVnodeOptions;
int vnodeValidateOptions(const SVnodeOptions*);
#ifdef __cplusplus
}
#endif
#endif /*_TD_VNODE_OPTIONS_H_*/
\ No newline at end of file
......@@ -20,7 +20,6 @@
int32_t vnodeInit(SVnodePara para) { return 0; }
void vnodeCleanup() {}
void vnodeClose(SVnode *pVnode) {}
int32_t vnodeAlter(SVnode *pVnode, const SVnodeCfg *pCfg) { return 0; }
SVnode *vnodeCreate(int32_t vgId, const char *path, const SVnodeCfg *pCfg) { return NULL; }
void vnodeDrop(SVnode *pVnode) {}
......
......@@ -15,13 +15,47 @@
#include "vnodeDef.h"
static SVnode *vnodeNew(const char *path, const SVnodeOptions *pVnodeOptions);
static void vnodeFree(SVnode *pVnode);
SVnode *vnodeOpen(const char *path, const SVnodeOptions *pVnodeOptions) {
SVnode *pVnode = NULL;
/* TODO */
// 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);
return pVnode;
}
void vnodeCloee(SVnode *pVnode) { /* TODO */
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;
}
void vnodeDestroy(const char *path) { taosRemoveDir(path); }
\ No newline at end of file
static void vnodeFree(SVnode *pVnode) {
if (pVnode) {
// TODO
}
}
\ No newline at end of file
......@@ -15,6 +15,15 @@
#include "vnodeDef.h"
void vnodeOptionsInit(SVnodeOptions *pVnodeOptions) { /* TODO */ }
const SVnodeOptions defaultVnodeOptions = {0}; /* TODO */
void vnodeOptionsClear(SVnodeOptions *pVnodeOptions) { /* TODO */ }
\ No newline at end of file
void vnodeOptionsInit(SVnodeOptions *pVnodeOptions) { /* TODO */
}
void vnodeOptionsClear(SVnodeOptions *pVnodeOptions) { /* TODO */
}
int vnodeValidateOptions(const SVnodeOptions *pVnodeOptions) {
// TODO
return 0;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册