TCP B1: Add TCP client and server packet type enums, plus reading/writing them. - #421
TCP B1: Add TCP client and server packet type enums, plus reading/writing them.#421alex-clickhouse wants to merge 1 commit into
Conversation
TriageCategory: Summary What this impacts
Concerns
Required reviewer action
|
4b2a8d1 to
af1a936
Compare
There was a problem hiding this comment.
Pull request overview
Adds first-class representations of ClickHouse TCP native-protocol packet type codes and convenience read/write helpers, with unit tests validating the VarUInt envelope behavior.
Changes:
- Introduces
ClientPacketTypeandServerPacketTypeenums for packet envelope type codes. - Adds
WriteClientPacketTypeandReadServerPacketTypeAsynchelpers over existing VarUInt primitives. - Extends protocol reader/writer tests to cover round-trips, overlap semantics, and unknown multi-byte codes.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| ClickHouse.Driver.Tcp/Protocol/ServerPacketType.cs | Adds server→client packet type enum and docs (needs doc fixes + backing type adjustment). |
| ClickHouse.Driver.Tcp/Protocol/ClientPacketType.cs | Adds client→server packet type enum and docs (needs doc fixes + backing type adjustment). |
| ClickHouse.Driver.Tcp/Protocol/ClickHouseBinaryWriter.cs | Adds WriteClientPacketType helper that writes the VarUInt type code. |
| ClickHouse.Driver.Tcp/Protocol/ClickHouseBinaryReader.cs | Adds ReadServerPacketTypeAsync helper that reads the VarUInt type code. |
| ClickHouse.Driver.Tcp.Tests/Protocol/ClickHouseBinaryReaderWriterTests.cs | Adds tests for packet type encoding/decoding and envelope composition. |
af1a936 to
00d60cb
Compare
| /// Packet type codes the server sends to the client, encoded as the leading VarUInt of each packet. | ||
| /// Codes overlap numerically with <see cref="ClientPacketType"/> but carry different meanings per direction | ||
| /// (e.g. code 2 is server <see cref="Exception"/> but client <see cref="ClientPacketType.Data"/>). |
| /// Packet type codes the client sends to the server, encoded as the leading VarUInt of each packet. | ||
| /// Codes overlap numerically with <see cref="ServerPacketType"/> but carry different meanings per direction | ||
| /// (e.g. code 2 is client <see cref="Data"/> but server <see cref="ServerPacketType.Exception"/>). |
| } | ||
|
|
||
| [Test] | ||
| public async Task PacketTypeCodes_OverlapAcrossDirections_CarryDifferentMeaning() |
00d60cb to
09281f5
Compare
kavirajk
left a comment
There was a problem hiding this comment.
LGTM 👍 looks like all the message types are covered as specs on both clients and server :)
09281f5 to
02bf5c5
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
02bf5c5 to
6ba85af
Compare
6ba85af to
04c8175
Compare
No description provided.