more code
This commit is contained in:
parent
172eeee609
commit
81efe36d30
|
@ -21,16 +21,19 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
typedef struct SFDataPtr {
|
||||
|
||||
typedef struct SFDataPtr SFDataPtr;
|
||||
|
||||
extern int32_t tsdbOpenFile(const char *path, int32_t szPage, int32_t flag, STsdbFD **ppFD);
|
||||
extern void tsdbCloseFile(STsdbFD **ppFD);
|
||||
extern int32_t tsdbWriteFile(STsdbFD *pFD, int64_t offset, const uint8_t *pBuf, int64_t size);
|
||||
extern int32_t tsdbReadFile(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64_t size);
|
||||
extern int32_t tsdbFsyncFile(STsdbFD *pFD);
|
||||
|
||||
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
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#ifndef _TSDB_FILE_SYSTEM_H
|
||||
#define _TSDB_FILE_SYSTEM_H
|
||||
|
||||
#include "tsdbDef.h"
|
||||
#include "tsdbFSet.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#ifndef _TSDB_FILE_SET_H
|
||||
#define _TSDB_FILE_SET_H
|
||||
|
||||
#include "tsdbDef.h"
|
||||
#include "tsdbFile.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -33,10 +33,10 @@ typedef enum {
|
|||
} tsdb_fop_t;
|
||||
|
||||
struct SFileOp {
|
||||
tsdb_fop_t op;
|
||||
int32_t fid;
|
||||
struct STFile oState; // old file state
|
||||
struct STFile nState; // new file state
|
||||
tsdb_fop_t op;
|
||||
int32_t fid;
|
||||
STFile oState; // old file state
|
||||
STFile nState; // new file state
|
||||
};
|
||||
|
||||
struct SSttLvl {
|
||||
|
|
|
@ -66,7 +66,7 @@ struct STFile {
|
|||
} tomb;
|
||||
};
|
||||
|
||||
LISTD(struct STFile) listNode;
|
||||
LISTD(STFile) listNode;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -16,28 +16,47 @@
|
|||
#ifndef _TSDB_STT_FILE_WRITER_H
|
||||
#define _TSDB_STT_FILE_WRITER_H
|
||||
|
||||
#include "tsdbDef.h"
|
||||
#include "tsdbFS.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct SSttFWriter;
|
||||
struct SSttFWriterConf {
|
||||
STsdb *pTsdb;
|
||||
struct STFile file;
|
||||
int32_t maxRow;
|
||||
int32_t szPage;
|
||||
int8_t cmprAlg;
|
||||
SSkmInfo *pSkmTb;
|
||||
SSkmInfo *pSkmRow;
|
||||
uint8_t **aBuf;
|
||||
// SSttFReader ==========================================
|
||||
typedef struct SSttFReader SSttFReader;
|
||||
typedef struct SSttFReaderConfig SSttFReaderConfig;
|
||||
|
||||
int32_t tsdbSttFReaderOpen(const SSttFReaderConfig *config, SSttFReader **ppReader);
|
||||
int32_t tsdbSttFReaderClose(SSttFReader **ppReader);
|
||||
|
||||
// SSttFWriter ==========================================
|
||||
typedef struct SSttFWriter SSttFWriter;
|
||||
typedef struct SSttFWriterConfig SSttFWriterConfig;
|
||||
|
||||
int32_t tsdbSttFWriterOpen(const SSttFWriterConfig *config, SSttFWriter **ppWriter);
|
||||
int32_t tsdbSttFWriterClose(SSttFWriter **ppWriter, int8_t abort, struct SFileOp *op);
|
||||
int32_t tsdbSttFWriteTSData(SSttFWriter *pWriter, TABLEID *tbid, TSDBROW *pRow);
|
||||
int32_t tsdbSttFWriteDLData(SSttFWriter *pWriter, TABLEID *tbid, SDelData *pDelData);
|
||||
|
||||
/* ------------------------------------------------- */
|
||||
struct SSttFWriterConfig {
|
||||
STsdb *pTsdb;
|
||||
STFile file;
|
||||
int32_t maxRow;
|
||||
int32_t szPage;
|
||||
int8_t cmprAlg;
|
||||
SSkmInfo *pSkmTb;
|
||||
SSkmInfo *pSkmRow;
|
||||
uint8_t **aBuf;
|
||||
};
|
||||
|
||||
int32_t tsdbSttFWriterOpen(const struct SSttFWriterConf *pConf, struct SSttFWriter **ppWriter);
|
||||
int32_t tsdbSttFWriterClose(struct SSttFWriter **ppWriter, int8_t abort, struct SFileOp *op);
|
||||
int32_t tsdbSttFWriteTSData(struct SSttFWriter *pWriter, TABLEID *tbid, TSDBROW *pRow);
|
||||
int32_t tsdbSttFWriteDLData(struct SSttFWriter *pWriter, TABLEID *tbid, SDelData *pDelData);
|
||||
struct SSttFReaderConfig {
|
||||
STsdb *pTsdb;
|
||||
SSkmInfo *pSkmTb;
|
||||
SSkmInfo *pSkmRow;
|
||||
uint8_t **aBuf;
|
||||
// TODO
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ static int32_t open_committer_writer(SCommitter *pCommitter) {
|
|||
|
||||
STsdb *pTsdb = pCommitter->pTsdb;
|
||||
|
||||
struct SSttFWriterConf conf = {
|
||||
struct SSttFWriterConfig conf = {
|
||||
.pTsdb = pCommitter->pTsdb,
|
||||
.maxRow = pCommitter->maxRow,
|
||||
.szPage = pCommitter->pTsdb->pVnode->config.tsdbPageSize,
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
|
||||
#include "dev.h"
|
||||
|
||||
struct SDataFReader {
|
||||
STsdb *pTsdb;
|
||||
// TODO
|
||||
};
|
||||
// struct SDataFReader {
|
||||
// STsdb *pTsdb;
|
||||
// // TODO
|
||||
// };
|
||||
|
||||
struct SDataFWriter {
|
||||
STsdb *pTsdb;
|
||||
};
|
||||
// struct SDataFWriter {
|
||||
// STsdb *pTsdb;
|
||||
// };
|
|
@ -15,16 +15,16 @@
|
|||
|
||||
#include "dev.h"
|
||||
|
||||
extern int32_t tsdbOpenFile(const char *path, int32_t szPage, int32_t flag, STsdbFD **ppFD);
|
||||
extern void tsdbCloseFile(STsdbFD **ppFD);
|
||||
extern int32_t tsdbWriteFile(STsdbFD *pFD, int64_t offset, const uint8_t *pBuf, int64_t size);
|
||||
extern int32_t tsdbReadFile(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64_t size);
|
||||
extern int32_t tsdbFsyncFile(STsdbFD *pFD);
|
||||
typedef struct {
|
||||
int64_t prevFooter;
|
||||
SFDataPtr dict[4]; // 0:bloom filter, 1:SSttBlk, 2:STbStatisBlk, 3:SDelBlk
|
||||
uint8_t reserved[24];
|
||||
} SFSttFooter;
|
||||
|
||||
struct SSttFWriter {
|
||||
struct SSttFWriterConf config;
|
||||
SSttFWriterConfig config;
|
||||
// file
|
||||
struct STFile tFile;
|
||||
STFile tFile;
|
||||
// data
|
||||
SFSttFooter footer;
|
||||
SBlockData bData;
|
||||
|
@ -325,7 +325,7 @@ static int32_t write_file_header(struct SSttFWriter *pWriter) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t create_stt_fwriter(const struct SSttFWriterConf *pConf, struct SSttFWriter **ppWriter) {
|
||||
static int32_t create_stt_fwriter(const SSttFWriterConfig *pConf, struct SSttFWriter **ppWriter) {
|
||||
int32_t code = 0;
|
||||
|
||||
// alloc
|
||||
|
@ -449,7 +449,7 @@ static int32_t close_stt_fwriter(struct SSttFWriter *pWriter) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t tsdbSttFWriterOpen(const struct SSttFWriterConf *pConf, struct SSttFWriter **ppWriter) {
|
||||
int32_t tsdbSttFWriterOpen(const SSttFWriterConfig *pConf, struct SSttFWriter **ppWriter) {
|
||||
int32_t code = 0;
|
||||
int32_t lino;
|
||||
|
||||
|
|
Loading…
Reference in New Issue