more
This commit is contained in:
parent
d0d56645a9
commit
835c3030c5
|
@ -16,6 +16,7 @@
|
|||
#ifndef _TD_META_H_
|
||||
#define _TD_META_H_
|
||||
|
||||
#include "mallocator.h"
|
||||
#include "os.h"
|
||||
#include "trow.h"
|
||||
|
||||
|
@ -71,7 +72,7 @@ typedef struct STbCfg {
|
|||
} STbCfg;
|
||||
|
||||
// SMeta operations
|
||||
SMeta *metaOpen(const char *path, const SMetaCfg *pMetaCfg);
|
||||
SMeta *metaOpen(const char *path, const SMetaCfg *pMetaCfg, SMemAllocatorFactory *pMAF);
|
||||
void metaClose(SMeta *pMeta);
|
||||
void metaRemove(const char *path);
|
||||
int metaCreateTable(SMeta *pMeta, STbCfg *pTbCfg);
|
||||
|
|
|
@ -94,7 +94,7 @@ static int vnodeOpenImpl(SVnode *pVnode) {
|
|||
|
||||
// Open meta
|
||||
sprintf(dir, "%s/meta", pVnode->path);
|
||||
pVnode->pMeta = metaOpen(dir, &(pVnode->config.metaCfg));
|
||||
pVnode->pMeta = metaOpen(dir, &(pVnode->config.metaCfg), vBufPoolGetMAF(pVnode));
|
||||
if (pVnode->pMeta == NULL) {
|
||||
// TODO: handle error
|
||||
return -1;
|
||||
|
|
|
@ -34,7 +34,7 @@ extern "C" {
|
|||
struct SMeta {
|
||||
char* path;
|
||||
SMetaCfg options;
|
||||
SMetaDB* pDB;
|
||||
SMetaDB* pDB;
|
||||
SMetaIdx* pIdx;
|
||||
SMetaCache* pCache;
|
||||
STbUidGenerator uidGnrt;
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
|
||||
#include "metaDef.h"
|
||||
|
||||
static SMeta *metaNew(const char *path, const SMetaCfg *pMetaCfg);
|
||||
static SMeta *metaNew(const char *path, const SMetaCfg *pMetaCfg, SMemAllocatorFactory *pMAF);
|
||||
static void metaFree(SMeta *pMeta);
|
||||
static int metaOpenImpl(SMeta *pMeta);
|
||||
static void metaCloseImpl(SMeta *pMeta);
|
||||
|
||||
SMeta *metaOpen(const char *path, const SMetaCfg *pMetaCfg) {
|
||||
SMeta *metaOpen(const char *path, const SMetaCfg *pMetaCfg, SMemAllocatorFactory *pMAF) {
|
||||
SMeta *pMeta = NULL;
|
||||
|
||||
// Set default options
|
||||
|
@ -37,7 +37,7 @@ SMeta *metaOpen(const char *path, const SMetaCfg *pMetaCfg) {
|
|||
}
|
||||
|
||||
// Allocate handle
|
||||
pMeta = metaNew(path, pMetaCfg);
|
||||
pMeta = metaNew(path, pMetaCfg, pMAF);
|
||||
if (pMeta == NULL) {
|
||||
// TODO: handle error
|
||||
return NULL;
|
||||
|
@ -65,7 +65,7 @@ void metaClose(SMeta *pMeta) {
|
|||
void metaRemove(const char *path) { taosRemoveDir(path); }
|
||||
|
||||
/* ------------------------ STATIC METHODS ------------------------ */
|
||||
static SMeta *metaNew(const char *path, const SMetaCfg *pMetaCfg) {
|
||||
static SMeta *metaNew(const char *path, const SMetaCfg *pMetaCfg, SMemAllocatorFactory *pMAF) {
|
||||
SMeta *pMeta;
|
||||
size_t psize = strlen(path);
|
||||
|
||||
|
@ -81,6 +81,7 @@ static SMeta *metaNew(const char *path, const SMetaCfg *pMetaCfg) {
|
|||
}
|
||||
|
||||
metaOptionsCopy(&(pMeta->options), pMetaCfg);
|
||||
pMeta->pmaf = pMAF;
|
||||
|
||||
return pMeta;
|
||||
};
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include "tsdbDef.h"
|
||||
|
||||
static STsdb *tsdbNew(const char *path, const STsdbCfg *pTsdbCfg);
|
||||
static STsdb *tsdbNew(const char *path, const STsdbCfg *pTsdbCfg, SMemAllocatorFactory *pMAF);
|
||||
static void tsdbFree(STsdb *pTsdb);
|
||||
static int tsdbOpenImpl(STsdb *pTsdb);
|
||||
static void tsdbCloseImpl(STsdb *pTsdb);
|
||||
|
@ -35,7 +35,7 @@ STsdb *tsdbOpen(const char *path, const STsdbCfg *pTsdbCfg, SMemAllocatorFactory
|
|||
}
|
||||
|
||||
// Create the handle
|
||||
pTsdb = tsdbNew(path, pTsdbCfg);
|
||||
pTsdb = tsdbNew(path, pTsdbCfg, pMAF);
|
||||
if (pTsdb == NULL) {
|
||||
// TODO: handle error
|
||||
return NULL;
|
||||
|
@ -62,7 +62,7 @@ void tsdbClose(STsdb *pTsdb) {
|
|||
void tsdbRemove(const char *path) { taosRemoveDir(path); }
|
||||
|
||||
/* ------------------------ STATIC METHODS ------------------------ */
|
||||
static STsdb *tsdbNew(const char *path, const STsdbCfg *pTsdbCfg) {
|
||||
static STsdb *tsdbNew(const char *path, const STsdbCfg *pTsdbCfg, SMemAllocatorFactory *pMAF) {
|
||||
STsdb *pTsdb = NULL;
|
||||
|
||||
pTsdb = (STsdb *)calloc(1, sizeof(STsdb));
|
||||
|
@ -73,6 +73,7 @@ static STsdb *tsdbNew(const char *path, const STsdbCfg *pTsdbCfg) {
|
|||
|
||||
pTsdb->path = strdup(path);
|
||||
tsdbOptionsCopy(&(pTsdb->options), pTsdbCfg);
|
||||
pTsdb->pmaf = pMAF;
|
||||
|
||||
return pTsdb;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue