Merge pull request #1629 from taosdata/hotfix/refactor_tsdb_h
refactor tsdb.h
This commit is contained in:
commit
b7147d95c8
|
@ -20,10 +20,10 @@
|
|||
#include <stdint.h>
|
||||
|
||||
#include "dataformat.h"
|
||||
#include "name.h"
|
||||
#include "taosdef.h"
|
||||
#include "taosmsg.h"
|
||||
#include "tarray.h"
|
||||
#include "name.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -67,9 +67,6 @@ int32_t tsdbDropRepo(tsdb_repo_t *repo);
|
|||
tsdb_repo_t *tsdbOpenRepo(char *tsdbDir, STsdbAppH *pAppH);
|
||||
int32_t tsdbCloseRepo(tsdb_repo_t *repo);
|
||||
int32_t tsdbConfigRepo(tsdb_repo_t *repo, STsdbCfg *pCfg);
|
||||
int32_t tsdbTriggerCommit(tsdb_repo_t *repo);
|
||||
int32_t tsdbLockRepo(tsdb_repo_t *repo);
|
||||
int32_t tsdbUnLockRepo(tsdb_repo_t *repo);
|
||||
|
||||
// --------- TSDB TABLE DEFINITION
|
||||
typedef struct {
|
||||
|
@ -99,27 +96,6 @@ int tsdbCreateTable(tsdb_repo_t *repo, STableCfg *pCfg);
|
|||
int tsdbDropTable(tsdb_repo_t *pRepo, STableId tableId);
|
||||
int tsdbAlterTable(tsdb_repo_t *repo, STableCfg *pCfg);
|
||||
|
||||
typedef struct {
|
||||
int32_t totalLen;
|
||||
int32_t len;
|
||||
SDataRow row;
|
||||
} SSubmitBlkIter;
|
||||
|
||||
int tsdbInitSubmitBlkIter(SSubmitBlk *pBlock, SSubmitBlkIter *pIter);
|
||||
SDataRow tsdbGetSubmitBlkNext(SSubmitBlkIter *pIter);
|
||||
|
||||
#define TSDB_SUBMIT_MSG_HEAD_SIZE sizeof(SSubmitMsg)
|
||||
|
||||
// SSubmitMsg Iterator
|
||||
typedef struct {
|
||||
int32_t totalLen;
|
||||
int32_t len;
|
||||
SSubmitBlk *pBlock;
|
||||
} SSubmitMsgIter;
|
||||
|
||||
int tsdbInitSubmitMsgIter(SSubmitMsg *pMsg, SSubmitMsgIter *pIter);
|
||||
SSubmitBlk *tsdbGetSubmitMsgNext(SSubmitMsgIter *pIter);
|
||||
|
||||
// the TSDB repository info
|
||||
typedef struct STsdbRepoInfo {
|
||||
STsdbCfg tsdbCfg;
|
||||
|
@ -139,34 +115,6 @@ typedef struct {
|
|||
} STableInfo;
|
||||
STableInfo *tsdbGetTableInfo(tsdb_repo_t *pRepo, STableId tid);
|
||||
|
||||
// -- For table manipulation
|
||||
|
||||
/**
|
||||
* Create/Alter a table in a TSDB repository handle
|
||||
* @param repo the TSDB repository handle
|
||||
* @param pCfg the table configurations, the upper layer should free the pointer
|
||||
*
|
||||
* @return 0 for success, -1 for failure and the error number is set
|
||||
*/
|
||||
|
||||
/**
|
||||
* Drop a table in a repository and free all the resources it takes
|
||||
* @param pRepo the TSDB repository handle
|
||||
* @param tid the ID of the table to drop
|
||||
* @param error the error number to set when failure occurs
|
||||
*
|
||||
* @return 0 for success, -1 for failure and the error number is set
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the information of a table in the repository
|
||||
* @param pRepo the TSDB repository handle
|
||||
* @param tid the ID of the table to drop
|
||||
* @param error the error number to set when failure occurs
|
||||
*
|
||||
* @return a table information handle for success, NULL for failure and the error number is set
|
||||
*/
|
||||
|
||||
// -- FOR INSERT DATA
|
||||
/**
|
||||
* Insert data to a table in a repository
|
||||
|
@ -202,12 +150,6 @@ typedef struct SBlockInfo {
|
|||
STableId tableId;
|
||||
} SBlockInfo;
|
||||
|
||||
// TODO: move this data struct out of the module
|
||||
//typedef struct SData {
|
||||
// int32_t num;
|
||||
// char * data;
|
||||
//} SData;
|
||||
|
||||
typedef struct SDataBlockInfo {
|
||||
STimeWindow window;
|
||||
int32_t rows;
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
#ifndef _TD_TSDB_MAIN_H_
|
||||
#define _TD_TSDB_MAIN_H_
|
||||
|
||||
#include "tsdb.h"
|
||||
#include "tlist.h"
|
||||
#include "tglobalcfg.h"
|
||||
#include "tlist.h"
|
||||
#include "tsdb.h"
|
||||
#include "tskiplist.h"
|
||||
#include "tutil.h"
|
||||
|
||||
|
@ -217,10 +217,12 @@ typedef struct {
|
|||
|
||||
STsdbFileH *tsdbInitFileH(char *dataDir, int maxFiles);
|
||||
void tsdbCloseFileH(STsdbFileH *pFileH);
|
||||
int tsdbCreateFile(char *dataDir, int fileId, const char *suffix, int maxTables, SFile *pFile, int writeHeader, int toClose);
|
||||
int tsdbCreateFile(char *dataDir, int fileId, const char *suffix, int maxTables, SFile *pFile, int writeHeader,
|
||||
int toClose);
|
||||
int tsdbCreateFGroup(STsdbFileH *pFileH, char *dataDir, int fid, int maxTables);
|
||||
int tsdbOpenFile(SFile *pFile, int oflag);
|
||||
int tsdbCloseFile(SFile *pFile); SFileGroup *tsdbOpenFilesForCommit(STsdbFileH *pFileH, int fid);
|
||||
int tsdbCloseFile(SFile *pFile);
|
||||
SFileGroup *tsdbOpenFilesForCommit(STsdbFileH *pFileH, int fid);
|
||||
int tsdbRemoveFileGroup(STsdbFileH *pFile, int fid);
|
||||
|
||||
#define TSDB_FGROUP_ITER_FORWARD TSDB_ORDER_ASC
|
||||
|
@ -306,7 +308,8 @@ typedef struct {
|
|||
|
||||
STsdbFileH *tsdbGetFile(tsdb_repo_t *pRepo);
|
||||
|
||||
int tsdbCopyBlockDataInFile(SFile *pOutFile, SFile *pInFile, SCompInfo *pCompInfo, int idx, int isLast, SDataCols *pCols);
|
||||
int tsdbCopyBlockDataInFile(SFile *pOutFile, SFile *pInFile, SCompInfo *pCompInfo, int idx, int isLast,
|
||||
SDataCols *pCols);
|
||||
|
||||
int tsdbLoadCompIdx(SFileGroup *pGroup, void *buf, int maxTables);
|
||||
int tsdbLoadCompBlocks(SFileGroup *pGroup, SCompIdx *pIdx, void *buf);
|
||||
|
@ -350,6 +353,30 @@ typedef struct _tsdb_repo {
|
|||
|
||||
} STsdbRepo;
|
||||
|
||||
typedef struct {
|
||||
int32_t totalLen;
|
||||
int32_t len;
|
||||
SDataRow row;
|
||||
} SSubmitBlkIter;
|
||||
|
||||
int tsdbInitSubmitBlkIter(SSubmitBlk *pBlock, SSubmitBlkIter *pIter);
|
||||
SDataRow tsdbGetSubmitBlkNext(SSubmitBlkIter *pIter);
|
||||
|
||||
#define TSDB_SUBMIT_MSG_HEAD_SIZE sizeof(SSubmitMsg)
|
||||
|
||||
// SSubmitMsg Iterator
|
||||
typedef struct {
|
||||
int32_t totalLen;
|
||||
int32_t len;
|
||||
SSubmitBlk *pBlock;
|
||||
} SSubmitMsgIter;
|
||||
|
||||
int tsdbInitSubmitMsgIter(SSubmitMsg *pMsg, SSubmitMsgIter *pIter);
|
||||
SSubmitBlk *tsdbGetSubmitMsgNext(SSubmitMsgIter *pIter);
|
||||
|
||||
int32_t tsdbTriggerCommit(tsdb_repo_t *repo);
|
||||
int32_t tsdbLockRepo(tsdb_repo_t *repo);
|
||||
int32_t tsdbUnLockRepo(tsdb_repo_t *repo);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue