TDengine/source/dnode/vnode/src/tsdb/dev/inc/tsdbDataFileRW.h

80 lines
2.7 KiB
C
Raw Normal View History

2023-03-27 11:12:25 +00:00
/*
* 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/>.
*/
2023-04-23 07:45:57 +00:00
#include "tsdbDef.h"
2023-05-28 15:33:03 +00:00
#include "tsdbFSet.h"
2023-05-29 07:58:54 +00:00
#include "tsdbUtil.h"
2023-03-27 11:12:25 +00:00
2023-05-27 15:08:08 +00:00
#ifndef _TSDB_DATA_FILE_RW_H
#define _TSDB_DATA_FILE_RW_H
2023-04-06 06:27:18 +00:00
2023-03-27 11:12:25 +00:00
#ifdef __cplusplus
extern "C" {
#endif
2023-05-29 07:58:54 +00:00
typedef TARRAY2(SBlockIdx) TBlockIdxArray;
typedef TARRAY2(SDataBlk) TDataBlkArray;
2023-06-02 06:39:54 +00:00
typedef TARRAY2(SColumnDataAgg) TColumnDataAggArray;
2023-03-27 11:12:25 +00:00
2023-05-29 07:58:54 +00:00
// SDataFileReader =============================================
typedef struct SDataFileReader SDataFileReader;
typedef struct SDataFileReaderConfig {
STsdb *tsdb;
int32_t szPage;
2023-06-02 09:36:14 +00:00
struct {
bool exist;
STFile file;
} files[TSDB_FTYPE_MAX];
uint8_t **bufArr;
2023-05-29 07:58:54 +00:00
} SDataFileReaderConfig;
int32_t tsdbDataFileReaderOpen(const char *fname[/* TSDB_FTYPE_MAX */], const SDataFileReaderConfig *config,
SDataFileReader **reader);
2023-06-02 09:36:14 +00:00
int32_t tsdbDataFileReaderClose(SDataFileReader **reader);
2023-05-29 07:58:54 +00:00
int32_t tsdbDataFileReadBlockIdx(SDataFileReader *reader, const TBlockIdxArray **blockIdxArray);
int32_t tsdbDataFileReadDataBlk(SDataFileReader *reader, const SBlockIdx *blockIdx, const TDataBlkArray **dataBlkArray);
int32_t tsdbDataFileReadDataBlock(SDataFileReader *reader, const SDataBlk *dataBlk, SBlockData *bData);
2023-05-28 15:33:03 +00:00
2023-04-23 09:37:12 +00:00
// SDataFileWriter =============================================
2023-05-28 15:33:03 +00:00
typedef struct SDataFileWriter SDataFileWriter;
typedef struct SDataFileWriterConfig {
2023-06-02 09:36:14 +00:00
STsdb *tsdb;
int8_t cmprAlg;
int32_t maxRow;
int32_t szPage;
int32_t fid;
int64_t cid;
SDiskID did;
int64_t compactVersion;
struct {
bool exist;
STFile file;
} files[TSDB_FTYPE_MAX];
2023-06-01 10:56:40 +00:00
SSkmInfo *skmTb;
SSkmInfo *skmRow;
uint8_t **bufArr;
2023-05-28 15:33:03 +00:00
} SDataFileWriterConfig;
2023-04-23 10:00:02 +00:00
2023-05-27 03:49:59 +00:00
int32_t tsdbDataFileWriterOpen(const SDataFileWriterConfig *config, SDataFileWriter **writer);
2023-05-28 15:33:03 +00:00
int32_t tsdbDataFileWriterClose(SDataFileWriter **writer, bool abort, STFileOp op[/*TSDB_FTYPE_MAX*/]);
2023-06-01 09:05:20 +00:00
int32_t tsdbDataFileWriteTSData(SDataFileWriter *writer, SRowInfo *row);
2023-05-29 10:42:31 +00:00
int32_t tsdbDataFileWriteTSDataBlock(SDataFileWriter *writer, SBlockData *bData);
2023-06-02 09:36:14 +00:00
int32_t tsdbDataFileFlushTSDataBlock(SDataFileWriter *writer);
2023-03-27 11:12:25 +00:00
#ifdef __cplusplus
}
#endif
2023-05-27 15:08:08 +00:00
#endif /*_TSDB_DATA_FILE_RW_H*/