From 5173d85c8ca8ade1b08f7c8a85aa63c78ee3a7ff Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 23 Mar 2023 16:28:13 +0800 Subject: [PATCH] more code --- source/dnode/vnode/CMakeLists.txt | 2 +- source/dnode/vnode/src/tsdb/dev/tsdbCommit2.c | 10 +---- .../{tsdbReaderWriter2.c => tsdbSttFWriter.c} | 44 +++++++++++++++++-- .../dnode/vnode/src/tsdb/dev/tsdbSttFWriter.h | 42 ++++++++++++++++++ 4 files changed, 86 insertions(+), 12 deletions(-) rename source/dnode/vnode/src/tsdb/dev/{tsdbReaderWriter2.c => tsdbSttFWriter.c} (71%) create mode 100644 source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.h diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index 3fbb705a4e..d7fcbcb31c 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -57,7 +57,7 @@ target_sources( # # dev "src/tsdb/dev/tsdbCommit2.c" "src/tsdb/dev/tsdbMerge.c" - "src/tsdb/dev/tsdbReaderWriter2.c" + "src/tsdb/dev/tsdbSttFWriter.c" # tq "src/tq/tq.c" diff --git a/source/dnode/vnode/src/tsdb/dev/tsdbCommit2.c b/source/dnode/vnode/src/tsdb/dev/tsdbCommit2.c index 8438821943..f4eff3e9af 100644 --- a/source/dnode/vnode/src/tsdb/dev/tsdbCommit2.c +++ b/source/dnode/vnode/src/tsdb/dev/tsdbCommit2.c @@ -13,15 +13,9 @@ * along with this program. If not, see . */ -#include "tsdb.h" +#include "tsdbSttFWriter.h" // extern dependencies -typedef struct SSttFWriter SSttFWriter; - -extern int32_t tsdbSttFWriterOpen(STsdb *pTsdb, const SSttFile *pSttFile, SSttFWriter **ppWriter); -extern int32_t tsdbSttFWriterClose(SSttFWriter *pWriter); -extern int32_t tsdbSttFWriteTSData(SSttFWriter *pWriter, TABLEID *tbid, TSDBROW *pRow); - typedef struct { STsdb *pTsdb; // config @@ -48,7 +42,7 @@ static int32_t tsdbCommitOpenWriter(SCommitter *pCommitter) { SSttFile sttFile = {0}; // TODO - code = tsdbSttFWriterOpen(pCommitter->pTsdb, &sttFile, &pCommitter->pWriter); + code = tsdbSttFWriterOpen(NULL /*TODO*/, &pCommitter->pWriter); TSDB_CHECK_CODE(code, lino, _exit); _exit: diff --git a/source/dnode/vnode/src/tsdb/dev/tsdbReaderWriter2.c b/source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c similarity index 71% rename from source/dnode/vnode/src/tsdb/dev/tsdbReaderWriter2.c rename to source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c index 64cff95702..470a4f57c3 100644 --- a/source/dnode/vnode/src/tsdb/dev/tsdbReaderWriter2.c +++ b/source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c @@ -1,8 +1,45 @@ -#include "tsdb.h" +/* + * 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 . + */ -typedef struct SSttFWriter SSttFWriter; -typedef struct SSttFReader SSttFReader; +#include "tsdbSttFWriter.h" +int32_t tsdbSttFWriterOpen(const SSttFWriterConf *pConf, SSttFWriter **ppWriter) { + int32_t code = 0; + // TODO + return code; +} + +int32_t tsdbSttFWriterClose(SSttFWriter **ppWriter) { + int32_t code = 0; + // TODO + return code; +} + +int32_t tsdbSttFWriteTSData(SSttFWriter *pWriter, TABLEID *tbid, TSDBROW *pRow) { + int32_t code = 0; + // TODO + return code; +} + +int32_t tsdbSttFWriteDLData(SSttFWriter *pWriter, TABLEID *tbid, SDelData *pDelData) { + int32_t code = 0; + // TODO + return code; +} + +#if 0 extern int32_t tsdbOpenFile(const char *path, int32_t szPage, int32_t flag, STsdbFD **ppFD); extern void tsdbCloseFile(STsdbFD **ppFD); struct SSttFWriter { @@ -104,3 +141,4 @@ int32_t tsdbSttFWriteDLData(SSttFWriter *pWriter, int64_t suid, int64_t uid, int // TODO write row return 0; } +#endif \ No newline at end of file diff --git a/source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.h b/source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.h new file mode 100644 index 0000000000..b4e842c129 --- /dev/null +++ b/source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.h @@ -0,0 +1,42 @@ +/* + * 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 _TSDB_STT_FILE_WRITER_H +#define _TSDB_STT_FILE_WRITER_H + +#include "tsdb.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct SSttFWriter SSttFWriter; +typedef struct SSttFWriterConf SSttFWriterConf; + +int32_t tsdbSttFWriterOpen(const SSttFWriterConf *pConf, SSttFWriter **ppWriter); +int32_t tsdbSttFWriterClose(SSttFWriter **ppWriter); +int32_t tsdbSttFWriteTSData(SSttFWriter *pWriter, TABLEID *tbid, TSDBROW *pRow); +int32_t tsdbSttFWriteDLData(SSttFWriter *pWriter, TABLEID *tbid, SDelData *pDelData); + +struct SSttFWriterConf { + STsdb *pTsdb; + int32_t maxRow; +}; + +#ifdef __cplusplus +} +#endif + +#endif /*_TSDB_STT_FILE_WRITER_H*/ \ No newline at end of file