more code
This commit is contained in:
parent
ca28c99f80
commit
57bde4f311
|
@ -116,9 +116,16 @@ static FORCE_INLINE int32_t tarray2_make_room( //
|
||||||
|
|
||||||
// return (TYPE *)
|
// return (TYPE *)
|
||||||
#define TARRAY2_SEARCH(a, ep, cmp, flag) \
|
#define TARRAY2_SEARCH(a, ep, cmp, flag) \
|
||||||
((typeof((a)->data))(((a)->size == 0) ? NULL \
|
({ \
|
||||||
: taosbsearch(ep, (a)->data, (a)->size, sizeof(typeof((a)->data[0])), \
|
typeof((a)->data) __ep = (ep); \
|
||||||
(__compar_fn_t)cmp, flag)))
|
typeof((a)->data) __p; \
|
||||||
|
if ((a)->size > 0) { \
|
||||||
|
__p = taosbsearch(__ep, (a)->data, (a)->size, sizeof(typeof((a)->data[0])), (__compar_fn_t)cmp, flag); \
|
||||||
|
} else { \
|
||||||
|
__p = NULL; \
|
||||||
|
} \
|
||||||
|
__p; \
|
||||||
|
})
|
||||||
|
|
||||||
// return (TYPE)
|
// return (TYPE)
|
||||||
#define TARRAY2_SEARCH_EX(a, ep, cmp, flag) \
|
#define TARRAY2_SEARCH_EX(a, ep, cmp, flag) \
|
||||||
|
|
|
@ -41,7 +41,7 @@ int32_t tsdbFSEditBegin(STFileSystem *fs, const TFileOpArray *opArray, EFEditT e
|
||||||
int32_t tsdbFSEditCommit(STFileSystem *pFS);
|
int32_t tsdbFSEditCommit(STFileSystem *pFS);
|
||||||
int32_t tsdbFSEditAbort(STFileSystem *pFS);
|
int32_t tsdbFSEditAbort(STFileSystem *pFS);
|
||||||
// other
|
// other
|
||||||
int32_t tsdbFSGetFSet(STFileSystem *fs, int32_t fid, const STFileSet **ppFSet);
|
int32_t tsdbFSGetFSet(STFileSystem *fs, int32_t fid, STFileSet **fset);
|
||||||
|
|
||||||
/* Exposed Structs */
|
/* Exposed Structs */
|
||||||
struct STFileSystem {
|
struct STFileSystem {
|
||||||
|
|
|
@ -53,7 +53,7 @@ int32_t tsdbTFileSetEditEx(const STFileSet *fset1, STFileSet *fset);
|
||||||
// max commit id
|
// max commit id
|
||||||
int64_t tsdbTFileSetMaxCid(const STFileSet *fset);
|
int64_t tsdbTFileSetMaxCid(const STFileSet *fset);
|
||||||
|
|
||||||
SSttLvl *tsdbTFileSetGetLvl(const STFileSet *fset, int32_t level);
|
SSttLvl *tsdbTFileSetGetLvl(STFileSet *fset, int32_t level);
|
||||||
|
|
||||||
struct STFileOp {
|
struct STFileOp {
|
||||||
tsdb_fop_t op;
|
tsdb_fop_t op;
|
||||||
|
|
|
@ -37,7 +37,7 @@ typedef struct {
|
||||||
int32_t expLevel;
|
int32_t expLevel;
|
||||||
TSKEY minKey;
|
TSKEY minKey;
|
||||||
TSKEY maxKey;
|
TSKEY maxKey;
|
||||||
const STFileSet *fset;
|
STFileSet *fset;
|
||||||
|
|
||||||
// writer
|
// writer
|
||||||
SSttFileWriter *pWriter;
|
SSttFileWriter *pWriter;
|
||||||
|
|
|
@ -586,9 +586,9 @@ int32_t tsdbFSEditAbort(STFileSystem *fs) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tsdbFSGetFSet(STFileSystem *fs, int32_t fid, const STFileSet **fset) {
|
int32_t tsdbFSGetFSet(STFileSystem *fs, int32_t fid, STFileSet **fset) {
|
||||||
STFileSet tfset = {.fid = fid};
|
STFileSet tfset = {.fid = fid};
|
||||||
fset[0] = &tfset;
|
STFileSet *pset = &tfset;
|
||||||
fset[0] = TARRAY2_SEARCH_EX(&fs->cstate, fset, tsdbTFileSetCmprFn, TD_EQ);
|
fset[0] = TARRAY2_SEARCH_EX(&fs->cstate, &pset, tsdbTFileSetCmprFn, TD_EQ);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
|
@ -312,10 +312,10 @@ int32_t tsdbTFileSetRemove(STFileSet **fset) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSttLvl *tsdbTFileSetGetLvl(const STFileSet *fset, int32_t level) {
|
SSttLvl *tsdbTFileSetGetLvl(STFileSet *fset, int32_t level) {
|
||||||
SSttLvl tlvl = {.level = level};
|
SSttLvl tlvl = {.level = level};
|
||||||
SSttLvl *lvl = &tlvl;
|
SSttLvl *lvl = &tlvl;
|
||||||
return TARRAY2_SEARCH_EX(&fset->lvlArr, lvl, tsdbSttLvlCmprFn, TD_EQ);
|
return TARRAY2_SEARCH_EX(&fset->lvlArr, &lvl, tsdbSttLvlCmprFn, TD_EQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tsdbTFileSetCmprFn(const STFileSet **fset1, const STFileSet **fset2) {
|
int32_t tsdbTFileSetCmprFn(const STFileSet **fset1, const STFileSet **fset2) {
|
||||||
|
|
Loading…
Reference in New Issue