Encode a chunk message for streaming responses. Args: request_id: Request identifier this chunk belongs to data: Chunk data (must be TLV-serializable) Returns: bytes: Complete message (header + payload)
(request_id: int, data)
| 254 | |
| 255 | @staticmethod |
| 256 | def encode_chunk(request_id: int, data) -> bytes: |
| 257 | """ |
| 258 | Encode a chunk message for streaming responses. |
| 259 | |
| 260 | Args: |
| 261 | request_id: Request identifier this chunk belongs to |
| 262 | data: Chunk data (must be TLV-serializable) |
| 263 | |
| 264 | Returns: |
| 265 | bytes: Complete message (header + payload) |
| 266 | """ |
| 267 | payload_dict = {"data": data} |
| 268 | payload = TLVEncoder.encode(payload_dict) |
| 269 | header = BinaryProtocol.encode_header(MSG_TYPE_CHUNK, request_id, |
| 270 | len(payload)) |
| 271 | return header + payload |
| 272 | |
| 273 | @staticmethod |
| 274 | def encode_end(request_id: int) -> bytes: |