more code
This commit is contained in:
parent
ca28c99f80
commit
57bde4f311
|
@ -115,10 +115,17 @@ static FORCE_INLINE int32_t tarray2_make_room( //
|
|||
#define TARRAY2_APPEND_P(a, ep) TARRAY2_APPEND(a, *(ep))
|
||||
|
||||
// return (TYPE *)
|
||||
#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])), \
|
||||
(__compar_fn_t)cmp, flag)))
|
||||
#define TARRAY2_SEARCH(a, ep, cmp, flag) \
|
||||
({ \
|
||||
typeof((a)->data) __ep = (ep); \
|
||||
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)
|
||||
#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 tsdbFSEditAbort(STFileSystem *pFS);
|
||||
// other
|
||||
int32_t tsdbFSGetFSet(STFileSystem *fs, int32_t fid, const STFileSet **ppFSet);
|
||||
int32_t tsdbFSGetFSet(STFileSystem *fs, int32_t fid, STFileSet **fset);
|
||||
|
||||
/* Exposed Structs */
|
||||
struct STFileSystem {
|
||||
|
|
|
@ -53,7 +53,7 @@ int32_t tsdbTFileSetEditEx(const STFileSet *fset1, STFileSet *fset);
|
|||
// max commit id
|
||||
int64_t tsdbTFileSetMaxCid(const STFileSet *fset);
|
||||
|
||||
SSttLvl *tsdbTFileSetGetLvl(const STFileSet *fset, int32_t level);
|
||||
SSttLvl *tsdbTFileSetGetLvl(STFileSet *fset, int32_t level);
|
||||
|
||||
struct STFileOp {
|
||||
tsdb_fop_t op;
|
||||
|
|
|
@ -32,12 +32,12 @@ typedef struct {
|
|||
int64_t eid; // edit id
|
||||
|
||||
// context
|
||||
TSKEY nextKey;
|
||||
int32_t fid;
|
||||
int32_t expLevel;
|
||||
TSKEY minKey;
|
||||
TSKEY maxKey;
|
||||
const STFileSet *fset;
|
||||
TSKEY nextKey;
|
||||
int32_t fid;
|
||||
int32_t expLevel;
|
||||
TSKEY minKey;
|
||||
TSKEY maxKey;
|
||||
STFileSet *fset;
|
||||
|
||||
// writer
|
||||
SSttFileWriter *pWriter;
|
||||
|
|
|
@ -586,9 +586,9 @@ int32_t tsdbFSEditAbort(STFileSystem *fs) {
|
|||
return code;
|
||||
}
|
||||
|
||||
int32_t tsdbFSGetFSet(STFileSystem *fs, int32_t fid, const STFileSet **fset) {
|
||||
STFileSet tfset = {.fid = fid};
|
||||
fset[0] = &tfset;
|
||||
fset[0] = TARRAY2_SEARCH_EX(&fs->cstate, fset, tsdbTFileSetCmprFn, TD_EQ);
|
||||
int32_t tsdbFSGetFSet(STFileSystem *fs, int32_t fid, STFileSet **fset) {
|
||||
STFileSet tfset = {.fid = fid};
|
||||
STFileSet *pset = &tfset;
|
||||
fset[0] = TARRAY2_SEARCH_EX(&fs->cstate, &pset, tsdbTFileSetCmprFn, TD_EQ);
|
||||
return 0;
|
||||
}
|
|
@ -312,10 +312,10 @@ int32_t tsdbTFileSetRemove(STFileSet **fset) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
SSttLvl *tsdbTFileSetGetLvl(const STFileSet *fset, int32_t level) {
|
||||
SSttLvl *tsdbTFileSetGetLvl(STFileSet *fset, int32_t level) {
|
||||
SSttLvl tlvl = {.level = level};
|
||||
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) {
|
||||
|
|
Loading…
Reference in New Issue