refact vnode
This commit is contained in:
parent
90fb44be8f
commit
224e6ccbcb
|
@ -18,13 +18,9 @@ target_sources(
|
||||||
|
|
||||||
# meta
|
# meta
|
||||||
# "src/meta/metaBDBImpl.c"
|
# "src/meta/metaBDBImpl.c"
|
||||||
"src/meta/metaCfg.c"
|
|
||||||
"src/meta/metaIdx.c"
|
"src/meta/metaIdx.c"
|
||||||
"src/meta/metaMain.c"
|
"src/meta/metaMain.c"
|
||||||
"src/meta/metaQuery.c"
|
|
||||||
"src/meta/metaTable.c"
|
"src/meta/metaTable.c"
|
||||||
"src/meta/metaTbCfg.c"
|
|
||||||
"src/meta/metaTbTag.c"
|
|
||||||
"src/meta/metaTbUid.c"
|
"src/meta/metaTbUid.c"
|
||||||
"src/meta/metaTDBImpl.c"
|
"src/meta/metaTDBImpl.c"
|
||||||
|
|
||||||
|
|
|
@ -75,11 +75,6 @@ int metaRemoveSmaFromDb(SMeta* pMeta, int64_t indexUid);
|
||||||
int metaOpenCache(SMeta* pMeta);
|
int metaOpenCache(SMeta* pMeta);
|
||||||
void metaCloseCache(SMeta* pMeta);
|
void metaCloseCache(SMeta* pMeta);
|
||||||
|
|
||||||
// SMetaCfg
|
|
||||||
extern const SMetaCfg defaultMetaOptions;
|
|
||||||
// int metaValidateOptions(const SMetaCfg*);
|
|
||||||
void metaOptionsCopy(SMetaCfg* pDest, const SMetaCfg* pSrc);
|
|
||||||
|
|
||||||
// SMetaIdx
|
// SMetaIdx
|
||||||
int metaOpenIdx(SMeta* pMeta);
|
int metaOpenIdx(SMeta* pMeta);
|
||||||
void metaCloseIdx(SMeta* pMeta);
|
void metaCloseIdx(SMeta* pMeta);
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
/*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "vnodeInt.h"
|
|
||||||
|
|
||||||
const SMetaCfg defaultMetaOptions = {.lruSize = 0};
|
|
||||||
|
|
||||||
/* ------------------------ EXPOSED METHODS ------------------------ */
|
|
||||||
|
|
||||||
int metaValidateOptions(const SMetaCfg *pMetaOptions) {
|
|
||||||
// TODO
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void metaOptionsCopy(SMetaCfg *pDest, const SMetaCfg *pSrc) { memcpy(pDest, pSrc, sizeof(*pSrc)); }
|
|
||||||
|
|
||||||
/* ------------------------ STATIC METHODS ------------------------ */
|
|
|
@ -25,17 +25,6 @@ static void metaCloseImpl(SMeta *pMeta);
|
||||||
SMeta *metaOpen(const char *path, const SMetaCfg *pMetaCfg, SMemAllocatorFactory *pMAF) {
|
SMeta *metaOpen(const char *path, const SMetaCfg *pMetaCfg, SMemAllocatorFactory *pMAF) {
|
||||||
SMeta *pMeta = NULL;
|
SMeta *pMeta = NULL;
|
||||||
|
|
||||||
// Set default options
|
|
||||||
if (pMetaCfg == NULL) {
|
|
||||||
pMetaCfg = &defaultMetaOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
// // Validate the options
|
|
||||||
// if (metaValidateOptions(pMetaCfg) < 0) {
|
|
||||||
// // TODO: deal with error
|
|
||||||
// return NULL;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Allocate handle
|
// Allocate handle
|
||||||
pMeta = metaNew(path, pMetaCfg, pMAF);
|
pMeta = metaNew(path, pMetaCfg, pMAF);
|
||||||
if (pMeta == NULL) {
|
if (pMeta == NULL) {
|
||||||
|
@ -80,9 +69,6 @@ static SMeta *metaNew(const char *path, const SMetaCfg *pMetaCfg, SMemAllocatorF
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
metaOptionsCopy(&(pMeta->options), pMetaCfg);
|
|
||||||
pMeta->pmaf = pMAF;
|
|
||||||
|
|
||||||
return pMeta;
|
return pMeta;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
/*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "vnodeInt.h"
|
|
|
@ -1,48 +0,0 @@
|
||||||
/*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "vnodeInt.h"
|
|
||||||
|
|
||||||
int metaValidateTbCfg(SMeta *pMeta, const STbCfg *pTbOptions) {
|
|
||||||
// TODO
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t metaEncodeTbObjFromTbOptions(const STbCfg *pTbOptions, void *pBuf, size_t bsize) {
|
|
||||||
void **ppBuf = &pBuf;
|
|
||||||
int tlen = 0;
|
|
||||||
|
|
||||||
tlen += taosEncodeFixedU8(ppBuf, pTbOptions->type);
|
|
||||||
tlen += taosEncodeString(ppBuf, pTbOptions->name);
|
|
||||||
tlen += taosEncodeFixedU32(ppBuf, pTbOptions->ttl);
|
|
||||||
|
|
||||||
switch (pTbOptions->type) {
|
|
||||||
case META_SUPER_TABLE:
|
|
||||||
tlen += taosEncodeFixedU64(ppBuf, pTbOptions->stbCfg.suid);
|
|
||||||
tlen += tdEncodeSchema(ppBuf, (STSchema *)pTbOptions->stbCfg.pTagSchema);
|
|
||||||
// TODO: encode schema version array
|
|
||||||
break;
|
|
||||||
case META_CHILD_TABLE:
|
|
||||||
tlen += taosEncodeFixedU64(ppBuf, pTbOptions->ctbCfg.suid);
|
|
||||||
break;
|
|
||||||
case META_NORMAL_TABLE:
|
|
||||||
// TODO: encode schema version array
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return tlen;
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
/*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "vnodeInt.h"
|
|
Loading…
Reference in New Issue