refact
This commit is contained in:
parent
903236fa5e
commit
552051da5a
|
@ -29,6 +29,7 @@ struct SMetaOptions {
|
||||||
size_t lruCacheSize; // LRU cache size
|
size_t lruCacheSize; // LRU cache size
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
typedef enum { META_INIT_TABLE = 0, META_SUPER_TABLE = 1, META_CHILD_TABLE = 2, META_NORMAL_TABLE = 3 } EMetaTableT;
|
typedef enum { META_INIT_TABLE = 0, META_SUPER_TABLE = 1, META_CHILD_TABLE = 2, META_NORMAL_TABLE = 3 } EMetaTableT;
|
||||||
typedef struct SSuperTableOpts {
|
typedef struct SSuperTableOpts {
|
||||||
tb_uid_t uid;
|
tb_uid_t uid;
|
||||||
|
@ -54,6 +55,7 @@ struct STableOptions {
|
||||||
SNormalTableOpts normalOpts;
|
SNormalTableOpts normalOpts;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,15 +23,15 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Types exported
|
// Types exported
|
||||||
typedef struct SMeta SMeta;
|
typedef struct SMeta SMeta;
|
||||||
typedef struct SMetaOptions SMetaOptions;
|
typedef struct SMetaOptions SMetaOptions;
|
||||||
typedef struct STableOptions STableOptions;
|
typedef struct STbOptions STbOptions;
|
||||||
|
|
||||||
// SMeta operations
|
// SMeta operations
|
||||||
SMeta *metaOpen(const char *path, const SMetaOptions *);
|
SMeta *metaOpen(const char *path, const SMetaOptions *);
|
||||||
void metaClose(SMeta *);
|
void metaClose(SMeta *);
|
||||||
void metaRemove(const char *path);
|
void metaRemove(const char *path);
|
||||||
int metaCreateTable(SMeta *pMeta, const STableOptions *);
|
int metaCreateTable(SMeta *pMeta, const STbOptions *);
|
||||||
int metaDropTable(SMeta *pMeta, tb_uid_t uid);
|
int metaDropTable(SMeta *pMeta, tb_uid_t uid);
|
||||||
int metaCommit(SMeta *);
|
int metaCommit(SMeta *);
|
||||||
|
|
||||||
|
@ -41,11 +41,11 @@ void metaOptionsClear(SMetaOptions *);
|
||||||
|
|
||||||
// STableOpts
|
// STableOpts
|
||||||
#define META_TABLE_OPTS_DECLARE(name) STableOpts name = {0}
|
#define META_TABLE_OPTS_DECLARE(name) STableOpts name = {0}
|
||||||
void metaNormalTableOptsInit(STableOptions *, const char *name, const STSchema *pSchema);
|
void metaNormalTableOptsInit(STbOptions *, const char *name, const STSchema *pSchema);
|
||||||
void metaSuperTableOptsInit(STableOptions *, const char *name, tb_uid_t uid, const STSchema *pSchema,
|
void metaSuperTableOptsInit(STbOptions *, const char *name, tb_uid_t uid, const STSchema *pSchema,
|
||||||
const STSchema *pTagSchema);
|
const STSchema *pTagSchema);
|
||||||
void metaChildTableOptsInit(STableOptions *, const char *name, tb_uid_t suid, const SKVRow tags);
|
void metaChildTableOptsInit(STbOptions *, const char *name, tb_uid_t suid, const SKVRow tags);
|
||||||
void metaTableOptsClear(STableOptions *);
|
void metaTableOptsClear(STbOptions *);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ int metaOpenDB(SMeta *pMeta) {
|
||||||
if (pMeta->pCache) {
|
if (pMeta->pCache) {
|
||||||
rocksdb_options_set_row_cache(options, pMeta->pCache);
|
rocksdb_options_set_row_cache(options, pMeta->pCache);
|
||||||
}
|
}
|
||||||
|
rocksdb_options_set_create_if_missing(options, 1);
|
||||||
|
|
||||||
pMeta->pDB = rocksdb_open(options, dbDir, &err);
|
pMeta->pDB = rocksdb_open(options, dbDir, &err);
|
||||||
if (pMeta->pDB == NULL) {
|
if (pMeta->pDB == NULL) {
|
||||||
|
|
|
@ -27,6 +27,7 @@ int metaOpenIdx(SMeta *pMeta) {
|
||||||
if (pMeta->pCache) {
|
if (pMeta->pCache) {
|
||||||
rocksdb_options_set_row_cache(options, pMeta->pCache);
|
rocksdb_options_set_row_cache(options, pMeta->pCache);
|
||||||
}
|
}
|
||||||
|
rocksdb_options_set_create_if_missing(options, 1);
|
||||||
|
|
||||||
pMeta->pIdx = rocksdb_open(options, idxDir, &err);
|
pMeta->pIdx = rocksdb_open(options, idxDir, &err);
|
||||||
if (pMeta->pIdx == NULL) {
|
if (pMeta->pIdx == NULL) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
|
|
||||||
int metaCreateTable(SMeta *pMeta, const STableOptions *pTbOptions) {
|
int metaCreateTable(SMeta *pMeta, const STbOptions *pTbOptions) {
|
||||||
// TODO
|
// TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
|
#if 0
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
|
|
||||||
#if 0
|
|
||||||
static STSchema *metaGetSimpleSchema() {
|
static STSchema *metaGetSimpleSchema() {
|
||||||
STSchema * pSchema = NULL;
|
STSchema * pSchema = NULL;
|
||||||
STSchemaBuilder sb = {0};
|
STSchemaBuilder sb = {0};
|
Loading…
Reference in New Issue