more code
This commit is contained in:
parent
7cf2911c23
commit
eba557effe
|
@ -59,7 +59,7 @@ static int32_t open_committer_writer(SCommitter *pCommitter) {
|
|||
} else {
|
||||
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;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
|
|
@ -49,8 +49,8 @@ struct SSttLvl {
|
|||
struct SFileSet {
|
||||
int32_t fid;
|
||||
int64_t nextid;
|
||||
struct STFile *farr[TSDB_FTYPE_MAX];
|
||||
SSttLvl lvl0; // level 0 of .stt
|
||||
struct STFile *farr[TSDB_FTYPE_MAX]; // file array
|
||||
SSttLvl lvl0; // level 0 of .stt
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
if (pTfs) {
|
||||
snprintf(pFile->fname, //
|
||||
TSDB_FILENAME_LEN, //
|
||||
"%s%s%s%sv%df%dver%" PRId64 "%s", //
|
||||
tfsGetDiskPath(pTfs, pFile->diskId), //
|
||||
TD_DIRSEP, //
|
||||
pTsdb->path, //
|
||||
TD_DIRSEP, //
|
||||
TD_VID(pVnode), //
|
||||
pFile->fid, //
|
||||
pFile->cid, //
|
||||
snprintf(pFile->fname, //
|
||||
TSDB_FILENAME_LEN, //
|
||||
"%s%s%s%sv%df%dver%" PRId64 "%s", //
|
||||
tfsGetDiskPath(pTfs, pFile->did), //
|
||||
TD_DIRSEP, //
|
||||
pTsdb->path, //
|
||||
TD_DIRSEP, //
|
||||
TD_VID(pVnode), //
|
||||
pFile->fid, //
|
||||
pFile->cid, //
|
||||
tsdb_ftype_suffix[pFile->type]);
|
||||
} else {
|
||||
snprintf(pFile->fname, //
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct STFile STFile;
|
||||
|
||||
typedef enum {
|
||||
TSDB_FTYPE_HEAD = 0, // .head
|
||||
TSDB_FTYPE_DATA, // .data
|
||||
|
@ -31,21 +33,42 @@ typedef enum {
|
|||
TSDB_FTYPE_STT, // .stt
|
||||
} 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 tsdbTFileDestroy(struct STFile *pFile);
|
||||
int32_t tsdbTFileInit(STsdb *pTsdb, 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
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue