From cc2726debec0edb5b2c98d2d89d283328b3cbb19 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 7 Apr 2022 09:35:00 +0000 Subject: [PATCH] start vnode refact --- source/dnode/CMakeLists.txt | 3 +- source/dnode/vnode2/CMakeLists.txt | 20 ++++++++ source/dnode/vnode2/inc/vnode.h | 35 ++++++++++++++ source/dnode/vnode2/src/inc/vnodeInt.h | 58 +++++++++++++++++++++++ source/dnode/vnode2/src/inc/vnodeMeta.h | 27 +++++++++++ source/dnode/vnode2/src/inc/vnodeTq.h | 27 +++++++++++ source/dnode/vnode2/src/inc/vnodeTsdb.h | 27 +++++++++++ source/dnode/vnode2/src/vnode/vnodeMain.c | 25 ++++++++++ 8 files changed, 221 insertions(+), 1 deletion(-) create mode 100644 source/dnode/vnode2/CMakeLists.txt create mode 100644 source/dnode/vnode2/inc/vnode.h create mode 100644 source/dnode/vnode2/src/inc/vnodeInt.h create mode 100644 source/dnode/vnode2/src/inc/vnodeMeta.h create mode 100644 source/dnode/vnode2/src/inc/vnodeTq.h create mode 100644 source/dnode/vnode2/src/inc/vnodeTsdb.h create mode 100644 source/dnode/vnode2/src/vnode/vnodeMain.c diff --git a/source/dnode/CMakeLists.txt b/source/dnode/CMakeLists.txt index 87e4c5fc46..3670f259af 100644 --- a/source/dnode/CMakeLists.txt +++ b/source/dnode/CMakeLists.txt @@ -3,4 +3,5 @@ add_subdirectory(vnode) add_subdirectory(qnode) add_subdirectory(snode) add_subdirectory(bnode) -add_subdirectory(mgmt) \ No newline at end of file +add_subdirectory(mgmt) +add_subdirectory(vnode2) \ No newline at end of file diff --git a/source/dnode/vnode2/CMakeLists.txt b/source/dnode/vnode2/CMakeLists.txt new file mode 100644 index 0000000000..1fd3c4e158 --- /dev/null +++ b/source/dnode/vnode2/CMakeLists.txt @@ -0,0 +1,20 @@ +# vnode +add_library(vnode2 "") +target_sources( + vnode2 + PRIVATE + # vnode + "src/vnode/vnodeMain.c" +) + +target_include_directories( + vnode2 + PUBLIC "inc" + PRIVATE "src/inc" +) + +target_link_libraries( + vnode2 + os +) + diff --git a/source/dnode/vnode2/inc/vnode.h b/source/dnode/vnode2/inc/vnode.h new file mode 100644 index 0000000000..a30979a202 --- /dev/null +++ b/source/dnode/vnode2/inc/vnode.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * 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 . + */ + +#ifndef _TD_VNODE_H_ +#define _TD_VNODE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct SVnode SVnode; + +typedef struct { +} SVnodeCfg; + +int vnodeOpen(const char *path, const SVnodeCfg *pCfg, SVnode **ppVnode); +int vnodeClose(SVnode *pVnode); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_VNODE_H_*/ \ No newline at end of file diff --git a/source/dnode/vnode2/src/inc/vnodeInt.h b/source/dnode/vnode2/src/inc/vnodeInt.h new file mode 100644 index 0000000000..ae2b65b3c9 --- /dev/null +++ b/source/dnode/vnode2/src/inc/vnodeInt.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * 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 . + */ + +#ifndef _TD_VNODE_INT_H_ +#define _TD_VNODE_INT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "os.h" + +#include "vnode.h" + +typedef int8_t i8; +typedef int16_t i16; +typedef int32_t i32; +typedef int64_t i64; +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; +typedef uint64_t u64; + +typedef struct SMeta SMeta; +typedef struct STsdb STsdb; +typedef struct STQ STQ; + +struct SVnode { + i32 vid; + char *path; + SMeta *pMeta; + STsdb *pTsdb; + STQ *pTq; +}; + +#include "vnodeMeta.h" + +#include "vnodeTsdb.h" + +#include "vnodeTq.h" + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_VNODE_INT_H_*/ \ No newline at end of file diff --git a/source/dnode/vnode2/src/inc/vnodeMeta.h b/source/dnode/vnode2/src/inc/vnodeMeta.h new file mode 100644 index 0000000000..18952e9a43 --- /dev/null +++ b/source/dnode/vnode2/src/inc/vnodeMeta.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * 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 . + */ + +#ifndef _TD_VNODE_META_H_ +#define _TD_VNODE_META_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_VNODE_META_H_*/ \ No newline at end of file diff --git a/source/dnode/vnode2/src/inc/vnodeTq.h b/source/dnode/vnode2/src/inc/vnodeTq.h new file mode 100644 index 0000000000..573fc78df0 --- /dev/null +++ b/source/dnode/vnode2/src/inc/vnodeTq.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * 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 . + */ + +#ifndef _TD_VNODE_TQ_H_ +#define _TD_VNODE_TQ_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_VNODE_TQ_H_*/ \ No newline at end of file diff --git a/source/dnode/vnode2/src/inc/vnodeTsdb.h b/source/dnode/vnode2/src/inc/vnodeTsdb.h new file mode 100644 index 0000000000..0ed2a6dc11 --- /dev/null +++ b/source/dnode/vnode2/src/inc/vnodeTsdb.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * 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 . + */ + +#ifndef _TD_VNODE_TSDB_H_ +#define _TD_VNODE_TSDB_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_VNODE_TSDB_H_*/ \ No newline at end of file diff --git a/source/dnode/vnode2/src/vnode/vnodeMain.c b/source/dnode/vnode2/src/vnode/vnodeMain.c new file mode 100644 index 0000000000..c3da3fd6e4 --- /dev/null +++ b/source/dnode/vnode2/src/vnode/vnodeMain.c @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * 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 . + */ + +#include "vnodeInt.h" + +int vnodeOpen(const char *path, const SVnodeCfg *pCfg, SVnode **ppVnode) { + return 0; + } + +int vnodeClose(SVnode *pVnode) { + // TODO + return 0; +} \ No newline at end of file -- GitLab