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

more

上级 f660db70
......@@ -24,9 +24,10 @@
extern "C" {
#endif
typedef uint64_t tuid_t;
/* ------------------------ APIs Exposed ------------------------ */
// Types exported
typedef uint64_t tb_uid_t;
typedef struct SMeta SMeta;
typedef struct SMetaOpts SMetaOpts;
typedef struct SMetaQueryHandle SMetaQueryHandle;
......@@ -59,6 +60,33 @@ void metaQueryOptionsDestroy(SMetaQueryOpts *);
// STableOpts
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
}
#endif
......
......@@ -34,33 +34,6 @@ struct SMeta {
// 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
}
#endif
......
......@@ -16,14 +16,13 @@
#ifndef _TD_META_UID_H_
#define _TD_META_UID_H_
#include "os.h"
#include "meta.h"
#ifdef __cplusplus
extern "C" {
#endif
/* ------------------------ APIS EXPOSED ------------------------ */
typedef uint64_t tb_uid_t;
typedef struct STableUidGenerator STableUidGenerator;
// tb_uid_t
......
......@@ -9,23 +9,25 @@ TEST(MetaTest, meta_open_test) {
SMeta *meta = metaOpen(NULL);
std::cout << "Meta is opened!" << std::endl;
// // Create tables
// STableOpts tbOpts;
// char tbname[128];
// STSchema * pSchema;
// STSchemaBuilder sb;
// tdInitTSchemaBuilder(&sb, 0);
// for (size_t i = 0; i < 10; i++) {
// tdAddColToSchema(&sb, TSDB_DATA_TYPE_TIMESTAMP, i, 8);
// }
// pSchema = tdGetSchemaFromBuilder(&sb);
// tdDestroyTSchemaBuilder(&sb);
// for (size_t i = 0; i < 1000000; i++) {
// sprintf(tbname, "tb%ld", i);
// metaTableOptsInit(&tbOpts, 0, tbname, pSchema);
#if 0
// Create tables
STableOpts tbOpts;
char tbname[128];
STSchema * pSchema;
STSchemaBuilder sb;
tdInitTSchemaBuilder(&sb, 0);
for (size_t i = 0; i < 10; i++) {
tdAddColToSchema(&sb, TSDB_DATA_TYPE_TIMESTAMP, i, 8);
}
pSchema = tdGetSchemaFromBuilder(&sb);
tdDestroyTSchemaBuilder(&sb);
for (size_t i = 0; i < 1000000; i++) {
sprintf(tbname, "tb%ld", i);
metaTableOptsInit(&tbOpts, 0, tbname, pSchema);
// metaCreateTable(meta, &tbOpts);
// }
metaCreateTable(meta, &tbOpts);
}
#endif
// Close Meta
metaClose(meta);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册