From 9f0c01510e09b5c4bbdde3a83dbce31ee5d7a78c Mon Sep 17 00:00:00 2001 From: hzcheng Date: Mon, 2 Mar 2020 13:16:15 +0000 Subject: [PATCH] more --- src/vnode/tsdb/inc/tsdb.h | 22 ++------------------- src/vnode/tsdb/src/tsdbMain.c | 37 ++++++++++++++++++----------------- 2 files changed, 21 insertions(+), 38 deletions(-) diff --git a/src/vnode/tsdb/inc/tsdb.h b/src/vnode/tsdb/inc/tsdb.h index 198618978e..8478becaf2 100644 --- a/src/vnode/tsdb/inc/tsdb.h +++ b/src/vnode/tsdb/inc/tsdb.h @@ -35,25 +35,6 @@ typedef struct { char data[]; } SSubmitBlock; -// Retention policy. -typedef struct { - // TODO: Need a more fancy description - int32_t keep1; - int32_t keep2; - int32_t keep3; -} SRetentionPolicy; - -// Data sharding policy. -typedef struct { - // TODO: Need a more fancy description - int32_t daysPerFile; -} SDataShardPolicy; - -// Rows in file block policy -typedef struct { - // TODO: Need a more fancy description -} SBlockRowsPolicy; - // the TSDB repository configuration typedef struct { char * rootDir; // TSDB repository root directory, TODO: need to adjust here @@ -62,7 +43,8 @@ typedef struct { 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 + int32_t keep; // day of data to keep + int64_t maxCacheSize; // maximum cache size this TSDB can use void * cachePool; // the cache pool the repository to use } STsdbCfg; diff --git a/src/vnode/tsdb/src/tsdbMain.c b/src/vnode/tsdb/src/tsdbMain.c index 0cc77c7b99..826592bce6 100644 --- a/src/vnode/tsdb/src/tsdbMain.c +++ b/src/vnode/tsdb/src/tsdbMain.c @@ -46,24 +46,6 @@ typedef struct _tsdb_repo { #define TSDB_IS_REPO_ACTIVE(pRepo) ((pRepo)->state == TSDB_REPO_STATE_ACTIVE) #define TSDB_IS_REPO_CLOSED(pRepo) ((pRepo)->state == TSDB_REPO_STATE_CLOSED) -// Check the correctness of the TSDB configuration -static int32_t tsdbCheckCfg(STsdbCfg *pCfg) { - if (pCfg->rootDir == NULL) return -1; - - if (access(pCfg->rootDir, F_OK|R_OK|W_OK) == -1) { - return -1; - } - // TODO - return 0; -} - -static int32_t tsdbCreateFiles(STsdbRepo *pRepo) { - // TODO -} - -static int32_t tsdbClearFiles(STsdbRepo *pRepo) { - // TODO -} tsdb_repo_t *tsdbCreateRepo(STsdbCfg *pCfg) { @@ -201,4 +183,23 @@ STableInfo *tsdbGetTableInfo(tsdb_repo_t *pRepo, STableId tid, int32_t *error) { int32_t tsdbInsertData(tsdb_repo_t *pRepo, STableId tid, char *pData, int32_t *error) { // TODO +} + +// Check the correctness of the TSDB configuration +static int32_t tsdbCheckCfg(STsdbCfg *pCfg) { + if (pCfg->rootDir == NULL) return -1; + + if (access(pCfg->rootDir, F_OK|R_OK|W_OK) == -1) { + return -1; + } + // TODO + return 0; +} + +static int32_t tsdbCreateFiles(STsdbRepo *pRepo) { + // TODO +} + +static int32_t tsdbClearFiles(STsdbRepo *pRepo) { + // TODO } \ No newline at end of file