more code
This commit is contained in:
parent
7cf2911c23
commit
eba557effe
|
@ -59,7 +59,7 @@ static int32_t open_committer_writer(SCommitter *pCommitter) {
|
||||||
} else {
|
} else {
|
||||||
conf.file.type = TSDB_FTYPE_STT;
|
conf.file.type = TSDB_FTYPE_STT;
|
||||||
|
|
||||||
if (tfsAllocDisk(pTsdb->pVnode->pTfs, pCommitter->expLevel, &conf.file.diskId) < 0) {
|
if (tfsAllocDisk(pTsdb->pVnode->pTfs, pCommitter->expLevel, &conf.file.did) < 0) {
|
||||||
code = TSDB_CODE_FS_NO_VALID_DISK;
|
code = TSDB_CODE_FS_NO_VALID_DISK;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,8 @@ struct SSttLvl {
|
||||||
struct SFileSet {
|
struct SFileSet {
|
||||||
int32_t fid;
|
int32_t fid;
|
||||||
int64_t nextid;
|
int64_t nextid;
|
||||||
struct STFile *farr[TSDB_FTYPE_MAX];
|
struct STFile *farr[TSDB_FTYPE_MAX]; // file array
|
||||||
SSttLvl lvl0; // level 0 of .stt
|
SSttLvl lvl0; // level 0 of .stt
|
||||||
};
|
};
|
||||||
|
|
||||||
int32_t tsdbFileSetCreate(int32_t fid, struct SFileSet **ppSet);
|
int32_t tsdbFileSetCreate(int32_t fid, struct SFileSet **ppSet);
|
||||||
|
|
|
@ -51,16 +51,16 @@ int32_t tsdbTFileInit(STsdb *pTsdb, struct STFile *pFile) {
|
||||||
STfs *pTfs = pVnode->pTfs;
|
STfs *pTfs = pVnode->pTfs;
|
||||||
|
|
||||||
if (pTfs) {
|
if (pTfs) {
|
||||||
snprintf(pFile->fname, //
|
snprintf(pFile->fname, //
|
||||||
TSDB_FILENAME_LEN, //
|
TSDB_FILENAME_LEN, //
|
||||||
"%s%s%s%sv%df%dver%" PRId64 "%s", //
|
"%s%s%s%sv%df%dver%" PRId64 "%s", //
|
||||||
tfsGetDiskPath(pTfs, pFile->diskId), //
|
tfsGetDiskPath(pTfs, pFile->did), //
|
||||||
TD_DIRSEP, //
|
TD_DIRSEP, //
|
||||||
pTsdb->path, //
|
pTsdb->path, //
|
||||||
TD_DIRSEP, //
|
TD_DIRSEP, //
|
||||||
TD_VID(pVnode), //
|
TD_VID(pVnode), //
|
||||||
pFile->fid, //
|
pFile->fid, //
|
||||||
pFile->cid, //
|
pFile->cid, //
|
||||||
tsdb_ftype_suffix[pFile->type]);
|
tsdb_ftype_suffix[pFile->type]);
|
||||||
} else {
|
} else {
|
||||||
snprintf(pFile->fname, //
|
snprintf(pFile->fname, //
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef struct STFile STFile;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TSDB_FTYPE_HEAD = 0, // .head
|
TSDB_FTYPE_HEAD = 0, // .head
|
||||||
TSDB_FTYPE_DATA, // .data
|
TSDB_FTYPE_DATA, // .data
|
||||||
|
@ -31,21 +33,42 @@ typedef enum {
|
||||||
TSDB_FTYPE_STT, // .stt
|
TSDB_FTYPE_STT, // .stt
|
||||||
} tsdb_ftype_t;
|
} tsdb_ftype_t;
|
||||||
|
|
||||||
struct STFile {
|
|
||||||
char fname[TSDB_FILENAME_LEN];
|
|
||||||
int32_t ref;
|
|
||||||
tsdb_ftype_t type;
|
|
||||||
SDiskID diskId;
|
|
||||||
int64_t size;
|
|
||||||
int64_t cid;
|
|
||||||
int32_t fid;
|
|
||||||
};
|
|
||||||
|
|
||||||
int32_t tsdbTFileCreate(const struct STFile *config, struct STFile **ppFile);
|
int32_t tsdbTFileCreate(const struct STFile *config, struct STFile **ppFile);
|
||||||
int32_t tsdbTFileDestroy(struct STFile *pFile);
|
int32_t tsdbTFileDestroy(struct STFile *pFile);
|
||||||
int32_t tsdbTFileInit(STsdb *pTsdb, struct STFile *pFile);
|
int32_t tsdbTFileInit(STsdb *pTsdb, struct STFile *pFile);
|
||||||
int32_t tsdbTFileClear(struct STFile *pFile);
|
int32_t tsdbTFileClear(struct STFile *pFile);
|
||||||
|
|
||||||
|
struct STFile {
|
||||||
|
char fname[TSDB_FILENAME_LEN];
|
||||||
|
int32_t ref;
|
||||||
|
int32_t state;
|
||||||
|
tsdb_ftype_t type;
|
||||||
|
SDiskID did;
|
||||||
|
int64_t size;
|
||||||
|
int64_t cid;
|
||||||
|
int32_t fid;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
int32_t level; // level of .stt
|
||||||
|
int32_t nSeg; // number of segments in .stt
|
||||||
|
} stt;
|
||||||
|
struct {
|
||||||
|
// TODO
|
||||||
|
} head;
|
||||||
|
struct {
|
||||||
|
// TODO
|
||||||
|
} data;
|
||||||
|
struct {
|
||||||
|
// TODO
|
||||||
|
} sma;
|
||||||
|
struct {
|
||||||
|
// TODO
|
||||||
|
} tomb;
|
||||||
|
};
|
||||||
|
|
||||||
|
LISTD(struct STFile) listNode;
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue