more
This commit is contained in:
parent
bbf1c53b6d
commit
2c5311abbd
|
@ -42,6 +42,8 @@ typedef struct {
|
||||||
SSchema *pSchema;
|
SSchema *pSchema;
|
||||||
} SSchemaWrapper;
|
} SSchemaWrapper;
|
||||||
|
|
||||||
|
typedef struct SMTbCursor SMTbCursor;
|
||||||
|
|
||||||
typedef SVCreateTbReq STbCfg;
|
typedef SVCreateTbReq STbCfg;
|
||||||
|
|
||||||
// SMeta operations
|
// SMeta operations
|
||||||
|
@ -57,6 +59,10 @@ STbCfg * metaGetTbInfoByUid(SMeta *pMeta, tb_uid_t uid);
|
||||||
STbCfg * metaGetTbInfoByName(SMeta *pMeta, char *tbname, tb_uid_t *uid);
|
STbCfg * metaGetTbInfoByName(SMeta *pMeta, char *tbname, tb_uid_t *uid);
|
||||||
SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, bool isinline);
|
SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, bool isinline);
|
||||||
|
|
||||||
|
SMTbCursor * metaOpenTbCursor(SMeta *pMeta);
|
||||||
|
void metaCloseTbCursor(SMTbCursor *pTbCur);
|
||||||
|
char *metaTbCursorNext(SMTbCursor *pTbCur);
|
||||||
|
|
||||||
// Options
|
// Options
|
||||||
void metaOptionsInit(SMetaCfg *pMetaCfg);
|
void metaOptionsInit(SMetaCfg *pMetaCfg);
|
||||||
void metaOptionsClear(SMetaCfg *pMetaCfg);
|
void metaOptionsClear(SMetaCfg *pMetaCfg);
|
||||||
|
|
|
@ -542,3 +542,43 @@ SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, boo
|
||||||
|
|
||||||
return pSW;
|
return pSW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct SMTbCursor {
|
||||||
|
DBC *pCur;
|
||||||
|
};
|
||||||
|
|
||||||
|
SMTbCursor *metaOpenTbCursor(SMeta *pMeta) {
|
||||||
|
SMTbCursor *pTbCur = NULL;
|
||||||
|
SMetaDB * pDB = pMeta->pDB;
|
||||||
|
|
||||||
|
pTbCur = (SMTbCursor *)calloc(1, sizeof(*pTbCur));
|
||||||
|
if (pTbCur == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
pDB->pTbDB->cursor(pDB->pTbDB, NULL, &(pTbCur->pCur), 0);
|
||||||
|
|
||||||
|
return pTbCur;
|
||||||
|
}
|
||||||
|
|
||||||
|
void metaCloseTbCursor(SMTbCursor *pTbCur) {
|
||||||
|
if (pTbCur) {
|
||||||
|
if (pTbCur->pCur) {
|
||||||
|
pTbCur->pCur->close(pTbCur->pCur);
|
||||||
|
}
|
||||||
|
free(pTbCur);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
char *metaTbCursorNext(SMTbCursor *pTbCur) {
|
||||||
|
DBT key = {0};
|
||||||
|
DBT value = {0};
|
||||||
|
STbCfg tbCfg;
|
||||||
|
|
||||||
|
if (pTbCur->pCur->get(pTbCur->pCur, &key, &value, DB_NEXT) == 0) {
|
||||||
|
metaDecodeTbInfo(&(value.data), &tbCfg);
|
||||||
|
return tbCfg.name;
|
||||||
|
} else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue