提交 3eefc938 编写于 作者: H Hongze Cheng

more code

上级 66c18cb7
...@@ -32,6 +32,11 @@ extern "C" { ...@@ -32,6 +32,11 @@ extern "C" {
#define tsdbTrace(...) do { if (tsdbDebugFlag & DEBUG_TRACE) { taosPrintLog("TSDB ", DEBUG_TRACE, tsdbDebugFlag, __VA_ARGS__); }} while(0) #define tsdbTrace(...) do { if (tsdbDebugFlag & DEBUG_TRACE) { taosPrintLog("TSDB ", DEBUG_TRACE, tsdbDebugFlag, __VA_ARGS__); }} while(0)
// clang-format on // clang-format on
typedef struct TSDBKEY TSDBKEY;
// tsdbMemTable2.c ==============================================================================================
typedef struct SMemTable SMemTable;
// tsdbMemTable ================ // tsdbMemTable ================
typedef struct STsdbRow STsdbRow; typedef struct STsdbRow STsdbRow;
typedef struct STbData STbData; typedef struct STbData STbData;
...@@ -851,6 +856,11 @@ struct STsdbRow { ...@@ -851,6 +856,11 @@ struct STsdbRow {
STSRow row; STSRow row;
}; };
struct TSDBKEY {
int64_t version;
TSKEY ts;
};
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -15,27 +15,45 @@ ...@@ -15,27 +15,45 @@
#include "tsdb.h" #include "tsdb.h"
typedef struct SMemTable SMemTable; typedef struct SMemData SMemData;
typedef struct SMemData SMemData; // typedef struct SMemSkipList SMemSkipList;
typedef struct SMemSkipList SMemSkipList; // typedef struct SMemSkipListNode SMemSkipListNode;
typedef struct SMemSkipListNode SMemSkipListNode; // typedef struct SMemSkipListCurosr SMemSkipListCurosr;
typedef struct SMemSkipListCurosr SMemSkipListCurosr;
#define SL_MAX_LEVEL 5 struct SMemData {
tb_uid_t suid;
tb_uid_t uid;
TSDBKEY minKey;
TSDBKEY maxKey;
int64_t nRows;
SMemData *pHashNext;
};
struct SMemTable { struct SMemTable {
STsdb *pTsdb; STsdb *pTsdb;
TSKEY minKey; int32_t nRef;
TSKEY maxKey; TSDBKEY minKey;
int64_t minVer; TSDBKEY maxKey;
int64_t maxVer; int64_t nRows;
int64_t nRows; SArray *pArray;
int32_t nHash;
int32_t nBucket;
SMemData **pBuckets;
SMemSkipListCurosr *pSlc;
}; };
int32_t tsdbMemTableCreate(STsdb *pTsdb, SMemTable **ppMemTable) {
int32_t code = 0;
// TODO
return code;
}
int32_t tsdbMemTableDestroy(SMemTable *pMemTable) {
int32_t code = 0;
// TODO
return code;
}
#if 0
#define SL_MAX_LEVEL 5
struct SMemSkipListNode { struct SMemSkipListNode {
int8_t level; int8_t level;
SMemSkipListNode *forwards[1]; // Windows does not allow 0 SMemSkipListNode *forwards[1]; // Windows does not allow 0
...@@ -49,18 +67,6 @@ struct SMemSkipList { ...@@ -49,18 +67,6 @@ struct SMemSkipList {
SMemSkipListNode pHead[1]; // Windows does not allow 0 SMemSkipListNode pHead[1]; // Windows does not allow 0
}; };
struct SMemData {
SMemData *pHashNext;
tb_uid_t suid;
tb_uid_t uid;
TSKEY minKey;
TSKEY maxKey;
int64_t minVer;
int64_t maxVer;
int64_t nRows;
SMemSkipList sl;
};
struct SMemSkipListCurosr { struct SMemSkipListCurosr {
SMemSkipList *pSl; SMemSkipList *pSl;
SMemSkipListNode *pNodes[SL_MAX_LEVEL]; SMemSkipListNode *pNodes[SL_MAX_LEVEL];
...@@ -377,4 +383,5 @@ static SMemSkipListNode *tsdbMemSkipListNodeCreate(SVBufPool *pPool, SMemSkipLis ...@@ -377,4 +383,5 @@ static SMemSkipListNode *tsdbMemSkipListNodeCreate(SVBufPool *pPool, SMemSkipLis
} }
return pNode; return pNode;
} }
\ No newline at end of file #endif
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册