diff --git a/include/common/trow.h b/include/common/trow.h index cff0f08302838bc4aaea09bf049bde0ad02a7f55..4092500d5f41294970c231f1c5eb3400a69a6a18 100644 --- a/include/common/trow.h +++ b/include/common/trow.h @@ -47,31 +47,32 @@ typedef struct { typedef struct { union { /// union field for encode and decode - uint64_t info; + uint32_t info; struct { - /// is deleted row - uint64_t del : 1; /// row type - uint64_t type : 3; + uint32_t type : 2; /// row schema version - uint64_t sver : 16; - /// row total length - uint64_t len : 32; + uint32_t sver : 16; + /// is delete row + uint32_t del : 1; /// reserved for back compatibility - uint64_t reserve : 12; + uint32_t reserve : 13; }; }; + /// row total length + uint32_t len; /// row version uint64_t ver; /// timestamp TSKEY ts; - char content[]; -} SRow; + /// the inline data, maybe a tuple or a k-v tuple + char data[]; +} STSRow; typedef struct { uint32_t nRows; char rows[]; -} SRowBatch; +} STSRowBatch; typedef enum { /// ordinary row builder @@ -88,36 +89,36 @@ typedef struct { /// buffer writer SBufferWriter bw; /// target row - SRow *pRow; -} SRowBuilder; + STSRow *pRow; +} STSRowBuilder; typedef struct { STSchema *pSchema; - SRow * pRow; -} SRowReader; + STSRow * pRow; +} STSRowReader; typedef struct { uint32_t it; - SRowBatch *pRowBatch; -} SRowBatchIter; + STSRowBatch *pRowBatch; +} STSRowBatchIter; -// SRowBuilder +// STSRowBuilder #define trbInit(rt, allocator, endian, target, size) \ { .type = (rt), .bw = tbufInitWriter(allocator, endian), .pRow = (target) } -void trbSetRowInfo(SRowBuilder *pRB, bool del, uint16_t sver); -void trbSetRowVersion(SRowBuilder *pRB, uint64_t ver); -void trbSetRowTS(SRowBuilder *pRB, TSKEY ts); -int trbWriteCol(SRowBuilder *pRB, void *pData, col_id_t cid); +void trbSetRowInfo(STSRowBuilder *pRB, bool del, uint16_t sver); +void trbSetRowVersion(STSRowBuilder *pRB, uint64_t ver); +void trbSetRowTS(STSRowBuilder *pRB, TSKEY ts); +int trbWriteCol(STSRowBuilder *pRB, void *pData, col_id_t cid); -// SRowReader +// STSRowReader #define tRowReaderInit(schema, row) \ { .schema = (schema), .row = (row) } -int tRowReaderRead(SRowReader *pRowReader, col_id_t cid, void *target, uint64_t size); +int tRowReaderRead(STSRowReader *pRowReader, col_id_t cid, void *target, uint64_t size); -// SRowBatchIter +// STSRowBatchIter #define tRowBatchIterInit(pRB) \ { .it = 0, .pRowBatch = (pRB) } -const SRow *tRowBatchIterNext(SRowBatchIter *pRowBatchIter); +const STSRow *tRowBatchIterNext(STSRowBatchIter *pRowBatchIter); #ifdef __cplusplus } diff --git a/include/dnode/vnode/vnode.h b/include/dnode/vnode/vnode.h index fcb77a4967290b318ffbd7b3e75e9566b6d80d2f..30531ad738bbabf82b3a672f6415da9793620497 100644 --- a/include/dnode/vnode/vnode.h +++ b/include/dnode/vnode/vnode.h @@ -149,6 +149,10 @@ typedef struct { tb_uid_t uid; } SVDropTableReq; +typedef struct { + // TODO +} SVSubmitReq; + typedef struct { uint64_t ver; union { diff --git a/source/common/src/trow.c b/source/common/src/trow.c index 2e36e6a757fd3d64517545ff6b20164a817ac58e..f383cd04dc06879806e4191685299043c3dfed15 100644 --- a/source/common/src/trow.c +++ b/source/common/src/trow.c @@ -15,6 +15,7 @@ #include "trow.h" +#if 0 void trbSetRowInfo(SRowBuilder *pRB, bool del, uint16_t sver) { // TODO } @@ -30,4 +31,5 @@ void trbSetRowTS(SRowBuilder *pRB, TSKEY ts) { int trbWriteCol(SRowBuilder *pRB, void *pData, col_id_t cid) { // TODO return 0; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/source/common/test/trowTest.cpp b/source/common/test/trowTest.cpp index 8c628464e3ad3ea5ac248f8f1fb08cd83956634a..d7f0783d4a04076d710edf8a9e16a8f7706ddf4d 100644 --- a/source/common/test/trowTest.cpp +++ b/source/common/test/trowTest.cpp @@ -3,6 +3,7 @@ #include "trow.h" TEST(td_row_test, build_row_to_target) { +#if 0 char dst[1024]; SRow* pRow = (SRow*)dst; int ncols = 10; @@ -18,4 +19,5 @@ TEST(td_row_test, build_row_to_target) { // TODO } } +#endif } \ No newline at end of file