more code

This commit is contained in:
Hongze Cheng 2022-05-31 07:34:39 +00:00
parent 66c18cb70b
commit 3eefc93830
2 changed files with 46 additions and 29 deletions

View File

@ -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 {
STSRow row; STSRow row;
}; };
struct TSDBKEY {
int64_t version;
TSKEY ts;
};
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -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 {
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
} }
return pNode; return pNode;
} }
#endif