diff --git a/src/inc/tsdb.h b/src/inc/tsdb.h index 38ded5cf10720b7b0f4443e22cd4146da0ab3f7e..a59a278d527b93be77035ca662a0302081dda4d6 100644 --- a/src/inc/tsdb.h +++ b/src/inc/tsdb.h @@ -104,9 +104,10 @@ void tsdbClearTableCfg(STableCfg *config); int32_t tsdbGetTableTagVal(TsdbRepoT *repo, STableId id, int32_t col, int16_t *type, int16_t *bytes, char **val); int32_t tsdbTableGetName(TsdbRepoT *repo, STableId id, char** name); -int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg); -int tsdbDropTable(TsdbRepoT *pRepo, STableId tableId); -int tsdbAlterTable(TsdbRepoT *repo, STableCfg *pCfg); +int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg); +int tsdbDropTable(TsdbRepoT *pRepo, STableId tableId); +int tsdbAlterTable(TsdbRepoT *repo, STableCfg *pCfg); +TSKEY tsdbGetTableLastKey(TsdbRepoT *repo, int64_t uid); // the TSDB repository info typedef struct STsdbRepoInfo { diff --git a/src/tsdb/src/tsdbMain.c b/src/tsdb/src/tsdbMain.c index 5da8d303d9a155d56519412c38212f4e11b18500..ca0065bf1e69c7816ffe280640def1e9a6f5bbae 100644 --- a/src/tsdb/src/tsdbMain.c +++ b/src/tsdb/src/tsdbMain.c @@ -367,6 +367,15 @@ int tsdbAlterTable(TsdbRepoT *pRepo, STableCfg *pCfg) { return 0; } +TSKEY tsdbGetTableLastKey(TsdbRepoT *repo, int64_t uid) { + STsdbRepo *pRepo = (STsdbRepo *)repo; + + STable *pTable = tsdbGetTableByUid(pRepo->tsdbMeta, uid); + if (pTable == NULL) return -1; + + return TSDB_GET_TABLE_LAST_KEY(pTable); +} + int tsdbDropTable(TsdbRepoT *repo, STableId tableId) { if (repo == NULL) return -1; STsdbRepo *pRepo = (STsdbRepo *)repo;