提交 f5286359 编写于 作者: H Hongze Cheng

more code

上级 7acc124d
......@@ -30,6 +30,11 @@ typedef struct SDataFileReaderConfig SDataFileReaderConfig;
typedef struct SDataFileWriter SDataFileWriter;
typedef struct SDataFileWriterConfig SDataFileWriterConfig;
int32_t tsdbDataFileWriterOpen(const SDataFileWriterConfig *config, SDataFileWriter **ppWriter);
int32_t tsdbDataFileWriterClose(SDataFileWriter *pWriter);
int32_t tsdbDataFileWriteTSData(SDataFileWriter *pWriter, SBlockData *pBlockData);
int32_t tsdbDataFileWriteTSDataBlock(SDataFileWriter *pWriter, SBlockData *pBlockData);
struct SDataFileReaderConfig {
STsdb *pTsdb;
// TODO
......
......@@ -22,7 +22,7 @@
extern "C" {
#endif
// SSttFReader ==========================================
// SSttFileReader ==========================================
typedef struct SSttFSegReader SSttFSegReader;
typedef struct SSttFileReader SSttFileReader;
typedef struct SSttFileReaderConfig SSttFileReaderConfig;
......@@ -50,7 +50,7 @@ struct SSttFileReaderConfig {
// TODO
};
// SSttFWriter ==========================================
// SSttFileWriter ==========================================
typedef struct SSttFileWriter SSttFileWriter;
typedef struct SSttFileWriterConfig SSttFileWriterConfig;
......
......@@ -23,4 +23,52 @@ struct SDataFileReader {
// SDataFileWriter =============================================
struct SDataFileWriter {
// TODO
};
\ No newline at end of file
};
int32_t tsdbDataFileWriterOpen(const SDataFileWriterConfig *config, SDataFileWriter **ppWriter) {
int32_t code = 0;
int32_t lino = 0;
int32_t vid = TD_VID(config->pTsdb->pVnode);
// TODO
_exit:
if (code) {
tsdbError("vgId:%d %s failed at line %d since %s", vid, __func__, lino, tstrerror(code));
}
return code;
}
int32_t tsdbDataFileWriterClose(SDataFileWriter *pWriter) {
int32_t code = 0;
int32_t lino = 0;
int32_t vid = 0; // TODO: TD_VID(config->pTsdb->pVnode);
// TODO
_exit:
if (code) {
tsdbError("vgId:%d %s failed at line %d since %s", vid, __func__, lino, tstrerror(code));
}
return code;
}
int32_t tsdbDataFileWriteTSData(SDataFileWriter *pWriter, SBlockData *pBlockData) {
int32_t code = 0;
int32_t lino = 0;
int32_t vid = 0; // TODO: TD_VID(config->pTsdb->pVnode);
// TODO
_exit:
if (code) {
tsdbError("vgId:%d %s failed at line %d since %s", vid, __func__, lino, tstrerror(code));
}
return code;
}
int32_t tsdbDataFileWriteTSDataBlock(SDataFileWriter *pWriter, SBlockData *pBlockData) {
int32_t code = 0;
int32_t lino = 0;
int32_t vid = 0; // TODO: TD_VID(config->pTsdb->pVnode);
// TODO
_exit:
if (code) {
tsdbError("vgId:%d %s failed at line %d since %s", vid, __func__, lino, tstrerror(code));
}
return code;
}
\ No newline at end of file
......@@ -197,9 +197,13 @@ static int32_t tsdbMergeFileSetBegin(SMerger *merger) {
merger->ctx.level++;
// open the reader
SSttFileReader *reader;
// code = tsdbSttFileReaderOpen(&fobj->f.stt, &reader);
// TSDB_CHECK_CODE(code, lino, _exit);
SSttFileReader *reader;
SSttFileReaderConfig config = {
.pTsdb = merger->tsdb,
// TODO
};
code = tsdbSttFReaderOpen(&config, &reader);
TSDB_CHECK_CODE(code, lino, _exit);
code = TARRAY2_APPEND(&merger->sttReaderArr, reader);
TSDB_CHECK_CODE(code, lino, _exit);
......@@ -216,34 +220,50 @@ static int32_t tsdbMergeFileSetBegin(SMerger *merger) {
}
// open stt file writer
SSttFileWriterConfig config = {
.pTsdb = merger->tsdb,
.maxRow = merger->maxRow,
.szPage = merger->szPage,
.cmprAlg = merger->cmprAlg,
.pSkmTb = &merger->skmTb,
.pSkmRow = &merger->skmRow,
.aBuf = merger->aBuf,
};
if (lvl) {
config.file = fobj->f;
SSttFileWriterConfig config = {
.pTsdb = merger->tsdb,
.maxRow = merger->maxRow,
.szPage = merger->szPage,
.cmprAlg = merger->cmprAlg,
.pSkmTb = &merger->skmTb,
.pSkmRow = &merger->skmRow,
.aBuf = merger->aBuf,
.file = fobj->f,
};
code = tsdbSttFWriterOpen(&config, &merger->sttWriter);
TSDB_CHECK_CODE(code, lino, _exit);
} else {
config.file = (STFile){
.type = TSDB_FTYPE_STT,
.did = {.level = 0, .id = 0},
.fid = fset->fid,
.cid = merger->cid,
.size = 0,
.stt = {.level = merger->ctx.level, .nseg = 0},
SSttFileWriterConfig config = {
.pTsdb = merger->tsdb,
.maxRow = merger->maxRow,
.szPage = merger->szPage,
.cmprAlg = merger->cmprAlg,
.pSkmTb = &merger->skmTb,
.pSkmRow = &merger->skmRow,
.aBuf = merger->aBuf,
.file =
(STFile){
.type = TSDB_FTYPE_STT,
.did = {.level = 0, .id = 0},
.fid = fset->fid,
.cid = merger->cid,
.size = 0,
.stt = {.level = merger->ctx.level, .nseg = 0},
},
};
code = tsdbSttFWriterOpen(&config, &merger->sttWriter);
TSDB_CHECK_CODE(code, lino, _exit);
}
code = tsdbSttFWriterOpen(&config, &merger->sttWriter);
TSDB_CHECK_CODE(code, lino, _exit);
// open data file writer
if (merger->ctx.toData) {
// code = tsdbDataFWriterOpen();
// TSDB_CHECK_CODE(code, lino, _exit);
SDataFileWriterConfig config = {
.pTsdb = merger->tsdb,
// TODO
};
code = tsdbDataFileWriterOpen(&config, &merger->dataWriter);
TSDB_CHECK_CODE(code, lino, _exit);
}
_exit:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册