more code

This commit is contained in:
Hongze Cheng 2023-05-15 17:26:00 +08:00
parent 68f07c4bec
commit f8220e8b90
3 changed files with 14 additions and 13 deletions

View File

@ -58,9 +58,9 @@ typedef struct SSttLvl {
} SSttLvl; } SSttLvl;
struct STFileSet { struct STFileSet {
int32_t fid; int32_t fid;
STFile *farr[TSDB_FTYPE_MAX]; // file array STFileObj *farr[TSDB_FTYPE_MAX]; // file array
SRBTree lvlTree; // level tree of .stt SRBTree lvlTree; // level tree of .stt
}; };
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -22,7 +22,8 @@
extern "C" { extern "C" {
#endif #endif
typedef struct STFile STFile; typedef struct STFile STFile;
typedef struct STFileObj STFileObj;
typedef enum { typedef enum {
TSDB_FTYPE_HEAD = 0, // .head TSDB_FTYPE_HEAD = 0, // .head

View File

@ -50,7 +50,7 @@ static int32_t add_file(STFileSet *fset, STFile *f) {
// lvl->nstt++; // lvl->nstt++;
// lvl->fstt = f; // lvl->fstt = f;
} else { } else {
fset->farr[f->type] = f; // fset->farr[f->type] = f;
} }
return 0; return 0;
@ -69,8 +69,8 @@ int32_t tsdbFileSetToJson(const STFileSet *fset, cJSON *json) {
continue; continue;
} }
code = tsdbTFileToJson(fset->farr[ftype], json); // code = tsdbTFileToJson(fset->farr[ftype], json);
if (code) return code; // if (code) return code;
} }
// each level // each level
@ -103,8 +103,8 @@ int32_t tsdbFileSetFromJson(const cJSON *json, STFileSet *fset) {
} }
for (int32_t ftype = TSDB_FTYPE_MIN; ftype < TSDB_FTYPE_MAX; ++ftype) { for (int32_t ftype = TSDB_FTYPE_MIN; ftype < TSDB_FTYPE_MAX; ++ftype) {
int32_t code = tsdbTFileFromJson(json, ftype, &fset->farr[ftype]); // int32_t code = tsdbTFileFromJson(json, ftype, &fset->farr[ftype]->f);
if (code) return code; // if (code) return code;
} }
// each level // each level
@ -131,11 +131,11 @@ int32_t tsdbFSetEdit(STFileSet *fset, const STFileOp *op) {
if (op->oState.size == 0) { if (op->oState.size == 0) {
// create // create
STFile *f; // STFile *f;
code = tsdbTFileCreate(&op->nState, &f); // code = tsdbTFileCreate(&op->nState, &f);
if (code) return code; // if (code) return code;
add_file(fset, f); // add_file(fset, f);
} else if (op->nState.size == 0) { } else if (op->nState.size == 0) {
// delete // delete
} else { } else {