more
This commit is contained in:
parent
1545dc5990
commit
f10c5430b3
|
@ -47,31 +47,32 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
union {
|
union {
|
||||||
/// union field for encode and decode
|
/// union field for encode and decode
|
||||||
uint64_t info;
|
uint32_t info;
|
||||||
struct {
|
struct {
|
||||||
/// is deleted row
|
|
||||||
uint64_t del : 1;
|
|
||||||
/// row type
|
/// row type
|
||||||
uint64_t type : 3;
|
uint32_t type : 2;
|
||||||
/// row schema version
|
/// row schema version
|
||||||
uint64_t sver : 16;
|
uint32_t sver : 16;
|
||||||
/// row total length
|
/// is delete row
|
||||||
uint64_t len : 32;
|
uint32_t del : 1;
|
||||||
/// reserved for back compatibility
|
/// reserved for back compatibility
|
||||||
uint64_t reserve : 12;
|
uint32_t reserve : 13;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
/// row total length
|
||||||
|
uint32_t len;
|
||||||
/// row version
|
/// row version
|
||||||
uint64_t ver;
|
uint64_t ver;
|
||||||
/// timestamp
|
/// timestamp
|
||||||
TSKEY ts;
|
TSKEY ts;
|
||||||
char content[];
|
/// the inline data, maybe a tuple or a k-v tuple
|
||||||
} SRow;
|
char data[];
|
||||||
|
} STSRow;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t nRows;
|
uint32_t nRows;
|
||||||
char rows[];
|
char rows[];
|
||||||
} SRowBatch;
|
} STSRowBatch;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
/// ordinary row builder
|
/// ordinary row builder
|
||||||
|
@ -88,36 +89,36 @@ typedef struct {
|
||||||
/// buffer writer
|
/// buffer writer
|
||||||
SBufferWriter bw;
|
SBufferWriter bw;
|
||||||
/// target row
|
/// target row
|
||||||
SRow *pRow;
|
STSRow *pRow;
|
||||||
} SRowBuilder;
|
} STSRowBuilder;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
STSchema *pSchema;
|
STSchema *pSchema;
|
||||||
SRow * pRow;
|
STSRow * pRow;
|
||||||
} SRowReader;
|
} STSRowReader;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t it;
|
uint32_t it;
|
||||||
SRowBatch *pRowBatch;
|
STSRowBatch *pRowBatch;
|
||||||
} SRowBatchIter;
|
} STSRowBatchIter;
|
||||||
|
|
||||||
// SRowBuilder
|
// STSRowBuilder
|
||||||
#define trbInit(rt, allocator, endian, target, size) \
|
#define trbInit(rt, allocator, endian, target, size) \
|
||||||
{ .type = (rt), .bw = tbufInitWriter(allocator, endian), .pRow = (target) }
|
{ .type = (rt), .bw = tbufInitWriter(allocator, endian), .pRow = (target) }
|
||||||
void trbSetRowInfo(SRowBuilder *pRB, bool del, uint16_t sver);
|
void trbSetRowInfo(STSRowBuilder *pRB, bool del, uint16_t sver);
|
||||||
void trbSetRowVersion(SRowBuilder *pRB, uint64_t ver);
|
void trbSetRowVersion(STSRowBuilder *pRB, uint64_t ver);
|
||||||
void trbSetRowTS(SRowBuilder *pRB, TSKEY ts);
|
void trbSetRowTS(STSRowBuilder *pRB, TSKEY ts);
|
||||||
int trbWriteCol(SRowBuilder *pRB, void *pData, col_id_t cid);
|
int trbWriteCol(STSRowBuilder *pRB, void *pData, col_id_t cid);
|
||||||
|
|
||||||
// SRowReader
|
// STSRowReader
|
||||||
#define tRowReaderInit(schema, row) \
|
#define tRowReaderInit(schema, row) \
|
||||||
{ .schema = (schema), .row = (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) \
|
#define tRowBatchIterInit(pRB) \
|
||||||
{ .it = 0, .pRowBatch = (pRB) }
|
{ .it = 0, .pRowBatch = (pRB) }
|
||||||
const SRow *tRowBatchIterNext(SRowBatchIter *pRowBatchIter);
|
const STSRow *tRowBatchIterNext(STSRowBatchIter *pRowBatchIter);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,6 +149,10 @@ typedef struct {
|
||||||
tb_uid_t uid;
|
tb_uid_t uid;
|
||||||
} SVDropTableReq;
|
} SVDropTableReq;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
// TODO
|
||||||
|
} SVSubmitReq;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint64_t ver;
|
uint64_t ver;
|
||||||
union {
|
union {
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
#include "trow.h"
|
#include "trow.h"
|
||||||
|
|
||||||
|
#if 0
|
||||||
void trbSetRowInfo(SRowBuilder *pRB, bool del, uint16_t sver) {
|
void trbSetRowInfo(SRowBuilder *pRB, bool del, uint16_t sver) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
@ -30,4 +31,5 @@ void trbSetRowTS(SRowBuilder *pRB, TSKEY ts) {
|
||||||
int trbWriteCol(SRowBuilder *pRB, void *pData, col_id_t cid) {
|
int trbWriteCol(SRowBuilder *pRB, void *pData, col_id_t cid) {
|
||||||
// TODO
|
// TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
|
@ -3,6 +3,7 @@
|
||||||
#include "trow.h"
|
#include "trow.h"
|
||||||
|
|
||||||
TEST(td_row_test, build_row_to_target) {
|
TEST(td_row_test, build_row_to_target) {
|
||||||
|
#if 0
|
||||||
char dst[1024];
|
char dst[1024];
|
||||||
SRow* pRow = (SRow*)dst;
|
SRow* pRow = (SRow*)dst;
|
||||||
int ncols = 10;
|
int ncols = 10;
|
||||||
|
@ -18,4 +19,5 @@ TEST(td_row_test, build_row_to_target) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
Loading…
Reference in New Issue