提交 23e78dd9 编写于 作者: H Hongze Cheng

more code

上级 8f84e886
......@@ -40,9 +40,20 @@ static int32_t tsdbCommitOpenWriter(SCommitter *pCommitter) {
int32_t code;
int32_t lino;
SSttFile sttFile = {0}; // TODO
code = tsdbSttFWriterOpen(NULL /*TODO*/, &pCommitter->pWriter);
struct SSttFWriterConf conf = {
.pTsdb = pCommitter->pTsdb,
.file = {0},
.pSkmTb = NULL,
.pSkmRow = NULL,
.maxRow = pCommitter->maxRow,
.szPage = pCommitter->pTsdb->pVnode->config.tsdbPageSize,
.cmprAlg = pCommitter->cmprAlg,
.aBuf = NULL,
};
// taosArraySearch(pCommitter->pTsdb);
code = tsdbSttFWriterOpen(&conf, &pCommitter->pWriter);
TSDB_CHECK_CODE(code, lino, _exit);
_exit:
......
......@@ -37,7 +37,7 @@ static int32_t destroy_file_system(struct STFileSystem **ppFS) {
return 0;
}
static int32_t open_file_system(struct STFileSystem *pFS) {
static int32_t open_file_system(struct STFileSystem *pFS, int8_t rollback) {
// TODO
return 0;
}
......@@ -47,14 +47,14 @@ static int32_t close_file_system(struct STFileSystem *pFS) {
return 0;
}
int32_t tsdbOpenFileSystem(STsdb *pTsdb, struct STFileSystem **ppFS) {
int32_t tsdbOpenFileSystem(STsdb *pTsdb, struct STFileSystem **ppFS, int8_t rollback) {
int32_t code;
int32_t lino;
code = create_file_system(pTsdb, ppFS);
TSDB_CHECK_CODE(code, lino, _exit);
code = open_file_system(ppFS[0]);
code = open_file_system(ppFS[0], rollback);
TSDB_CHECK_CODE(code, lino, _exit);
_exit:
......
......@@ -26,7 +26,7 @@ extern "C" {
struct STFileSystem;
/* Exposed APIs */
int32_t tsdbOpenFileSystem(STsdb *pTsdb, struct STFileSystem **ppFS);
int32_t tsdbOpenFileSystem(STsdb *pTsdb, struct STFileSystem **ppFS, int8_t rollback);
int32_t tsdbCloseFileSystem(struct STFileSystem **ppFS);
/* Exposed Structs */
......
/*
* 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/>.
*/
\ No newline at end of file
/*
* 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_TSDB_STT_FILE_READER_H
#define _TD_TSDB_STT_FILE_READER_H
#ifdef __cplusplus
extern "C" {
#endif
/* Exposed Handle */
/* Exposed APIs */
/* Exposed Structs */
#ifdef __cplusplus
}
#endif
#endif /*_TD_TSDB_STT_FILE_READER_H*/
\ No newline at end of file
......@@ -14,6 +14,9 @@
*/
#include "tsdb.h"
#ifdef USE_DEV_CODE
#include "dev/dev.h"
#endif
int32_t tsdbSetKeepCfg(STsdb *pTsdb, STsdbCfg *pCfg) {
STsdbKeepCfg *pKeepCfg = &pTsdb->keepCfg;
......@@ -65,10 +68,16 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee
taosMkDir(pTsdb->path);
}
// open tsdb
// open tsdb
#ifdef USE_DEV_CODE
if (tsdbOpenFileSystem(pTsdb, &pTsdb->pFS, rollback) < 0) {
goto _err;
}
#else
if (tsdbFSOpen(pTsdb, rollback) < 0) {
goto _err;
}
#endif
if (tsdbOpenCache(pTsdb) < 0) {
goto _err;
......@@ -94,7 +103,11 @@ int tsdbClose(STsdb **pTsdb) {
taosThreadRwlockDestroy(&(*pTsdb)->rwLock);
#ifndef USE_DEV_CODE
tsdbFSClose(*pTsdb);
#else
tsdbCloseFileSystem(&(*pTsdb)->pFS);
#endif
tsdbCloseCache(*pTsdb);
taosMemoryFreeClear(*pTsdb);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册