TD-34
This commit is contained in:
parent
dca2abd6fb
commit
cfa6e5469b
|
@ -58,6 +58,7 @@ int32_t tsdbDropRepo(tsdb_repo_t *repo);
|
|||
tsdb_repo_t * tsdbOpenRepo(char *tsdbDir);
|
||||
int32_t tsdbCloseRepo(tsdb_repo_t *repo);
|
||||
int32_t tsdbConfigRepo(tsdb_repo_t *repo, STsdbCfg *pCfg);
|
||||
int32_t tsdbTriggerCommit(tsdb_repo_t *repo);
|
||||
|
||||
// --------- TSDB TABLE DEFINITION
|
||||
typedef struct {
|
||||
|
|
|
@ -46,6 +46,7 @@ typedef struct STable {
|
|||
void *pData; // For TSDB_NORMAL_TABLE and TSDB_CHILD_TABLE, it is the skiplist for cache data
|
||||
void *pIndex; // For TSDB_SUPER_TABLE, it is the skiplist index
|
||||
} content;
|
||||
void * iData; // Skiplist to commit
|
||||
void * eventHandler; // TODO
|
||||
void * streamHandler; // TODO
|
||||
struct STable *next; // TODO: remove the next
|
||||
|
|
|
@ -64,7 +64,10 @@ typedef struct _tsdb_repo {
|
|||
// Disk tier handle for multi-tier storage
|
||||
void *diskTier;
|
||||
|
||||
pthread_mutex_t tsdbMutex;
|
||||
pthread_mutex_t mutex;
|
||||
|
||||
int commit;
|
||||
pthread_t commitThread;
|
||||
|
||||
// A limiter to monitor the resources used by tsdb
|
||||
void *limiter;
|
||||
|
@ -80,6 +83,7 @@ static int tsdbOpenMetaFile(char *tsdbDir);
|
|||
static int32_t tsdbInsertDataToTable(tsdb_repo_t *repo, SSubmitBlk *pBlock);
|
||||
static int32_t tsdbRestoreCfg(STsdbRepo *pRepo, STsdbCfg *pCfg);
|
||||
static int32_t tsdbGetDataDirName(STsdbRepo *pRepo, char *fname);
|
||||
static void * tsdbCommitToFile(void *arg);
|
||||
|
||||
#define TSDB_GET_TABLE_BY_ID(pRepo, sid) (((STSDBRepo *)pRepo)->pTableList)[sid]
|
||||
#define TSDB_GET_TABLE_BY_NAME(pRepo, name)
|
||||
|
@ -298,6 +302,18 @@ int32_t tsdbConfigRepo(tsdb_repo_t *repo, STsdbCfg *pCfg) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t tsdbTriggerCommit(tsdb_repo_t *repo) {
|
||||
STsdbRepo *pRepo = (STsdbRepo *)repo;
|
||||
|
||||
if (pthread_mutex_lock(&(pRepo->mutex)) < 0) return -1;
|
||||
if (pRepo->commit) return 0;
|
||||
pRepo->commit = 1;
|
||||
pthread_create(&(pRepo->commitThread), NULL, tsdbCommitToFile, (void *)repo);
|
||||
pthread_mutex_unlock(&(pRepo->mutex));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the TSDB repository information, including some statistics
|
||||
* @param pRepo the TSDB repository handle
|
||||
|
@ -674,3 +690,9 @@ static int32_t tsdbInsertDataToTable(tsdb_repo_t *repo, SSubmitBlk *pBlock) {
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *tsdbCommitToFile(void *arg) {
|
||||
STsdbRepo *pRepo = (STsdbRepo *)arg;
|
||||
// TODO
|
||||
return NULL;
|
||||
}
|
Loading…
Reference in New Issue