Merge branch '2.0' of https://github.com/taosdata/TDengine into 2.0
This commit is contained in:
commit
126453b378
|
@ -0,0 +1,14 @@
|
||||||
|
#if !defined(_TD_CACHE_H_)
|
||||||
|
#define _TD_CACHE_H_
|
||||||
|
|
||||||
|
typedef void cache_pool_t;
|
||||||
|
|
||||||
|
typedef struct SCacheBlock
|
||||||
|
{
|
||||||
|
|
||||||
|
SCacheBlock *next;
|
||||||
|
} SCacheBlock;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _TD_CACHE_H_
|
|
@ -0,0 +1,18 @@
|
||||||
|
#if !defined(_TD_SCHEMA_H_)
|
||||||
|
#define _TD_SCHEMA_H_
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "type.h"
|
||||||
|
|
||||||
|
typedef struct _scolumn {
|
||||||
|
td_datatype_t type;
|
||||||
|
int32_t bytes;
|
||||||
|
} SColumn;
|
||||||
|
|
||||||
|
typedef struct SSchema {
|
||||||
|
int32_t numOfCols;
|
||||||
|
SColumn *columns;
|
||||||
|
} SSchema;
|
||||||
|
|
||||||
|
#endif // _TD_SCHEMA_H_
|
|
@ -0,0 +1,30 @@
|
||||||
|
#if !defined(_TD_TYPE_H_)
|
||||||
|
#define _TD_TYPE_H_
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
TD_DATATYPE_INVLD = 0,
|
||||||
|
TD_DATATYPE_BOOL,
|
||||||
|
TD_DATATYPE_TINYINT,
|
||||||
|
TD_DATATYPE_SMALLINT,
|
||||||
|
TD_DATATYPE_INT,
|
||||||
|
TD_DATATYPE_BIGINT,
|
||||||
|
TD_DATATYPE_FLOAT,
|
||||||
|
TD_DATATYPE_DOUBLE,
|
||||||
|
TD_DATATYPE_VARCHAR,
|
||||||
|
TD_DATATYPE_NCHAR,
|
||||||
|
TD_DATATYPE_BINARY
|
||||||
|
} td_datatype_t;
|
||||||
|
|
||||||
|
// TODO: finish below
|
||||||
|
#define TD_DATATYPE_BOOL_NULL
|
||||||
|
#define TD_DATATYPE_TINYINT_NULL
|
||||||
|
#define TD_DATATYPE_SMALLINT_NULL
|
||||||
|
#define TD_DATATYPE_INT_NULL
|
||||||
|
#define TD_DATATYPE_BIGINT_NULL
|
||||||
|
#define TD_DATATYPE_FLOAT_NULL
|
||||||
|
#define TD_DATATYPE_DOUBLE_NULL
|
||||||
|
#define TD_DATATYPE_VARCHAR_NULL
|
||||||
|
#define TD_DATATYPE_NCHAR_NULL
|
||||||
|
#define TD_DATATYPE_BINARY_NULL
|
||||||
|
|
||||||
|
#endif // _TD_TYPE_H_
|
|
@ -0,0 +1,18 @@
|
||||||
|
#if !defined(_TD_DATA_H_)
|
||||||
|
#define _TD_DATA_H_
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
// ---- Row data interface
|
||||||
|
typedef struct {
|
||||||
|
int32_t numOfRows;
|
||||||
|
char * data;
|
||||||
|
} SRData;
|
||||||
|
|
||||||
|
// ---- Column data interface
|
||||||
|
typedef struct {
|
||||||
|
int32_t numOfPoints;
|
||||||
|
char *data;
|
||||||
|
} SCData;
|
||||||
|
|
||||||
|
#endif // _TD_DATA_H_
|
|
@ -1,3 +1,6 @@
|
||||||
|
/**************************************
|
||||||
|
* FOR OUTSIDE USAGE
|
||||||
|
**************************************/
|
||||||
#if !defined(_TD_TSDB_H_)
|
#if !defined(_TD_TSDB_H_)
|
||||||
#define _TD_TSDB_H_
|
#define _TD_TSDB_H_
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
/************************************
|
||||||
|
* For internal usage
|
||||||
|
************************************/
|
||||||
|
|
||||||
|
#include "tsdb.h"
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
TSDB_TABLE_NORMAL,
|
||||||
|
TSDB_TABLE_STABLE,
|
||||||
|
TSDB_TABLE_SUPER
|
||||||
|
} TSDB_TABLE_TYPE;
|
||||||
|
|
||||||
|
// Below is the struct definition of super table
|
||||||
|
// TODO: May merge all table definitions
|
||||||
|
typedef struct _super_table {
|
||||||
|
int64_t uid;
|
||||||
|
char *tableName;
|
||||||
|
|
||||||
|
int64_t createdTime;
|
||||||
|
|
||||||
|
// TODO: try to merge the two schema into one
|
||||||
|
SSchema *pSchema;
|
||||||
|
SSchema *pTagSchema;
|
||||||
|
|
||||||
|
// A index created for all tables created using this super table
|
||||||
|
SSkipList * pIndex;
|
||||||
|
} SSTable;
|
||||||
|
|
||||||
|
// Normal table struct definition, table not
|
||||||
|
// created from super table
|
||||||
|
typedef struct SNTable
|
||||||
|
{
|
||||||
|
tsdb_id_t tableId;
|
||||||
|
int64_t uid;
|
||||||
|
char *tableName;
|
||||||
|
|
||||||
|
int64_t createdTime;
|
||||||
|
SSchema *pSchema
|
||||||
|
} SNTable;
|
||||||
|
|
||||||
|
// Table created from super table
|
||||||
|
typedef struct STable {
|
||||||
|
tsdb_id_t tableId;
|
||||||
|
int64_t uid;
|
||||||
|
char *tableName;
|
||||||
|
|
||||||
|
int64_t createdTime;
|
||||||
|
|
||||||
|
// super table UID
|
||||||
|
int64_t stableUid;
|
||||||
|
|
||||||
|
// Tag values for this table
|
||||||
|
char *pTagVal;
|
||||||
|
} STable;
|
||||||
|
|
||||||
|
#define TSDB_GET_TABLE_ID(pTable) (((STable *)pTable)->tid).tableId
|
||||||
|
#define TSDB_GET_TABLE_UID(pTable) (((STable *)pTable)->tid).uid
|
||||||
|
|
||||||
|
#define TSDB_IS_SUPER_TABLE(pTable)
|
|
@ -0,0 +1,47 @@
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
|
#include "tsdb.h"
|
||||||
|
#include "disk.h"
|
||||||
|
#include "cache.h"
|
||||||
|
|
||||||
|
typedef struct STSDBRepo
|
||||||
|
{
|
||||||
|
// TSDB configuration
|
||||||
|
STSDBcfg *pCfg;
|
||||||
|
|
||||||
|
/* Disk tier handle for multi-tier storage
|
||||||
|
*
|
||||||
|
* The handle is responsible for dealing with object-oriented
|
||||||
|
* storage.
|
||||||
|
*/
|
||||||
|
SDiskTier *pDiskTier;
|
||||||
|
|
||||||
|
/* Cache block list
|
||||||
|
*/
|
||||||
|
SCacheBlock *pCacheBloclList;
|
||||||
|
|
||||||
|
/* Map from tableId-->STable
|
||||||
|
*/
|
||||||
|
STable *pTableList;
|
||||||
|
|
||||||
|
/* Map from tableName->tableId
|
||||||
|
* TODO: may use dict
|
||||||
|
*/
|
||||||
|
void *pTableDict;
|
||||||
|
|
||||||
|
/* Map from super tableName->table
|
||||||
|
* TODO: may use dict
|
||||||
|
*/
|
||||||
|
void *pSTableDict;
|
||||||
|
|
||||||
|
/* File Store
|
||||||
|
*/
|
||||||
|
void *pFileStore;
|
||||||
|
|
||||||
|
pthread_mutext_t tsdbMutex;
|
||||||
|
|
||||||
|
} STSDBRepo;
|
||||||
|
|
||||||
|
#define TSDB_GET_TABLE_BY_ID(pRepo, sid) (((STSDBRepo *)pRepo)->pTableList)[sid]
|
||||||
|
#define TSDB_GET_TABLE_BY_NAME(pRepo, name)
|
|
@ -0,0 +1,2 @@
|
||||||
|
#include "tsdb.h"
|
||||||
|
|
Loading…
Reference in New Issue