Add blocking sync row driver reusing the async parse body (L3) - #202
Draft
Saurabh Singh (saurabh500) wants to merge 1 commit into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e2c378f8-3ba1-4b48-9ebe-5a4ea2bd2761
Saurabh Singh (saurabh500)
force-pushed
the
dev/saurabh/sans-io-expose-l3-blocking-driver
branch
from
August 9, 2026 22:02
b17263c to
7e11a11
Compare
Saurabh Singh (saurabh500)
marked this pull request as ready for review
August 10, 2026 06:38
Copilot started reviewing on behalf of
Saurabh Singh (saurabh500)
August 10, 2026 06:39
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an internal blocking row-decoding path that reuses the existing synchronous parsing core.
Changes:
- Adds blocking packet assembly and buffered reading.
- Adds blocking row, token, and PLP drivers.
- Adds async/blocking parity and residency tests.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
mssql-tds/src/io/token_stream.rs |
Adds blocking decoding logic and differential tests. |
mssql-tds/src/io/byte_source.rs |
Adds the blocking byte-source seam and packet assembler. |
mssql-tds/src/io/blocking_reader.rs |
Implements the blocking packet reader. |
mssql-tds/src/io.rs |
Registers the new internal module. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+945
to
+953
| let total = match sync_token::body_len(reader.row_buffer_mut(), &token_type) { | ||
| Ok(total) => total, | ||
| Err(_) => { | ||
| reader.refill_row_buffer_blocking()?; | ||
| continue; | ||
| } | ||
| }; | ||
| if reader.row_buffer_mut().ensure(total).is_err() { | ||
| reader.refill_row_buffer_blocking()?; |
Comment on lines
+993
to
+998
| match collect_plp_bytes_blocking(reader)? { | ||
| Some(bytes) => writer.write_bytes(col, bytes), | ||
| None => writer.write_null(col), | ||
| } | ||
|
|
||
| if writer.pause_after_column(col) && col + 1 < len { |
Saurabh Singh (saurabh500)
marked this pull request as draft
August 10, 2026 06:49
Saurabh Singh (saurabh500)
marked this pull request as ready for review
August 10, 2026 07:39
Saurabh Singh (saurabh500)
marked this pull request as draft
August 10, 2026 13:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Layer 3 (internal): blocking sync row driver + sync PLP collect
Part of the bottom-up sans-I/O stack. Based on L2 (
dev/saurabh/sans-io-expose-l2-timeout-cancel, #201), notmain.Introduces, under the existing async client, a blocking synchronous row driver and a sync PLP collect that reuse the ONE parse body (
TdsCore::step_row) and the ONE PLP leaf (plp_collect_step) verbatim. Only the refill wrapper differs (blocking vs.await). No new parse machine. No public API change (noTdsSyncClientyet — that is Layer 4). All new items arepub(crate).What is added
BlockingByteSourcetrait +assemble_tds_packet_blocking(byte_source.rs) — the packet framing body minus the await.BlockingRowReadertrait,ensure_blocking,collect_plp_bytes_blocking,resolve_header_token_blocking,decode_blocking_async_column, anddrive_row_over_buffer_blocking(token_stream.rs) — the async row driver loop minus awaits, calling the identicalstep_row.BlockingPacketReadershell (blocking_reader.rs) — buffer-owning reader whose refill blocks on aBlockingByteSource.Tests (named)
blocking_driver_matches_async_oracle_across_refill_boundary— mixed int4 + varchar + multi-chunk varbinary(max) PLP; refill boundary swept across every offset; byte-identical vs async oracle.blocking_driver_nbcrow_matches_async_oracle_across_refill_boundary— NBCROW, two-byte bitmap split swept.blocking_driver_truncation_errors_identically_to_async_oracle— truncation/underflow parity (identical error).blocking_driver_multichunk_plp_residency_ceiling— >16384 B varbinary(max) LOB; byte-identical and boundedpeak_length()residency (<= 2x max_packet,< payload.len()).Gates
tds_client.rs+cursor_ops.rsvs L2 tip: empty. No new non-pub(crate)pub.cargo bfmt/cargo bclippy/scripts\bfmt.ps1/scripts\bclippy.ps1clean.Draft; do not merge.