提交 2ae35c34 编写于 作者: H Hongze Cheng

more

上级 735bd1c7
......@@ -68,8 +68,8 @@ typedef struct STbCfg {
SMeta *metaOpen(const char *path, const SMetaCfg *pOptions);
void metaClose(SMeta *pMeta);
void metaRemove(const char *path);
int metaCreateTable(SMeta *pMeta, const STbCfg *pTbOptions);
int metaDropTable(SMeta *pMeta, tb_uid_t uid);
int metaCreateTable(SMeta *pMeta, const void *pReq, const int len);
int metaDropTable(SMeta *pMeta, const void *pReq, const int len);
int metaCommit(SMeta *pMeta);
// Options
......
......@@ -29,7 +29,7 @@ typedef struct STsdbMemAllocator STsdbMemAllocator;
STsdb *tsdbOpen(const char *path, const STsdbCfg *);
void tsdbClose(STsdb *);
void tsdbRemove(const char *path);
int tsdbInsertData(STsdb *pTsdb, void *);
int tsdbInsertData(STsdb *pTsdb, void *pData, int len);
// STsdbCfg
int tsdbOptionsInit(STsdbCfg *);
......@@ -38,6 +38,9 @@ void tsdbOptionsClear(STsdbCfg *);
/* ------------------------ STRUCT DEFINITIONS ------------------------ */
struct STsdbCfg {
uint64_t lruCacheSize;
uint32_t keep0;
uint32_t keep1;
uint32_t keep2;
/* TODO */
};
......
......@@ -30,8 +30,37 @@ extern "C" {
#endif
/* ------------------------ TYPES EXPOSED ------------------------ */
typedef struct SVnode SVnode;
typedef struct SVnodeCfg SVnodeCfg;
typedef struct SVnode SVnode;
typedef struct SVnodeCfg {
/** vnode buffer pool options */
struct {
/** write buffer size */
uint64_t wsize;
/** use heap allocator or arena allocator */
bool isHeapAllocator;
};
/** time to live of tables in this vnode */
uint32_t ttl;
/** data to keep in this vnode */
uint32_t keep;
/** if TS data is eventually consistency */
bool isWeak;
/** TSDB config */
STsdbCfg tsdbCfg;
/** META config */
SMetaCfg metaCfg;
/** TQ config */
STqCfg tqCfg;
/** WAL config */
SWalCfg walCfg;
} SVnodeCfg;
/* ------------------------ SVnode ------------------------ */
/**
......@@ -101,38 +130,6 @@ void vnodeOptionsInit(SVnodeCfg *pOptions);
*/
void vnodeOptionsClear(SVnodeCfg *pOptions);
/* ------------------------ STRUCT DEFINITIONS ------------------------ */
struct SVnodeCfg {
/** vnode buffer pool options */
struct {
/** write buffer size */
uint64_t wsize;
/** use heap allocator or arena allocator */
bool isHeapAllocator;
};
/** time to live of tables in this vnode *
uint32_t ttl;
/** data to keep in this vnode */
uint32_t keep;
/** if TS data is eventually consistency */
bool isWeak;
/** TSDB config */
STsdbCfg tsdbCfg;
/** META config */
SMetaCfg metaCfg;
/** TQ config */
STqCfg tqCfg;
/** WAL config */
SWalCfg walCfg;
};
/* ------------------------ FOR COMPILE ------------------------ */
#if 1
......
......@@ -24,7 +24,7 @@
#include "vnode.h"
#include "vnodeBufferPool.h"
#include "vnodeCommit.h"
#include "vnodeFileSystem.h"
#include "vnodeFS.h"
#include "vnodeCfg.h"
#include "vnodeStateMgr.h"
#include "vnodeSync.h"
......
......@@ -13,18 +13,35 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_VNODE_FILE_SYSTEM_H_
#define _TD_VNODE_FILE_SYSTEM_H_
#ifndef _TD_VNODE_FS_H_
#define _TD_VNODE_FS_H_
#include "vnode.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
} SDir;
typedef struct {
} SFile;
typedef struct SFS {
void *pImpl;
int (*startEdit)(struct SFS *);
int (*endEdit)(struct SFS *);
} SFS;
typedef struct {
} SVnodeFS;
int vnodeOpenFS(SVnode *pVnode);
void vnodeCloseFS(SVnode *pVnode);
#ifdef __cplusplus
}
#endif
#endif /*_TD_VNODE_FILE_SYSTEM_H_*/
\ No newline at end of file
#endif /*_TD_VNODE_FS_H_*/
\ No newline at end of file
......@@ -34,19 +34,19 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
switch (pMsg->msgType) {
case TSDB_MSG_TYPE_CREATE_TABLE:
if (metaCreateTable(pVnode->pMeta, pMsg->pCont) < 0) {
if (metaCreateTable(pVnode->pMeta, pMsg->pCont, pMsg->contLen) < 0) {
/* TODO */
return -1;
}
break;
case TSDB_MSG_TYPE_DROP_TABLE:
if (metaDropTable(pVnode->pMeta, pMsg->pCont) < 0) {
if (metaDropTable(pVnode->pMeta, pMsg->pCont, pMsg->contLen) < 0) {
/* TODO */
return -1;
}
break;
case TSDB_MSG_TYPE_SUBMIT:
if (tsdbInsertData(pVnode->pTsdb, pMsg->pCont) < 0) {
if (tsdbInsertData(pVnode->pTsdb, pMsg->pCont, pMsg->contLen) < 0) {
/* TODO */
return -1;
}
......
......@@ -15,21 +15,22 @@
#include "metaDef.h"
int metaCreateTable(SMeta *pMeta, const STbCfg *pTbOptions) {
int metaCreateTable(SMeta *pMeta, const void *pCont, const int len) {
STbCfg *pTbCfg = NULL;
// Validate the tbOptions
if (metaValidateTbOptions(pMeta, pTbOptions) < 0) {
if (metaValidateTbOptions(pMeta, pTbCfg) < 0) {
// TODO: handle error
return -1;
}
// TODO: add atomicity
if (metaSaveTableToDB(pMeta, pTbOptions) < 0) {
if (metaSaveTableToDB(pMeta, pTbCfg) < 0) {
// TODO: handle error
return -1;
}
if (metaSaveTableToIdx(pMeta, pTbOptions) < 0) {
if (metaSaveTableToIdx(pMeta, pTbCfg) < 0) {
// TODO: handle error
return -1;
}
......@@ -37,7 +38,8 @@ int metaCreateTable(SMeta *pMeta, const STbCfg *pTbOptions) {
return 0;
}
int metaDropTable(SMeta *pMeta, tb_uid_t uid) {
int metaDropTable(SMeta *pMeta, const void *pCont, const int len) {
tb_uid_t uid;
if (metaRemoveTableFromIdx(pMeta, uid) < 0) {
// TODO: handle error
return -1;
......
......@@ -49,8 +49,8 @@ STQ* tqOpen(const char* path, STqCfg* tqConfig, TqLogReader* tqLogReader, SMemAl
strcpy(pTq->path, path);
pTq->tqConfig = tqConfig;
pTq->tqLogReader = tqLogReader;
pTq->tqMemRef.pAlloctorFactory = allocFac;
pTq->tqMemRef.pAllocator = allocFac->create(allocFac);
// pTq->tqMemRef.pAlloctorFactory = allocFac;
// pTq->tqMemRef.pAllocator = allocFac->create(allocFac);
if(pTq->tqMemRef.pAllocator == NULL) {
//TODO
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册