refact code
This commit is contained in:
parent
215883ea64
commit
fb45b8d577
|
@ -83,6 +83,9 @@ static FORCE_INLINE int32_t tsDecompressDoubleLossy(const char *const input, int
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* REGULAR COMPRESSION
|
||||||
|
*************************************************************************/
|
||||||
int32_t tsCompressTimestamp(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int32_t nOut, uint8_t cmprAlg, void *pBuf,
|
int32_t tsCompressTimestamp(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int32_t nOut, uint8_t cmprAlg, void *pBuf,
|
||||||
int32_t nBuf);
|
int32_t nBuf);
|
||||||
int32_t tsDecompressTimestamp(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int32_t nOut, uint8_t cmprAlg,
|
int32_t tsDecompressTimestamp(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int32_t nOut, uint8_t cmprAlg,
|
||||||
|
@ -120,6 +123,17 @@ int32_t tsCompressBigint(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int32
|
||||||
int32_t tsDecompressBigint(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int32_t nOut, uint8_t cmprAlg, void *pBuf,
|
int32_t tsDecompressBigint(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int32_t nOut, uint8_t cmprAlg, void *pBuf,
|
||||||
int32_t nBuf);
|
int32_t nBuf);
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* STREAM COMPRESSION
|
||||||
|
*************************************************************************/
|
||||||
|
typedef struct SCompressor SCompressor;
|
||||||
|
|
||||||
|
int32_t tCompressorCreate(SCompressor **ppCmprsor);
|
||||||
|
int32_t tCompressorDestroy(SCompressor *pCmprsor);
|
||||||
|
int32_t tCompressorReset(SCompressor *pCmprsor, int8_t type, int8_t cmprAlg, int8_t autoAlloc);
|
||||||
|
int32_t tCompGen(SCompressor *pCmprsor, const uint8_t **ppData, int64_t *nData);
|
||||||
|
int32_t tCompress(SCompressor *pCmprsor, const void *pData, int64_t nData);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -285,8 +285,8 @@ int32_t tsdbDelFReaderClose(SDelFReader **ppReader);
|
||||||
int32_t tsdbReadDelData(SDelFReader *pReader, SDelIdx *pDelIdx, SArray *aDelData);
|
int32_t tsdbReadDelData(SDelFReader *pReader, SDelIdx *pDelIdx, SArray *aDelData);
|
||||||
int32_t tsdbReadDelIdx(SDelFReader *pReader, SArray *aDelIdx);
|
int32_t tsdbReadDelIdx(SDelFReader *pReader, SArray *aDelIdx);
|
||||||
// tsdbRead.c ==============================================================================================
|
// tsdbRead.c ==============================================================================================
|
||||||
int32_t tsdbTakeReadSnap(STsdb *pTsdb, STsdbReadSnap **ppSnap, const char* id);
|
int32_t tsdbTakeReadSnap(STsdb *pTsdb, STsdbReadSnap **ppSnap, const char *id);
|
||||||
void tsdbUntakeReadSnap(STsdb *pTsdb, STsdbReadSnap *pSnap, const char* id);
|
void tsdbUntakeReadSnap(STsdb *pTsdb, STsdbReadSnap *pSnap, const char *id);
|
||||||
// tsdbMerge.c ==============================================================================================
|
// tsdbMerge.c ==============================================================================================
|
||||||
int32_t tsdbMerge(STsdb *pTsdb);
|
int32_t tsdbMerge(STsdb *pTsdb);
|
||||||
|
|
||||||
|
|
|
@ -15,70 +15,15 @@
|
||||||
|
|
||||||
#include "tsdb.h"
|
#include "tsdb.h"
|
||||||
|
|
||||||
typedef struct SDiskColBuilder SDiskColBuilder;
|
typedef struct SDiskData SDiskData;
|
||||||
struct SDiskColBuilder {
|
|
||||||
uint8_t flags;
|
|
||||||
uint8_t *pBitMap;
|
|
||||||
int32_t *aOffset;
|
|
||||||
int32_t nData;
|
|
||||||
uint8_t *pData;
|
|
||||||
};
|
|
||||||
|
|
||||||
int32_t tDiskColAddVal(SDiskColBuilder *pBuilder, SColVal *pColVal) {
|
struct SDiskData {
|
||||||
int32_t code = 0;
|
|
||||||
// TODO
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================================================================
|
|
||||||
typedef struct SDiskDataBuilder SDiskDataBuilder;
|
|
||||||
struct SDiskDataBuilder {
|
|
||||||
SDiskDataHdr hdr;
|
SDiskDataHdr hdr;
|
||||||
SArray *aBlockCol; // SArray<SBlockCol>
|
/* data */
|
||||||
};
|
};
|
||||||
|
|
||||||
int32_t tDiskDataBuilderCreate(SDiskDataBuilder **ppBuilder) {
|
int32_t tDiskDataAddRow(SDiskData *pDiskData, TSDBROW *pRow) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
// TODO
|
// TODO
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tDiskDataBuilderDestroy(SDiskDataBuilder *pBuilder) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void tDiskDataBuilderInit(SDiskDataBuilder *pBuilder, int64_t suid, int64_t uid, STSchema *pTSchema, int8_t cmprAlg) {
|
|
||||||
pBuilder->hdr = (SDiskDataHdr){.delimiter = TSDB_FILE_DLMT, //
|
|
||||||
.fmtVer = 0,
|
|
||||||
.suid = suid,
|
|
||||||
.uid = uid,
|
|
||||||
.cmprAlg = cmprAlg};
|
|
||||||
}
|
|
||||||
|
|
||||||
void tDiskDataBuilderReset(SDiskDataBuilder *pBuilder) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t tDiskDataBuilderAddRow(SDiskDataBuilder *pBuilder, TSDBROW *pRow, STSchema *pTSchema, int64_t uid) {
|
|
||||||
int32_t code = 0;
|
|
||||||
|
|
||||||
// uid (todo)
|
|
||||||
|
|
||||||
// version (todo)
|
|
||||||
|
|
||||||
// TSKEY (todo)
|
|
||||||
|
|
||||||
SRowIter iter = {0};
|
|
||||||
tRowIterInit(&iter, pRow, pTSchema);
|
|
||||||
|
|
||||||
for (int32_t iDiskCol = 0; iDiskCol < 0; iDiskCol++) {
|
|
||||||
}
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t tDiskDataBuilderGet(SDiskDataBuilder *pBuilder, uint8_t **ppData) {
|
|
||||||
int32_t code = 0;
|
|
||||||
// TODO
|
|
||||||
return code;
|
|
||||||
}
|
|
|
@ -1000,7 +1000,6 @@ int32_t tsDecompressDoubleLossyImp(const char *input, int32_t compressedSize, co
|
||||||
* STREAM COMPRESSION
|
* STREAM COMPRESSION
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
#define I64_SAFE_ADD(a, b) (((a) >= 0 && (b) <= INT64_MAX - (b)) || ((a) < 0 && (b) >= INT64_MIN - (a)))
|
#define I64_SAFE_ADD(a, b) (((a) >= 0 && (b) <= INT64_MAX - (b)) || ((a) < 0 && (b) >= INT64_MIN - (a)))
|
||||||
typedef struct SCompressor SCompressor;
|
|
||||||
|
|
||||||
static int32_t tCompBool(SCompressor *pCmprsor, const void *pData, int32_t nData);
|
static int32_t tCompBool(SCompressor *pCmprsor, const void *pData, int32_t nData);
|
||||||
static int32_t tCompInt(SCompressor *pCmprsor, const void *pData, int32_t nData);
|
static int32_t tCompInt(SCompressor *pCmprsor, const void *pData, int32_t nData);
|
||||||
|
|
Loading…
Reference in New Issue