Skip to content

Implement native protocol parsing#273

Draft
antonagestam wants to merge 4 commits intoAiven-Open:mainfrom
antonagestam:feature/rust-backed-serialization
Draft

Implement native protocol parsing#273
antonagestam wants to merge 4 commits intoAiven-Open:mainfrom
antonagestam:feature/rust-backed-serialization

Conversation

@antonagestam
Copy link
Copy Markdown
Contributor

@antonagestam antonagestam commented Feb 28, 2026

This implements the first step for #214: native protocol parsing with readers implemented in Rust.

Needs polishing

@antonagestam antonagestam force-pushed the feature/rust-backed-serialization branch 2 times, most recently from 616a1e7 to 555a381 Compare February 28, 2026 23:47
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 28, 2026

Codecov Report

❌ Patch coverage is 97.01493% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.25%. Comparing base (cc55b29) to head (2fbf1ef).

Files with missing lines Patch % Lines
src/kio/records/readers.py 93.93% 2 Missing and 2 partials ⚠️
src/kio/serial/writers.py 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##              main     #273      +/-   ##
===========================================
- Coverage   100.00%   99.25%   -0.75%     
===========================================
  Files           18       18              
  Lines         1129     1077      -52     
  Branches       135      107      -28     
===========================================
- Hits          1129     1069      -60     
- Misses           0        5       +5     
- Partials         0        3       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@antonagestam antonagestam force-pushed the feature/rust-backed-serialization branch 7 times, most recently from 0cc80c9 to 5463869 Compare March 1, 2026 11:47
aiven-anton and others added 2 commits March 1, 2026 13:25
This is in preparation to replacing Python implementation of protocol
parsing with a Rust implementation. To allow zero copy of bytes when
passing do from Python to Rust, we need to pass it as read-only objects.
By adhering to the Buffer protocol, we're also making sure to maximize
compatibility with various network layer implementations.

This is a breaking change, users of any reader functions must update
their code accordingly and now pass a Buffer + start offset instead of a
`io.IO[bytes]` object. Readers return the number of bytes they consume
off of the input.
@antonagestam antonagestam force-pushed the feature/rust-backed-serialization branch 12 times, most recently from e2a247d to 6d167c5 Compare March 1, 2026 18:46
@antonagestam antonagestam force-pushed the feature/rust-backed-serialization branch from 6d167c5 to 2fbf1ef Compare March 1, 2026 18:52
```
⦿  python benchmarks/parsing.py
.....................
roundtrip: Mean +- std dev: 715 ns +- 8 ns
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants