RFC: Add limited read - #7945
Merged
Merged
Conversation
Xuanwo
marked this pull request as ready for review
July 27, 2026 05:25
dentiny
reviewed
Jul 27, 2026
akx
reviewed
Jul 27, 2026
akx
reviewed
Jul 27, 2026
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.
Which issue does this PR close?
Refs #7938.
Rationale for this change
A bounded read range is exact, so callers that only need up to a small number of bytes must stat the object first or handle a short object as an error. OpenDAL needs an at-most read for probes such as file header and format detection without an extra metadata request.
What changes are included in this PR?
This PR proposes
ReadOptions::limitandOperator::read_with(...).limit(n). The proposal keeps exact bounded range behavior, uses the existing rawopenandreadsplit, and carries only a privateexactboolean in core instead of adding a new raw operation or planning abstraction.Are there any user-facing changes?
Yes. The proposed API returns between zero and the configured limit on clean EOF. Existing reads that do not set
limitkeep their current behavior. This PR contains the RFC only; it does not implement the API.AI Usage Statement
This proposal was drafted with assistance from OpenAI Codex powered by GPT-5.