more
This commit is contained in:
parent
a04b6dba7a
commit
8d8b7b1c00
|
@ -58,7 +58,7 @@ typedef struct STsdbCfg {
|
||||||
} STsdbCfg;
|
} STsdbCfg;
|
||||||
|
|
||||||
// STsdb
|
// STsdb
|
||||||
STsdb *tsdbOpen(const char *path, const STsdbCfg *pTsdbCfg, SMemAllocatorFactory *pMAF);
|
STsdb *tsdbOpen(const char *path, int32_t vgId, const STsdbCfg *pTsdbCfg, SMemAllocatorFactory *pMAF);
|
||||||
void tsdbClose(STsdb *);
|
void tsdbClose(STsdb *);
|
||||||
void tsdbRemove(const char *path);
|
void tsdbRemove(const char *path);
|
||||||
int tsdbInsertData(STsdb *pTsdb, SSubmitMsg *pMsg, SSubmitRsp *pRsp);
|
int tsdbInsertData(STsdb *pTsdb, SSubmitMsg *pMsg, SSubmitRsp *pRsp);
|
||||||
|
|
|
@ -106,7 +106,7 @@ static int vnodeOpenImpl(SVnode *pVnode) {
|
||||||
|
|
||||||
// Open tsdb
|
// Open tsdb
|
||||||
sprintf(dir, "%s/tsdb", pVnode->path);
|
sprintf(dir, "%s/tsdb", pVnode->path);
|
||||||
pVnode->pTsdb = tsdbOpen(dir, &(pVnode->config.tsdbCfg), vBufPoolGetMAF(pVnode));
|
pVnode->pTsdb = tsdbOpen(dir, pVnode->vgId, &(pVnode->config.tsdbCfg), vBufPoolGetMAF(pVnode));
|
||||||
if (pVnode->pTsdb == NULL) {
|
if (pVnode->pTsdb == NULL) {
|
||||||
// TODO: handle error
|
// TODO: handle error
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -50,7 +50,7 @@ struct STsdb {
|
||||||
STsdbFS * fs;
|
STsdbFS * fs;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define REPO_ID(r) 0
|
#define REPO_ID(r) ((r)->vgId)
|
||||||
#define REPO_CFG(r) (&(r)->config)
|
#define REPO_CFG(r) (&(r)->config)
|
||||||
#define REPO_FS(r) (r)->fs
|
#define REPO_FS(r) (r)->fs
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,12 @@
|
||||||
|
|
||||||
#include "tsdbDef.h"
|
#include "tsdbDef.h"
|
||||||
|
|
||||||
static STsdb *tsdbNew(const char *path, const STsdbCfg *pTsdbCfg, SMemAllocatorFactory *pMAF);
|
static STsdb *tsdbNew(const char *path, int32_t vgId, const STsdbCfg *pTsdbCfg, SMemAllocatorFactory *pMAF);
|
||||||
static void tsdbFree(STsdb *pTsdb);
|
static void tsdbFree(STsdb *pTsdb);
|
||||||
static int tsdbOpenImpl(STsdb *pTsdb);
|
static int tsdbOpenImpl(STsdb *pTsdb);
|
||||||
static void tsdbCloseImpl(STsdb *pTsdb);
|
static void tsdbCloseImpl(STsdb *pTsdb);
|
||||||
|
|
||||||
STsdb *tsdbOpen(const char *path, const STsdbCfg *pTsdbCfg, SMemAllocatorFactory *pMAF) {
|
STsdb *tsdbOpen(const char *path, int32_t vgId, const STsdbCfg *pTsdbCfg, SMemAllocatorFactory *pMAF) {
|
||||||
STsdb *pTsdb = NULL;
|
STsdb *pTsdb = NULL;
|
||||||
|
|
||||||
// Set default TSDB Options
|
// Set default TSDB Options
|
||||||
|
@ -35,7 +35,7 @@ STsdb *tsdbOpen(const char *path, const STsdbCfg *pTsdbCfg, SMemAllocatorFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the handle
|
// Create the handle
|
||||||
pTsdb = tsdbNew(path, pTsdbCfg, pMAF);
|
pTsdb = tsdbNew(path, vgId, pTsdbCfg, pMAF);
|
||||||
if (pTsdb == NULL) {
|
if (pTsdb == NULL) {
|
||||||
// TODO: handle error
|
// TODO: handle error
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -62,7 +62,7 @@ void tsdbClose(STsdb *pTsdb) {
|
||||||
void tsdbRemove(const char *path) { taosRemoveDir(path); }
|
void tsdbRemove(const char *path) { taosRemoveDir(path); }
|
||||||
|
|
||||||
/* ------------------------ STATIC METHODS ------------------------ */
|
/* ------------------------ STATIC METHODS ------------------------ */
|
||||||
static STsdb *tsdbNew(const char *path, const STsdbCfg *pTsdbCfg, SMemAllocatorFactory *pMAF) {
|
static STsdb *tsdbNew(const char *path, int32_t vgId, const STsdbCfg *pTsdbCfg, SMemAllocatorFactory *pMAF) {
|
||||||
STsdb *pTsdb = NULL;
|
STsdb *pTsdb = NULL;
|
||||||
|
|
||||||
pTsdb = (STsdb *)calloc(1, sizeof(STsdb));
|
pTsdb = (STsdb *)calloc(1, sizeof(STsdb));
|
||||||
|
@ -72,6 +72,7 @@ static STsdb *tsdbNew(const char *path, const STsdbCfg *pTsdbCfg, SMemAllocatorF
|
||||||
}
|
}
|
||||||
|
|
||||||
pTsdb->path = strdup(path);
|
pTsdb->path = strdup(path);
|
||||||
|
pTsdb->vgId = vgId;
|
||||||
tsdbOptionsCopy(&(pTsdb->config), pTsdbCfg);
|
tsdbOptionsCopy(&(pTsdb->config), pTsdbCfg);
|
||||||
pTsdb->pmaf = pMAF;
|
pTsdb->pmaf = pMAF;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue