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

more code

上级 7cf2911c
...@@ -59,7 +59,7 @@ static int32_t open_committer_writer(SCommitter *pCommitter) { ...@@ -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 { ...@@ -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) { ...@@ -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 @@ ...@@ -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,20 +33,41 @@ typedef enum { ...@@ -31,20 +33,41 @@ typedef enum {
TSDB_FTYPE_STT, // .stt TSDB_FTYPE_STT, // .stt
} tsdb_ftype_t; } tsdb_ftype_t;
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 { struct STFile {
char fname[TSDB_FILENAME_LEN]; char fname[TSDB_FILENAME_LEN];
int32_t ref; int32_t ref;
int32_t state;
tsdb_ftype_t type; tsdb_ftype_t type;
SDiskID diskId; SDiskID did;
int64_t size; int64_t size;
int64_t cid; int64_t cid;
int32_t fid; 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;
};
int32_t tsdbTFileCreate(const struct STFile *config, struct STFile **ppFile); LISTD(struct STFile) listNode;
int32_t tsdbTFileDestroy(struct STFile *pFile); };
int32_t tsdbTFileInit(STsdb *pTsdb, struct STFile *pFile);
int32_t tsdbTFileClear(struct STFile *pFile);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册