more
This commit is contained in:
parent
113bfd51ba
commit
d78480998f
|
@ -376,7 +376,7 @@ static void *dnodeOpenVnodeFunc(void *param) {
|
||||||
|
|
||||||
char path[PATH_MAX + 20] = {0};
|
char path[PATH_MAX + 20] = {0};
|
||||||
snprintf(path, sizeof(path),"%s/vnode%d", tsVnodeDir, pVnode->vgId);
|
snprintf(path, sizeof(path),"%s/vnode%d", tsVnodeDir, pVnode->vgId);
|
||||||
SVnode *pImpl = vnodeOpen(pVnode->vgId, path);
|
SVnode *pImpl = vnodeOpen(path, NULL);
|
||||||
if (pImpl == NULL) {
|
if (pImpl == NULL) {
|
||||||
dError("vgId:%d, failed to open vnode by thread:%d", pVnode->vgId, pThread->threadIndex);
|
dError("vgId:%d, failed to open vnode by thread:%d", pVnode->vgId, pThread->threadIndex);
|
||||||
pThread->failed++;
|
pThread->failed++;
|
||||||
|
|
|
@ -17,12 +17,18 @@
|
||||||
#define _TD_VNODE_DEF_H_
|
#define _TD_VNODE_DEF_H_
|
||||||
|
|
||||||
#include "vnode.h"
|
#include "vnode.h"
|
||||||
|
#include "vnodeOptions.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct SVnode {
|
struct SVnode {
|
||||||
|
char* path;
|
||||||
|
SVnodeOptions options;
|
||||||
|
SMeta* pMeta;
|
||||||
|
STsdb* pTsdb;
|
||||||
|
STQ* pTq;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* 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_*/
|
|
@ -20,7 +20,6 @@
|
||||||
int32_t vnodeInit(SVnodePara para) { return 0; }
|
int32_t vnodeInit(SVnodePara para) { return 0; }
|
||||||
void vnodeCleanup() {}
|
void vnodeCleanup() {}
|
||||||
|
|
||||||
void vnodeClose(SVnode *pVnode) {}
|
|
||||||
int32_t vnodeAlter(SVnode *pVnode, const SVnodeCfg *pCfg) { return 0; }
|
int32_t vnodeAlter(SVnode *pVnode, const SVnodeCfg *pCfg) { return 0; }
|
||||||
SVnode *vnodeCreate(int32_t vgId, const char *path, const SVnodeCfg *pCfg) { return NULL; }
|
SVnode *vnodeCreate(int32_t vgId, const char *path, const SVnodeCfg *pCfg) { return NULL; }
|
||||||
void vnodeDrop(SVnode *pVnode) {}
|
void vnodeDrop(SVnode *pVnode) {}
|
||||||
|
|
|
@ -15,13 +15,47 @@
|
||||||
|
|
||||||
#include "vnodeDef.h"
|
#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 *vnodeOpen(const char *path, const SVnodeOptions *pVnodeOptions) {
|
||||||
SVnode *pVnode = NULL;
|
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;
|
return pVnode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vnodeCloee(SVnode *pVnode) { /* TODO */
|
void vnodeClose(SVnode *pVnode) { /* TODO */
|
||||||
}
|
}
|
||||||
|
|
||||||
void vnodeDestroy(const char *path) { taosRemoveDir(path); }
|
void vnodeDestroy(const char *path) { taosRemoveDir(path); }
|
||||||
|
|
||||||
|
/* ------------------------ STATIC METHODS ------------------------ */
|
||||||
|
static SVnode *vnodeNew(const char *path, const SVnodeOptions *pVnodeOptions) {
|
||||||
|
// TODO
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void vnodeFree(SVnode *pVnode) {
|
||||||
|
if (pVnode) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,6 +15,15 @@
|
||||||
|
|
||||||
#include "vnodeDef.h"
|
#include "vnodeDef.h"
|
||||||
|
|
||||||
void vnodeOptionsInit(SVnodeOptions *pVnodeOptions) { /* TODO */ }
|
const SVnodeOptions defaultVnodeOptions = {0}; /* TODO */
|
||||||
|
|
||||||
void vnodeOptionsClear(SVnodeOptions *pVnodeOptions) { /* TODO */ }
|
void vnodeOptionsInit(SVnodeOptions *pVnodeOptions) { /* TODO */
|
||||||
|
}
|
||||||
|
|
||||||
|
void vnodeOptionsClear(SVnodeOptions *pVnodeOptions) { /* TODO */
|
||||||
|
}
|
||||||
|
|
||||||
|
int vnodeValidateOptions(const SVnodeOptions *pVnodeOptions) {
|
||||||
|
// TODO
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue