refact more code

This commit is contained in:
Hongze Cheng 2023-04-23 15:45:57 +08:00
parent eba557effe
commit 172eeee609
10 changed files with 62 additions and 47 deletions

View File

@ -22,26 +22,17 @@
extern "C" { extern "C" {
#endif #endif
typedef struct SFDataPtr { #include "inc/tsdbUtil.h"
int64_t offset;
int64_t size;
} SFDataPtr;
typedef struct { #include "inc/tsdbFile.h"
int64_t prevFooter;
SFDataPtr dict[4]; // 0:bloom filter, 1:SSttBlk, 2:STbStatisBlk, 3:SDelBlk
uint8_t reserved[24];
} SFSttFooter;
#include "tsdbUtil.h" #include "inc/tsdbFSet.h"
#include "tsdbFile.h" #include "inc/tsdbFS.h"
#include "tsdbFSet.h" #include "inc/tsdbSttFReaderWriter.h"
#include "tsdbFS.h" #include "inc/tsdbDataFReaderWriter.h"
#include "tsdbSttFWriter.h"
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -13,30 +13,25 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _TD_TSDB_STT_FILE_READER_H #include "tsdbDef.h"
#define _TD_TSDB_STT_FILE_READER_H
#include "tsdb.h" #ifndef _TD_TSDB_DATA_F_READER_WRITER_H_
#define _TD_TSDB_DATA_F_READER_WRITER_H_
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* Exposed Handle */ /* Exposed Handle */
struct SSttFReader; typedef struct SDataFReader SDataFReader;
struct SSttFReaderConf; typedef struct SDataFWriter SDataFWriter;
/* Exposed APIs */ /* Exposed APIs */
int32_t tsdbSttFReaderOpen(const struct SSttFReaderConf *pConf, struct SSttFReader **ppReader);
int32_t tsdbSttFReaderClose(struct SSttFReader *pReader);
/* Exposed Structs */ /* Exposed Structs */
struct SSttFReaderConf {
// TODO
};
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /*_TD_TSDB_STT_FILE_READER_H*/ #endif /*_TD_TSDB_DATA_F_READER_WRITER_H_*/

View File

@ -0,0 +1,39 @@
/*
* 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_DEF_H_
#define _TD_TSDB_DEF_H_
#include "tsdb.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct SFDataPtr {
int64_t offset;
int64_t size;
} SFDataPtr;
typedef struct {
int64_t prevFooter;
SFDataPtr dict[4]; // 0:bloom filter, 1:SSttBlk, 2:STbStatisBlk, 3:SDelBlk
uint8_t reserved[24];
} SFSttFooter;
#ifdef __cplusplus
}
#endif
#endif /*_TD_TSDB_DEF_H_*/

View File

@ -16,7 +16,7 @@
#ifndef _TSDB_FILE_SYSTEM_H #ifndef _TSDB_FILE_SYSTEM_H
#define _TSDB_FILE_SYSTEM_H #define _TSDB_FILE_SYSTEM_H
#include "tsdb.h" #include "tsdbDef.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -16,7 +16,7 @@
#ifndef _TSDB_FILE_SET_H #ifndef _TSDB_FILE_SET_H
#define _TSDB_FILE_SET_H #define _TSDB_FILE_SET_H
#include "tsdb.h" #include "tsdbDef.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -16,7 +16,7 @@
#ifndef _TSDB_FILE_H #ifndef _TSDB_FILE_H
#define _TSDB_FILE_H #define _TSDB_FILE_H
#include "tsdb.h" #include "tsdbDef.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -16,7 +16,7 @@
#ifndef _TSDB_STT_FILE_WRITER_H #ifndef _TSDB_STT_FILE_WRITER_H
#define _TSDB_STT_FILE_WRITER_H #define _TSDB_STT_FILE_WRITER_H
#include "tsdbFile.h" #include "tsdbDef.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -16,7 +16,7 @@
#ifndef _TSDB_UTIL_H #ifndef _TSDB_UTIL_H
#define _TSDB_UTIL_H #define _TSDB_UTIL_H
#include "tsdb.h" #include "tsdbDef.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -13,23 +13,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tsdbSttFReader.h"
#include "dev.h" #include "dev.h"
struct SSttFReader { struct SDataFReader {
STsdb *pTsdb; STsdb *pTsdb;
SFSttFooter footer; // TODO
const void *bloomFilter;
}; };
int32_t tsdbSttFReaderOpen(const struct SSttFReaderConf *pConf, struct SSttFReader **ppReader) { struct SDataFWriter {
int32_t code = 0; STsdb *pTsdb;
// TODO };
return code;
}
int32_t tsdbSttFReaderClose(struct SSttFReader *pReader) {
int32_t code = 0;
// TODO
return code;
}