tsdbMeta.h 1.2 KB
Newer Older
H
more  
Hongze Cheng 已提交
1 2 3 4 5 6
/************************************
 * For internal usage
 ************************************/

#include "tsdb.h"

H
more  
Hongze Cheng 已提交
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
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
H
more  
Hongze Cheng 已提交
32
{
H
more  
Hongze Cheng 已提交
33 34
  tsdb_id_t tableId;
  int64_t uid;
H
more  
Hongze Cheng 已提交
35
  char *tableName;
H
more  
Hongze Cheng 已提交
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
  
  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;
H
more  
Hongze Cheng 已提交
54 55 56

  // Cached data
  SSkipList *pData;
H
more  
Hongze Cheng 已提交
57 58 59 60 61 62
} 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)