07.RedisProtocal解析
2025.02.11 需求
Redis serialization protocol specification | Docs
| RESP data type | Minimal protocol version | Category | First byte | Buffer解析 |
|---|---|---|---|---|
| Simple strings | RESP2 | Simple | + | 🟢 |
| Simple Errors | RESP2 | Simple | - | 🟢 |
| Integers | RESP2 | Simple | : | 🟢 |
| Bulk strings | RESP2 | Aggregate | $ | 🟢 |
| Arrays | RESP2 | Aggregate | * | 🟢 |
| Nulls | RESP3 | Simple | _ | 🟢 |
| Booleans | RESP3 | Simple | # | 🟢 |
| Doubles | RESP3 | Simple | , | 🟢 |
| Big numbers | RESP3 | Simple | ( | 🟢 |
| Bulk errors | RESP3 | Aggregate | ! | 🟢 |
| Verbatim strings | RESP3 | Aggregate | = | 🟢 |
| Maps | RESP3 | Aggregate | % | 🟢 |
| Attributes | RESP3 | Aggregate | | | 🟢 |
| Sets | RESP3 | Aggregate | ~ | 🟢 |
| Pushes | RESP3 | Aggregate | > | 🟢 |
2025.02.13 优化需求
-
RESPBufferParser, 略过字节,不用真的去读取 - 指定一个
ByteBuf, 重复进行解析 -
ReadableBuffer.append, 不是按照mark来丢弃, 而是start