diff --git a/source/dnode/vnode/meta/inc/metaDef.h b/source/dnode/vnode/meta/inc/metaDef.h
index ef0cc9e4c2..bfb297ea4d 100644
--- a/source/dnode/vnode/meta/inc/metaDef.h
+++ b/source/dnode/vnode/meta/inc/metaDef.h
@@ -25,9 +25,9 @@ extern "C" {
struct SMeta {
char* path; // path of current meta
- STbUidGenerator uidGenerator; // meta table UID generator
- SMetaDB* pMetaDB; // meta DB for real storage engine
SMetaOptions options; // meta option
+ SMetaDB* pMetaDB; // meta DB for real storage engine
+ STbUidGenerator uidGenerator; // meta table UID generator
};
#ifdef __cplusplus
diff --git a/source/dnode/vnode/meta/src/metaCommit.c b/source/dnode/vnode/meta/src/metaCommit.c
index f2f48bbc8a..805e4f3e3d 100644
--- a/source/dnode/vnode/meta/src/metaCommit.c
+++ b/source/dnode/vnode/meta/src/metaCommit.c
@@ -12,3 +12,10 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
+
+#include "meta.h"
+
+int metaCommit(SMeta *pMeta) {
+ // TODO
+ return 0;
+}
\ No newline at end of file
diff --git a/source/dnode/vnode/meta/src/metaMain.c b/source/dnode/vnode/meta/src/metaMain.c
index 0615bf1e50..c0fcf6898a 100644
--- a/source/dnode/vnode/meta/src/metaMain.c
+++ b/source/dnode/vnode/meta/src/metaMain.c
@@ -16,9 +16,9 @@
#include "tcoding.h"
#include "meta.h"
+#include "metaDB.h"
#include "metaDef.h"
#include "metaOptions.h"
-#include "metaDB.h"
static SMeta *metaNew(const char *path, const SMetaOptions *pMetaOptions);
static void metaFree(SMeta *pMeta);
@@ -57,6 +57,8 @@ SMeta *metaOpen(const char *path, const SMetaOptions *pMetaOptions) {
return NULL;
}
+ tableUidGeneratorInit(&(pMeta->uidGenerator), IVLD_TB_UID);
+
return pMeta;
}
@@ -68,33 +70,7 @@ void metaClose(SMeta *pMeta) {
}
}
-#if 0
-int metaCreateTable(SMeta *pMeta, const STableOptions *pTableOpts) {
- size_t vallen;
- char * pUid;
-
- // Check if table already exists
- pUid = tkvGet(pMeta->tbnameDb, NULL, pTableOpts->name, strlen(pTableOpts->name), &vallen);
- if (pUid) {
- free(pUid);
- // Table already exists, return error code
- return -1;
- }
-
- switch (pTableOpts->type) {
- case META_SUPER_TABLE:
- return metaCreateSuperTable(pMeta, pTableOpts->name, &(pTableOpts->superOpts));
- case META_CHILD_TABLE:
- return metaCreateChildTable(pMeta, pTableOpts->name, &(pTableOpts->childOpts));
- case META_NORMAL_TABLE:
- return metaCreateNormalTable(pMeta, pTableOpts->name, &(pTableOpts->normalOpts));
- default:
- ASSERT(0);
- }
-
- return 0;
-}
-#endif
+void metaRemove(const char *path) { taosRemoveDir(path); }
/* ------------------------ STATIC METHODS ------------------------ */
static SMeta *metaNew(const char *path, const SMetaOptions *pMetaOptions) {
@@ -125,6 +101,32 @@ static void metaFree(SMeta *pMeta) {
// OLD -------------------------------------------------------------------
#if 0
+int metaCreateTable(SMeta *pMeta, const STableOptions *pTableOpts) {
+ size_t vallen;
+ char * pUid;
+
+ // Check if table already exists
+ pUid = tkvGet(pMeta->tbnameDb, NULL, pTableOpts->name, strlen(pTableOpts->name), &vallen);
+ if (pUid) {
+ free(pUid);
+ // Table already exists, return error code
+ return -1;
+ }
+
+ switch (pTableOpts->type) {
+ case META_SUPER_TABLE:
+ return metaCreateSuperTable(pMeta, pTableOpts->name, &(pTableOpts->superOpts));
+ case META_CHILD_TABLE:
+ return metaCreateChildTable(pMeta, pTableOpts->name, &(pTableOpts->childOpts));
+ case META_NORMAL_TABLE:
+ return metaCreateNormalTable(pMeta, pTableOpts->name, &(pTableOpts->normalOpts));
+ default:
+ ASSERT(0);
+ }
+
+ return 0;
+}
+
static int metaCreateSuperTable(SMeta *pMeta, const char *tbname, const SSuperTableOpts *pSuperTableOpts) {
size_t vallen;
size_t keylen;
diff --git a/source/dnode/vnode/meta/src/metaTable.c b/source/dnode/vnode/meta/src/metaTable.c
index 6dea4a4e57..029d43dc85 100644
--- a/source/dnode/vnode/meta/src/metaTable.c
+++ b/source/dnode/vnode/meta/src/metaTable.c
@@ -11,4 +11,16 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
- */
\ No newline at end of file
+ */
+
+#include "meta.h"
+
+int metaCreateTable(SMeta *pMeta, const STableOptions *pTbOptions) {
+ // TODO
+ return 0;
+}
+
+int metaDropTable(SMeta *pMeta, tb_uid_t uid) {
+ // TODO
+ return 0;
+}