From 40d58ce1a2d94f1a816e15adb534e6f81d7357fc Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Tue, 2 Nov 2021 13:57:16 +0800 Subject: [PATCH] more --- include/server/vnode/meta/impl/metaImpl.h | 4 +++ include/server/vnode/meta/meta.h | 5 ++-- source/dnode/vnode/meta/src/metaCommit.c | 14 +++++++++++ source/dnode/vnode/meta/src/metaOptions.c | 30 +++++++++++++++++++++++ source/dnode/vnode/meta/src/metaTable.c | 14 +++++++++++ 5 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 source/dnode/vnode/meta/src/metaCommit.c create mode 100644 source/dnode/vnode/meta/src/metaOptions.c create mode 100644 source/dnode/vnode/meta/src/metaTable.c diff --git a/include/server/vnode/meta/impl/metaImpl.h b/include/server/vnode/meta/impl/metaImpl.h index 1e2bf944ec..a9d70500cb 100644 --- a/include/server/vnode/meta/impl/metaImpl.h +++ b/include/server/vnode/meta/impl/metaImpl.h @@ -25,6 +25,10 @@ extern "C" { #endif typedef uint64_t tb_uid_t; +struct SMetaOptions { + size_t lruCacheSize; // LRU cache size +}; + typedef enum { META_INIT_TABLE = 0, META_SUPER_TABLE = 1, META_CHILD_TABLE = 2, META_NORMAL_TABLE = 3 } EMetaTableT; typedef struct SSuperTableOpts { tb_uid_t uid; diff --git a/include/server/vnode/meta/meta.h b/include/server/vnode/meta/meta.h index 264e8716cb..f1d18e27ff 100644 --- a/include/server/vnode/meta/meta.h +++ b/include/server/vnode/meta/meta.h @@ -36,9 +36,8 @@ int metaDropTable(SMeta *pMeta, tb_uid_t uid); int metaCommit(SMeta *); // Options -SMetaOptions *metaOptionsCreate(); -void metaOptionsDestroy(SMetaOptions *); -void metaOptionsSetCache(SMetaOptions *, size_t capacity); +void metaOptionsInit(SMetaOptions *); +void metaOptionsClear(SMetaOptions *); // STableOpts #define META_TABLE_OPTS_DECLARE(name) STableOpts name = {0} diff --git a/source/dnode/vnode/meta/src/metaCommit.c b/source/dnode/vnode/meta/src/metaCommit.c new file mode 100644 index 0000000000..f2f48bbc8a --- /dev/null +++ b/source/dnode/vnode/meta/src/metaCommit.c @@ -0,0 +1,14 @@ +/* + * 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 . + */ diff --git a/source/dnode/vnode/meta/src/metaOptions.c b/source/dnode/vnode/meta/src/metaOptions.c new file mode 100644 index 0000000000..646ac873b1 --- /dev/null +++ b/source/dnode/vnode/meta/src/metaOptions.c @@ -0,0 +1,30 @@ +/* + * 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 "meta.h" + +const static SMetaOptions defaultMetaOptions = {.lruCacheSize = 0}; + +static void metaOptionsCopy(SMetaOptions *pDest, const SMetaOptions *pSrc); + +/* ------------------------ EXPOSED METHODS ------------------------ */ +void metaOptionsInit(SMetaOptions *pMetaOptions) { metaOptionsCopy(pMetaOptions, &defaultMetaOptions); } + +void metaOptionsClear(SMetaOptions *pMetaOptions) { + // TODO +} + +/* ------------------------ STATIC METHODS ------------------------ */ +static void metaOptionsCopy(SMetaOptions *pDest, const SMetaOptions *pSrc) { memcpy(pDest, pSrc, sizeof(*pSrc)); } \ No newline at end of file diff --git a/source/dnode/vnode/meta/src/metaTable.c b/source/dnode/vnode/meta/src/metaTable.c new file mode 100644 index 0000000000..6dea4a4e57 --- /dev/null +++ b/source/dnode/vnode/meta/src/metaTable.c @@ -0,0 +1,14 @@ +/* + * 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 . + */ \ No newline at end of file