diff --git a/include/dnode/vnode/meta/meta.h b/include/dnode/vnode/meta/meta.h index 09539cb2870bdc4cb77cae062ed2de235d9b67fa..c91db3d831964c10c6799220115dce55d4f18373 100644 --- a/include/dnode/vnode/meta/meta.h +++ b/include/dnode/vnode/meta/meta.h @@ -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 diff --git a/include/dnode/vnode/tsdb/tsdb.h b/include/dnode/vnode/tsdb/tsdb.h index d74a828538867d6ca1fb518429a8abfcd373cf41..26efce5d43f87589888ce00e7d5f378f53b5af0c 100644 --- a/include/dnode/vnode/tsdb/tsdb.h +++ b/include/dnode/vnode/tsdb/tsdb.h @@ -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 */ }; diff --git a/include/dnode/vnode/vnode.h b/include/dnode/vnode/vnode.h index cc74f8e433150ef39a0373d3d28aa5f8287de2c3..79ac57ddcb9c031d295e7952d7e8f7d886881c1c 100644 --- a/include/dnode/vnode/vnode.h +++ b/include/dnode/vnode/vnode.h @@ -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 diff --git a/source/dnode/vnode/impl/inc/vnodeDef.h b/source/dnode/vnode/impl/inc/vnodeDef.h index 791db342a335f500127bdb64f49e318c12c02c3d..41943ce4f1c03991fa138258bd1547c9798ade5a 100644 --- a/source/dnode/vnode/impl/inc/vnodeDef.h +++ b/source/dnode/vnode/impl/inc/vnodeDef.h @@ -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" diff --git a/source/dnode/vnode/impl/inc/vnodeFileSystem.h b/source/dnode/vnode/impl/inc/vnodeFS.h similarity index 69% rename from source/dnode/vnode/impl/inc/vnodeFileSystem.h rename to source/dnode/vnode/impl/inc/vnodeFS.h index 2a885c9c3439eeeb2815a67a77100160ea8fc18d..dbec98569569b13b4197c8dc3ed5ed9c5fc54d9d 100644 --- a/source/dnode/vnode/impl/inc/vnodeFileSystem.h +++ b/source/dnode/vnode/impl/inc/vnodeFS.h @@ -13,18 +13,35 @@ * along with this program. If not, see . */ -#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 diff --git a/source/dnode/vnode/impl/src/vnodeFileSystem.c b/source/dnode/vnode/impl/src/vnodeFS.c similarity index 100% rename from source/dnode/vnode/impl/src/vnodeFileSystem.c rename to source/dnode/vnode/impl/src/vnodeFS.c diff --git a/source/dnode/vnode/impl/src/vnodeWrite.c b/source/dnode/vnode/impl/src/vnodeWrite.c index 69a7cf3478fae774f36799adaf84a770b9bcb764..61bc54eab32da710ddc49ac4b5c6ff4b0bf677a7 100644 --- a/source/dnode/vnode/impl/src/vnodeWrite.c +++ b/source/dnode/vnode/impl/src/vnodeWrite.c @@ -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; } diff --git a/source/dnode/vnode/meta/src/metaTable.c b/source/dnode/vnode/meta/src/metaTable.c index 6a92fedc3d4a007c0d73197a5386036218db6e81..f34732a9fe36013754aaa1bc6b5268e06b62ece2 100644 --- a/source/dnode/vnode/meta/src/metaTable.c +++ b/source/dnode/vnode/meta/src/metaTable.c @@ -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; diff --git a/source/dnode/vnode/tq/src/tq.c b/source/dnode/vnode/tq/src/tq.c index c5f2252c72eb9339ca34b55e300352755fe977b1..130ff7040874a62340046812e42c106429b09bfc 100644 --- a/source/dnode/vnode/tq/src/tq.c +++ b/source/dnode/vnode/tq/src/tq.c @@ -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 }