more
This commit is contained in:
parent
a6166565fb
commit
42fc423684
|
@ -17,7 +17,7 @@ typedef void tsdb_repo_t; // use void to hide implementation details from outsi
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int64_t uid; // the unique table ID
|
int64_t uid; // the unique table ID
|
||||||
int32_t tableId; // the table ID in the repository.
|
int32_t tid; // the table ID in the repository.
|
||||||
} STableId;
|
} STableId;
|
||||||
|
|
||||||
// Submit message for this TSDB
|
// Submit message for this TSDB
|
||||||
|
@ -52,8 +52,6 @@ typedef struct {
|
||||||
// Rows in file block policy
|
// Rows in file block policy
|
||||||
typedef struct {
|
typedef struct {
|
||||||
// TODO: Need a more fancy description
|
// TODO: Need a more fancy description
|
||||||
int32_t minRowsPerFileBlock;
|
|
||||||
int32_t maxRowsPerFileBlock;
|
|
||||||
} SBlockRowsPolicy;
|
} SBlockRowsPolicy;
|
||||||
|
|
||||||
// the TSDB repository configuration
|
// the TSDB repository configuration
|
||||||
|
@ -61,9 +59,10 @@ typedef struct {
|
||||||
char * rootDir; // TSDB repository root directory, TODO: need to adjust here
|
char * rootDir; // TSDB repository root directory, TODO: need to adjust here
|
||||||
int32_t tsdbId;
|
int32_t tsdbId;
|
||||||
int32_t maxTables; // maximum number of tables this repository can have
|
int32_t maxTables; // maximum number of tables this repository can have
|
||||||
SDataShardPolicy dataShardPolicy;
|
int32_t daysPerFile; // day per file sharding policy
|
||||||
SBlockRowsPolicy blockRowsPolicy;
|
int32_t minRowsPerFileBlock; // minimum rows per file block
|
||||||
SRetentionPolicy retentionPlicy; // retention configuration
|
int32_t maxRowsPerFileBlock; // maximum rows per file block
|
||||||
|
int32_t keep; // Day of data to keep
|
||||||
void * cachePool; // the cache pool the repository to use
|
void * cachePool; // the cache pool the repository to use
|
||||||
} STsdbCfg;
|
} STsdbCfg;
|
||||||
|
|
||||||
|
@ -79,8 +78,7 @@ typedef struct STSDBRepoInfo {
|
||||||
// the meter configuration
|
// the meter configuration
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char * tableName;
|
char * tableName;
|
||||||
int64_t uid; // uid given by upper layer
|
STableId tableId;
|
||||||
int32_t tableId; // table ID allocated from upper layer
|
|
||||||
|
|
||||||
char *stableName; // if not NULL, the table is created from a super table, need to make sure the super
|
char *stableName; // if not NULL, the table is created from a super table, need to make sure the super
|
||||||
// table exists in this TSDB.
|
// table exists in this TSDB.
|
||||||
|
@ -245,7 +243,6 @@ typedef struct STableIDList {
|
||||||
} STableIDList;
|
} STableIDList;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
} SFields;
|
} SFields;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -269,7 +266,8 @@ tsdb_query_handle_t *tsdbQueryFromTableID(tsdb_repo_t *pRepo, STSDBQueryCond *pC
|
||||||
* @param pTagFilterStr tag filter info
|
* @param pTagFilterStr tag filter info
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
tsdb_query_handle_t *tsdbQueryFromTagConds(tsdb_repo_t *pRepo, STSDBQueryCond *pCond, int16_t stableId, const char *pTagFilterStr);
|
tsdb_query_handle_t *tsdbQueryFromTagConds(tsdb_repo_t *pRepo, STSDBQueryCond *pCond, int16_t stableId,
|
||||||
|
const char *pTagFilterStr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset to the start(end) position of current query, from which the iterator starts.
|
* Reset to the start(end) position of current query, from which the iterator starts.
|
||||||
|
|
|
@ -39,7 +39,7 @@ typedef struct _tsdb_repo {
|
||||||
|
|
||||||
int8_t state;
|
int8_t state;
|
||||||
|
|
||||||
} STSDBRepo;
|
} STsdbRepo;
|
||||||
|
|
||||||
#define TSDB_GET_TABLE_BY_ID(pRepo, sid) (((STSDBRepo *)pRepo)->pTableList)[sid]
|
#define TSDB_GET_TABLE_BY_ID(pRepo, sid) (((STSDBRepo *)pRepo)->pTableList)[sid]
|
||||||
#define TSDB_GET_TABLE_BY_NAME(pRepo, name)
|
#define TSDB_GET_TABLE_BY_NAME(pRepo, name)
|
||||||
|
@ -57,11 +57,11 @@ static int32_t tsdbCheckCfg(STsdbCfg *pCfg) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t tsdbCreateFiles(STSDBRepo *pRepo) {
|
static int32_t tsdbCreateFiles(STsdbRepo *pRepo) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t tsdbClearFiles(STSDBRepo *pRepo) {
|
static int32_t tsdbClearFiles(STsdbRepo *pRepo) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ tsdb_repo_t *tsdbCreateRepo(STsdbCfg *pCfg) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
STSDBRepo *pRepo = (STSDBRepo *)malloc(sizeof(STSDBRepo));
|
STsdbRepo *pRepo = (STsdbRepo *)malloc(sizeof(STsdbRepo));
|
||||||
if (pRepo == NULL) {
|
if (pRepo == NULL) {
|
||||||
// TODO: deal with error
|
// TODO: deal with error
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -112,7 +112,7 @@ tsdb_repo_t *tsdbCreateRepo(STsdbCfg *pCfg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tsdbDropRepo(tsdb_repo_t *repo) {
|
int32_t tsdbDropRepo(tsdb_repo_t *repo) {
|
||||||
STSDBRepo *pRepo = (STSDBRepo *)repo;
|
STsdbRepo *pRepo = (STsdbRepo *)repo;
|
||||||
|
|
||||||
pRepo->state = TSDB_REPO_STATE_CLOSED;
|
pRepo->state = TSDB_REPO_STATE_CLOSED;
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ tsdb_repo_t *tsdbOpenRepo(char *tsdbDir) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
STSDBRepo *pRepo = (STSDBRepo *)malloc(sizeof(STSDBRepo));
|
STsdbRepo *pRepo = (STsdbRepo *)malloc(sizeof(STsdbRepo));
|
||||||
if (pRepo == NULL) {
|
if (pRepo == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -156,12 +156,12 @@ tsdb_repo_t *tsdbOpenRepo(char *tsdbDir) {
|
||||||
return (tsdb_repo_t *)pRepo;
|
return (tsdb_repo_t *)pRepo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t tsdbFlushCache(STSDBRepo *pRepo) {
|
static int32_t tsdbFlushCache(STsdbRepo *pRepo) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tsdbCloseRepo(tsdb_repo_t *repo) {
|
int32_t tsdbCloseRepo(tsdb_repo_t *repo) {
|
||||||
STSDBRepo *pRepo = (STSDBRepo *)repo;
|
STsdbRepo *pRepo = (STsdbRepo *)repo;
|
||||||
|
|
||||||
tsdbFlushCache(pRepo);
|
tsdbFlushCache(pRepo);
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ int32_t tsdbCloseRepo(tsdb_repo_t *repo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tsdbConfigRepo(tsdb_repo_t *repo, STsdbCfg *pCfg) {
|
int32_t tsdbConfigRepo(tsdb_repo_t *repo, STsdbCfg *pCfg) {
|
||||||
STSDBRepo *pRepo = (STSDBRepo *)repo;
|
STsdbRepo *pRepo = (STsdbRepo *)repo;
|
||||||
|
|
||||||
pRepo->pCfg = pCfg;
|
pRepo->pCfg = pCfg;
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -187,7 +187,7 @@ STSDBRepoInfo *tsdbGetStatus(tsdb_repo_t *pRepo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tsdbCreateTable(tsdb_repo_t *repo, STableCfg *pCfg) {
|
int32_t tsdbCreateTable(tsdb_repo_t *repo, STableCfg *pCfg) {
|
||||||
STSDBRepo *pRepo = (STSDBRepo *)repo;
|
STsdbRepo *pRepo = (STsdbRepo *)repo;
|
||||||
return tsdbCreateTableImpl(pRepo->tsdbMeta, pCfg);
|
return tsdbCreateTableImpl(pRepo->tsdbMeta, pCfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue