提交 63f03cfa 编写于 作者: H Hongze Cheng

more work

上级 d68899e5
...@@ -18,7 +18,9 @@ ...@@ -18,7 +18,9 @@
#include "mallocator.h" #include "mallocator.h"
#include "taosmsg.h" #include "taosmsg.h"
#include "tdlist.h"
#include "thash.h" #include "thash.h"
#include "tskiplist.h"
#include "tsdb.h" #include "tsdb.h"
#include "tsdbMemTable.h" #include "tsdbMemTable.h"
......
...@@ -15,14 +15,32 @@ ...@@ -15,14 +15,32 @@
#include "tsdbDef.h" #include "tsdbDef.h"
#if 1
typedef struct STbData {
TD_SLIST_NODE(STbData);
SSubmitMsg *pMsg;
} STbData;
#else
typedef struct STbData {
TD_SLIST_NODE(STbData);
uint64_t uid; // TODO: change here as tb_uid_t
TSKEY keyMin;
TSKEY keyMax;
uint64_t nRows;
SSkipList *pData; // Here need a container, may not use the SL
T_REF_DECLARE()
} STbData;
#endif
struct STsdbMemTable { struct STsdbMemTable {
T_REF_DECLARE() T_REF_DECLARE()
SRWLatch latch; SRWLatch latch;
TSKEY keyMin; TSKEY keyMin;
TSKEY keyMax; TSKEY keyMax;
uint32_t nRow; uint64_t nRow;
SHashObj * pHash;
SMemAllocator *pMA; SMemAllocator *pMA;
// Container
TD_SLIST(STbData) list;
}; };
STsdbMemTable *tsdbNewMemTable(SMemAllocatorFactory *pMAF) { STsdbMemTable *tsdbNewMemTable(SMemAllocatorFactory *pMAF) {
...@@ -43,8 +61,8 @@ STsdbMemTable *tsdbNewMemTable(SMemAllocatorFactory *pMAF) { ...@@ -43,8 +61,8 @@ STsdbMemTable *tsdbNewMemTable(SMemAllocatorFactory *pMAF) {
pMemTable->keyMin = TSKEY_MAX; pMemTable->keyMin = TSKEY_MAX;
pMemTable->keyMax = TSKEY_MIN; pMemTable->keyMax = TSKEY_MIN;
pMemTable->nRow = 0; pMemTable->nRow = 0;
pMemTable->pHash = NULL; /// TODO
pMemTable->pMA = pMA; pMemTable->pMA = pMA;
tSListInit(&(pMemTable->list));
// TODO // TODO
return pMemTable; return pMemTable;
...@@ -62,6 +80,15 @@ void tsdbFreeMemTable(SMemAllocatorFactory *pMAF, STsdbMemTable *pMemTable) { ...@@ -62,6 +80,15 @@ void tsdbFreeMemTable(SMemAllocatorFactory *pMAF, STsdbMemTable *pMemTable) {
} }
int tsdbInsertDataToMemTable(STsdbMemTable *pMemTable, SSubmitMsg *pMsg) { int tsdbInsertDataToMemTable(STsdbMemTable *pMemTable, SSubmitMsg *pMsg) {
// TODO SMemAllocator *pMA = pMemTable->pMA;
STbData * pTbData = (STbData *)((*pMA->malloc)(pMA, sizeof(*pTbData)));
if (pTbData == NULL) {
// TODO
}
tSListPush(&(pMemTable->list), pTbData);
return 0; return 0;
} }
\ No newline at end of file
/* ------------------------ STATIC METHODS ------------------------ */
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册