提交 7d7c380c 编写于 作者: H Hongze Cheng

more

上级 f660db70
...@@ -24,9 +24,10 @@ ...@@ -24,9 +24,10 @@
extern "C" { extern "C" {
#endif #endif
typedef uint64_t tuid_t; /* ------------------------ APIs Exposed ------------------------ */
// Types exported // Types exported
typedef uint64_t tb_uid_t;
typedef struct SMeta SMeta; typedef struct SMeta SMeta;
typedef struct SMetaOpts SMetaOpts; typedef struct SMetaOpts SMetaOpts;
typedef struct SMetaQueryHandle SMetaQueryHandle; typedef struct SMetaQueryHandle SMetaQueryHandle;
...@@ -59,6 +60,33 @@ void metaQueryOptionsDestroy(SMetaQueryOpts *); ...@@ -59,6 +60,33 @@ void metaQueryOptionsDestroy(SMetaQueryOpts *);
// STableOpts // STableOpts
void metaTableOptsInit(STableOpts *, int8_t type, const char *name, const STSchema *pSchema); void metaTableOptsInit(STableOpts *, int8_t type, const char *name, const STSchema *pSchema);
/* ------------------------ Impl should hidden ------------------------ */
typedef enum { META_SUPER_TABLE = 0, META_CHILD_TABLE = 1, META_NORMAL_TABLE = 2 } EMetaTableT;
typedef struct SSuperTableOpts {
tb_uid_t uid;
STSchema *pSchema; // (ts timestamp, a int)
STSchema *pTagSchema; // (tag1 binary(10), tag2 int)
} SSuperTableOpts;
typedef struct SChildTableOpts {
tb_uid_t suid; // super table uid
SKVRow tags; // tag value of the child table
} SChildTableOpts;
typedef struct SNormalTableOpts {
STSchema *pSchema;
} SNormalTableOpts;
struct STableOpts {
EMetaTableT type;
char * name;
union {
SSuperTableOpts superOpts;
SChildTableOpts childOpts;
SNormalTableOpts normalOpts;
};
};
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -34,33 +34,6 @@ struct SMeta { ...@@ -34,33 +34,6 @@ struct SMeta {
// STkvCache* metaCache; // TODO: add a global cache here // STkvCache* metaCache; // TODO: add a global cache here
}; };
/* ------------------------ TEST CODE ------------------------ */
typedef enum { META_SUPER_TABLE = 0, META_CHILD_TABLE = 1, META_NORMAL_TABLE = 2 } EMetaTableT;
typedef struct SSuperTableOpts {
tb_uid_t uid;
STSchema* pSchema; // (ts timestamp, a int)
STSchema* pTagSchema; // (tag1 binary(10), tag2 int)
} SSuperTableOpts;
typedef struct SChildTableOpts {
tb_uid_t suid; // super table uid
SKVRow tags; // tag value of the child table
} SChildTableOpts;
typedef struct SNormalTableOpts {
STSchema* pSchema;
} SNormalTableOpts;
struct STableOpts {
EMetaTableT type;
char* name;
union {
SSuperTableOpts superOpts;
SChildTableOpts childOpts;
SNormalTableOpts normalOpts;
};
};
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -16,14 +16,13 @@ ...@@ -16,14 +16,13 @@
#ifndef _TD_META_UID_H_ #ifndef _TD_META_UID_H_
#define _TD_META_UID_H_ #define _TD_META_UID_H_
#include "os.h" #include "meta.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* ------------------------ APIS EXPOSED ------------------------ */ /* ------------------------ APIS EXPOSED ------------------------ */
typedef uint64_t tb_uid_t;
typedef struct STableUidGenerator STableUidGenerator; typedef struct STableUidGenerator STableUidGenerator;
// tb_uid_t // tb_uid_t
......
...@@ -9,23 +9,25 @@ TEST(MetaTest, meta_open_test) { ...@@ -9,23 +9,25 @@ TEST(MetaTest, meta_open_test) {
SMeta *meta = metaOpen(NULL); SMeta *meta = metaOpen(NULL);
std::cout << "Meta is opened!" << std::endl; std::cout << "Meta is opened!" << std::endl;
// // Create tables #if 0
// STableOpts tbOpts; // Create tables
// char tbname[128]; STableOpts tbOpts;
// STSchema * pSchema; char tbname[128];
// STSchemaBuilder sb; STSchema * pSchema;
// tdInitTSchemaBuilder(&sb, 0); STSchemaBuilder sb;
// for (size_t i = 0; i < 10; i++) { tdInitTSchemaBuilder(&sb, 0);
// tdAddColToSchema(&sb, TSDB_DATA_TYPE_TIMESTAMP, i, 8); for (size_t i = 0; i < 10; i++) {
// } tdAddColToSchema(&sb, TSDB_DATA_TYPE_TIMESTAMP, i, 8);
// pSchema = tdGetSchemaFromBuilder(&sb); }
// tdDestroyTSchemaBuilder(&sb); pSchema = tdGetSchemaFromBuilder(&sb);
// for (size_t i = 0; i < 1000000; i++) { tdDestroyTSchemaBuilder(&sb);
// sprintf(tbname, "tb%ld", i); for (size_t i = 0; i < 1000000; i++) {
// metaTableOptsInit(&tbOpts, 0, tbname, pSchema); sprintf(tbname, "tb%ld", i);
metaTableOptsInit(&tbOpts, 0, tbname, pSchema);
// metaCreateTable(meta, &tbOpts); metaCreateTable(meta, &tbOpts);
// } }
#endif
// Close Meta // Close Meta
metaClose(meta); metaClose(meta);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册