refact
This commit is contained in:
parent
e26fbd80fd
commit
5704d5e2ee
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* 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_REQUEST_H_
|
||||||
|
#define _TD_VNODE_REQUEST_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /*_TD_VNODE_REQUEST_H_*/
|
|
@ -85,10 +85,32 @@ static void vnodeFree(SVnode *pVnode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vnodeOpenImpl(SVnode *pVnode) {
|
static int vnodeOpenImpl(SVnode *pVnode) {
|
||||||
|
char dir[TSDB_FILENAME_LEN];
|
||||||
|
|
||||||
|
// Open meta
|
||||||
|
sprintf(dir, "%s/meta", pVnode->path);
|
||||||
|
if (metaOpen(dir, &(pVnode->options.metaOptions)) < 0) {
|
||||||
|
// TODO: handle error
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Open tsdb
|
||||||
|
sprintf(dir, "%s/tsdb", pVnode->path);
|
||||||
|
if (tsdbOpen(dir, &(pVnode->options.tsdbOptions)) < 0) {
|
||||||
|
// TODO: handle error
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Open TQ
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vnodeCloseImpl(SVnode *pVnode) {
|
static void vnodeCloseImpl(SVnode *pVnode) {
|
||||||
// TODO
|
if (pVnode) {
|
||||||
|
// TODO: Close TQ
|
||||||
|
tsdbClose(pVnode->pTsdb);
|
||||||
|
metaClose(pVnode->pMeta);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -18,6 +18,7 @@
|
||||||
const SVnodeOptions defaultVnodeOptions = {0}; /* TODO */
|
const SVnodeOptions defaultVnodeOptions = {0}; /* TODO */
|
||||||
|
|
||||||
void vnodeOptionsInit(SVnodeOptions *pVnodeOptions) { /* TODO */
|
void vnodeOptionsInit(SVnodeOptions *pVnodeOptions) { /* TODO */
|
||||||
|
vnodeOptionsCopy(pVnodeOptions, &defaultVnodeOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vnodeOptionsClear(SVnodeOptions *pVnodeOptions) { /* TODO */
|
void vnodeOptionsClear(SVnodeOptions *pVnodeOptions) { /* TODO */
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
/*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
|
@ -21,6 +21,7 @@ int vnodeProcessWriteReqs(SVnode *pVnode, SReqBatch *pReqBatch) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int vnodeApplyWriteRequest(SVnode *pVnode, const SRequest *pRequest) {
|
int vnodeApplyWriteRequest(SVnode *pVnode, const SRequest *pRequest) {
|
||||||
|
int type;
|
||||||
/* TODO */
|
/* TODO */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,11 +13,9 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "meta.h"
|
#include "metaDef.h"
|
||||||
|
|
||||||
const static SMetaOptions defaultMetaOptions = {.lruCacheSize = 0};
|
const SMetaOptions defaultMetaOptions = {.lruCacheSize = 0};
|
||||||
|
|
||||||
static void metaOptionsCopy(SMetaOptions *pDest, const SMetaOptions *pSrc);
|
|
||||||
|
|
||||||
/* ------------------------ EXPOSED METHODS ------------------------ */
|
/* ------------------------ EXPOSED METHODS ------------------------ */
|
||||||
void metaOptionsInit(SMetaOptions *pMetaOptions) { metaOptionsCopy(pMetaOptions, &defaultMetaOptions); }
|
void metaOptionsInit(SMetaOptions *pMetaOptions) { metaOptionsCopy(pMetaOptions, &defaultMetaOptions); }
|
||||||
|
|
Loading…
Reference in New Issue