提交 f10c5430 编写于 作者: H Hongze Cheng

more

上级 1545dc59
......@@ -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
}
......
......@@ -149,6 +149,10 @@ typedef struct {
tb_uid_t uid;
} SVDropTableReq;
typedef struct {
// TODO
} SVSubmitReq;
typedef struct {
uint64_t ver;
union {
......
......@@ -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
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册