more
This commit is contained in:
parent
a6166565fb
commit
42fc423684
|
@ -16,8 +16,8 @@
|
|||
typedef void tsdb_repo_t; // use void to hide implementation details from outside
|
||||
|
||||
typedef struct {
|
||||
int64_t uid; // the unique table ID
|
||||
int32_t tableId; // the table ID in the repository.
|
||||
int64_t uid; // the unique table ID
|
||||
int32_t tid; // the table ID in the repository.
|
||||
} STableId;
|
||||
|
||||
// Submit message for this TSDB
|
||||
|
@ -29,10 +29,10 @@ typedef struct {
|
|||
|
||||
// Submit message for one table
|
||||
typedef struct {
|
||||
STableId tid;
|
||||
int32_t sversion; // data schema version
|
||||
int32_t numOfRows; // number of rows data
|
||||
char data[];
|
||||
STableId tid;
|
||||
int32_t sversion; // data schema version
|
||||
int32_t numOfRows; // number of rows data
|
||||
char data[];
|
||||
} SSubmitBlock;
|
||||
|
||||
// Retention policy.
|
||||
|
@ -52,19 +52,18 @@ typedef struct {
|
|||
// Rows in file block policy
|
||||
typedef struct {
|
||||
// TODO: Need a more fancy description
|
||||
int32_t minRowsPerFileBlock;
|
||||
int32_t maxRowsPerFileBlock;
|
||||
} SBlockRowsPolicy;
|
||||
|
||||
// the TSDB repository configuration
|
||||
typedef struct {
|
||||
char * rootDir; // TSDB repository root directory, TODO: need to adjust here
|
||||
int32_t tsdbId;
|
||||
int32_t maxTables; // maximum number of tables this repository can have
|
||||
SDataShardPolicy dataShardPolicy;
|
||||
SBlockRowsPolicy blockRowsPolicy;
|
||||
SRetentionPolicy retentionPlicy; // retention configuration
|
||||
void * cachePool; // the cache pool the repository to use
|
||||
char * rootDir; // TSDB repository root directory, TODO: need to adjust here
|
||||
int32_t tsdbId;
|
||||
int32_t maxTables; // maximum number of tables this repository can have
|
||||
int32_t daysPerFile; // day per file sharding policy
|
||||
int32_t minRowsPerFileBlock; // minimum rows per file block
|
||||
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
|
||||
} STsdbCfg;
|
||||
|
||||
// the TSDB repository info
|
||||
|
@ -78,9 +77,8 @@ typedef struct STSDBRepoInfo {
|
|||
|
||||
// the meter configuration
|
||||
typedef struct {
|
||||
char * tableName;
|
||||
int64_t uid; // uid given by upper layer
|
||||
int32_t tableId; // table ID allocated from upper layer
|
||||
char * tableName;
|
||||
STableId tableId;
|
||||
|
||||
char *stableName; // if not NULL, the table is created from a super table, need to make sure the super
|
||||
// table exists in this TSDB.
|
||||
|
@ -99,8 +97,8 @@ typedef struct {
|
|||
typedef struct {
|
||||
STableCfg tableCfg;
|
||||
int64_t version;
|
||||
int64_t tableTotalDataSize; // In bytes
|
||||
int64_t tableTotalDiskSize; // In bytes
|
||||
int64_t tableTotalDataSize; // In bytes
|
||||
int64_t tableTotalDiskSize; // In bytes
|
||||
} STableInfo;
|
||||
|
||||
/**
|
||||
|
@ -201,7 +199,7 @@ int32_t tsdbInsertData(tsdb_repo_t *pRepo, STableId tid, char *pData, int32_t *e
|
|||
|
||||
// -- FOR QUERY TIME SERIES DATA
|
||||
|
||||
typedef void tsdb_query_handle_t; // Use void to hide implementation details
|
||||
typedef void tsdb_query_handle_t; // Use void to hide implementation details
|
||||
|
||||
// time window
|
||||
typedef struct STimeWindow {
|
||||
|
@ -245,7 +243,6 @@ typedef struct STableIDList {
|
|||
} STableIDList;
|
||||
|
||||
typedef struct {
|
||||
|
||||
} SFields;
|
||||
|
||||
/**
|
||||
|
@ -269,7 +266,8 @@ tsdb_query_handle_t *tsdbQueryFromTableID(tsdb_repo_t *pRepo, STSDBQueryCond *pC
|
|||
* @param pTagFilterStr tag filter info
|
||||
* @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.
|
||||
|
|
|
@ -39,7 +39,7 @@ typedef struct _tsdb_repo {
|
|||
|
||||
int8_t state;
|
||||
|
||||
} STSDBRepo;
|
||||
} STsdbRepo;
|
||||
|
||||
#define TSDB_GET_TABLE_BY_ID(pRepo, sid) (((STSDBRepo *)pRepo)->pTableList)[sid]
|
||||
#define TSDB_GET_TABLE_BY_NAME(pRepo, name)
|
||||
|
@ -57,11 +57,11 @@ static int32_t tsdbCheckCfg(STsdbCfg *pCfg) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t tsdbCreateFiles(STSDBRepo *pRepo) {
|
||||
static int32_t tsdbCreateFiles(STsdbRepo *pRepo) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
static int32_t tsdbClearFiles(STSDBRepo *pRepo) {
|
||||
static int32_t tsdbClearFiles(STsdbRepo *pRepo) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ tsdb_repo_t *tsdbCreateRepo(STsdbCfg *pCfg) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
STSDBRepo *pRepo = (STSDBRepo *)malloc(sizeof(STSDBRepo));
|
||||
STsdbRepo *pRepo = (STsdbRepo *)malloc(sizeof(STsdbRepo));
|
||||
if (pRepo == NULL) {
|
||||
// TODO: deal with error
|
||||
return NULL;
|
||||
|
@ -112,7 +112,7 @@ tsdb_repo_t *tsdbCreateRepo(STsdbCfg *pCfg) {
|
|||
}
|
||||
|
||||
int32_t tsdbDropRepo(tsdb_repo_t *repo) {
|
||||
STSDBRepo *pRepo = (STSDBRepo *)repo;
|
||||
STsdbRepo *pRepo = (STsdbRepo *)repo;
|
||||
|
||||
pRepo->state = TSDB_REPO_STATE_CLOSED;
|
||||
|
||||
|
@ -133,7 +133,7 @@ tsdb_repo_t *tsdbOpenRepo(char *tsdbDir) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
STSDBRepo *pRepo = (STSDBRepo *)malloc(sizeof(STSDBRepo));
|
||||
STsdbRepo *pRepo = (STsdbRepo *)malloc(sizeof(STsdbRepo));
|
||||
if (pRepo == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -156,12 +156,12 @@ tsdb_repo_t *tsdbOpenRepo(char *tsdbDir) {
|
|||
return (tsdb_repo_t *)pRepo;
|
||||
}
|
||||
|
||||
static int32_t tsdbFlushCache(STSDBRepo *pRepo) {
|
||||
static int32_t tsdbFlushCache(STsdbRepo *pRepo) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
int32_t tsdbCloseRepo(tsdb_repo_t *repo) {
|
||||
STSDBRepo *pRepo = (STSDBRepo *)repo;
|
||||
STsdbRepo *pRepo = (STsdbRepo *)repo;
|
||||
|
||||
tsdbFlushCache(pRepo);
|
||||
|
||||
|
@ -175,7 +175,7 @@ int32_t tsdbCloseRepo(tsdb_repo_t *repo) {
|
|||
}
|
||||
|
||||
int32_t tsdbConfigRepo(tsdb_repo_t *repo, STsdbCfg *pCfg) {
|
||||
STSDBRepo *pRepo = (STSDBRepo *)repo;
|
||||
STsdbRepo *pRepo = (STsdbRepo *)repo;
|
||||
|
||||
pRepo->pCfg = pCfg;
|
||||
// TODO
|
||||
|
@ -187,7 +187,7 @@ STSDBRepoInfo *tsdbGetStatus(tsdb_repo_t *pRepo) {
|
|||
}
|
||||
|
||||
int32_t tsdbCreateTable(tsdb_repo_t *repo, STableCfg *pCfg) {
|
||||
STSDBRepo *pRepo = (STSDBRepo *)repo;
|
||||
STsdbRepo *pRepo = (STsdbRepo *)repo;
|
||||
return tsdbCreateTableImpl(pRepo->tsdbMeta, pCfg);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue