more code

This commit is contained in:
Hongze Cheng 2023-03-28 15:38:55 +08:00
parent 03fe43dbe9
commit dc10b0196e
7 changed files with 42 additions and 14 deletions

View File

@ -42,7 +42,6 @@ static int32_t tsdbCommitOpenWriter(SCommitter *pCommitter) {
struct SSttFWriterConf conf = {
.pTsdb = pCommitter->pTsdb,
.file = {0},
.pSkmTb = NULL,
.pSkmRow = NULL,
.maxRow = pCommitter->maxRow,
@ -51,7 +50,21 @@ static int32_t tsdbCommitOpenWriter(SCommitter *pCommitter) {
.aBuf = NULL,
};
// taosArraySearch(pCommitter->pTsdb);
// pCommitter->pTsdb->pFS = NULL;
// taosbsearch(pCommitter->pTsdb->pFS->aFileSet, &pCommitter->fid, tsdbCompareFid, &lino);
struct SFileSet *pSet = NULL;
if (pSet == NULL) {
conf.file = (struct STFile){
.cid = 1,
.fid = pCommitter->fid,
.diskId = (SDiskID){0},
.type = TSDB_FTYPE_STT,
};
tsdbTFileInit(pCommitter->pTsdb, &conf.file);
} else {
// TODO
ASSERT(0);
}
code = tsdbSttFWriterOpen(&conf, &pCommitter->pWriter);
TSDB_CHECK_CODE(code, lino, _exit);

View File

@ -15,12 +15,6 @@
#include "dev.h"
struct STFileSystem {
STsdb *pTsdb;
int32_t nFileSet;
struct SFileSet *aFileSet;
};
static int32_t create_file_system(STsdb *pTsdb, struct STFileSystem **ppFS) {
ppFS[0] = taosMemoryCalloc(1, sizeof(*ppFS[0]));
if (ppFS[0] == NULL) return TSDB_CODE_OUT_OF_MEMORY;

View File

@ -30,6 +30,11 @@ int32_t tsdbOpenFileSystem(STsdb *pTsdb, struct STFileSystem **ppFS, int8_t roll
int32_t tsdbCloseFileSystem(struct STFileSystem **ppFS);
/* Exposed Structs */
struct STFileSystem {
STsdb *pTsdb;
int32_t nFileSet;
struct SFileSet *aFileSet;
};
#ifdef __cplusplus
}

View File

@ -14,8 +14,3 @@
*/
#include "dev.h"
struct SFileSet {
struct STFile *files[TSDB_FTYPE_MAX];
SRBTree fsttTree;
};

View File

@ -16,6 +16,8 @@
#ifndef _TSDB_FILE_SET_H
#define _TSDB_FILE_SET_H
#include "tsdb.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -26,6 +28,12 @@ struct SFileSet;
/* Exposed APIs */
/* Exposed Structs */
struct SFileSet {
int32_t fid;
int64_t nextid;
struct STFile *files[TSDB_FTYPE_MAX];
SRBTree fsttTree;
};
#ifdef __cplusplus
}

View File

@ -34,4 +34,15 @@ struct SFileOp {
struct {
} create;
};
};
};
int32_t tsdbTFileInit(STsdb *pTsdb, struct STFile *pFile) {
snprintf(pFile->fname, TSDB_FILENAME_LEN, "%s", pTsdb->path);
return 0;
}
int32_t tsdbTFileClear(struct STFile *pFile) {
int32_t code = 0;
// TODO
return code;
}

View File

@ -36,6 +36,8 @@ typedef enum {
} tsdb_ftype_t;
/* Exposed APIs */
int32_t tsdbTFileInit(STsdb *pTsdb, struct STFile *pFile);
int32_t tsdbTFileClear(struct STFile *pFile);
/* Exposed Structs */
struct FStt {