Expand description
RedDB Wire Protocol — binary TCP, zero JSON overhead.
Frame: [total_len: u32 LE][msg_type: u8][payload…]
Message types (client → server): 0x01 Query [sql_bytes…] 0x04 BulkInsert [coll_len:u16][coll_bytes][n:u32][json_len:u32 + json_bytes]…
Message types (server → client): 0x02 Result [ncols:u16][col_name_len:u16 + col_name]…[nrows:u32][row…] row = [val_type:u8 + val_data]… per column 0x03 Error [error_bytes…] 0x05 BulkOk [count:u64]
Constants§
- MSG_
BULK_ INSERT - MSG_
BULK_ INSERT_ BINARY - MSG_
BULK_ INSERT_ PREVALIDATED - Fast-path bulk insert: payload is
[coll_len u16][coll][ncols u16] ([col_name u16 len + bytes])*ncols [nrows u32] ([val_tag u8 + val_data]*ncols)*nrows, IDENTICAL toMSG_BULK_INSERT_BINARY. The only difference from 0x06 is semantic: the caller guarantees every value already matches the declared column type and that contract / uniqueness rules either don’t apply or were already checked client-side. The server skipsnormalize_row_fields_for_contract,enforce_row_uniquenessandenforce_row_batch_uniquenesson the whole batch, cutting 15-column typed inserts from O(nrows × ncols) contract work down to O(nrows) serialise-and-insert. Intended for typed-bench workloads and driver-generated inserts where types were already validated before the send. Old servers that don’t know 0x08 reply withMSG_ERROR "unknown message type"so clients can fall back to the safe path. - MSG_
BULK_ OK - MSG_
BULK_ STREAM_ ACK - Intermediate ack sent back for START + ROWS frames so the client can pipeline safely (it always receives a frame per frame sent) without conflating progress with the terminal MSG_BULK_OK at COMMIT time.
- MSG_
BULK_ STREAM_ COMMIT - MSG_
BULK_ STREAM_ ROWS - MSG_
BULK_ STREAM_ START - MSG_
CLOSE_ CURSOR - MSG_
CURSOR_ BATCH - MSG_
CURSOR_ OK - MSG_
DEALLOCATE - MSG_
DECLARE_ CURSOR - MSG_
ERROR - MSG_
EXECUTE_ PREPARED - MSG_
FETCH - MSG_
PREPARE - MSG_
PREPARED_ OK - MSG_
QUERY - MSG_
QUERY_ BINARY - MSG_
RESULT - VAL_
BOOL - VAL_F64
- VAL_I64
- VAL_
NULL - VAL_
TEXT - VAL_U64
Functions§
- decode_
value - Decode a Value from wire bytes at the given position.
- encode_
column_ name - Encode a column name to wire format.
- encode_
value - Encode a Value to wire format bytes, appending to buf.
- try_
decode_ value - write_
frame_ header - Write a frame header: [total_len: u32 LE][msg_type: u8]