You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "leiysky (via GitHub)" <gi...@apache.org> on 2026/05/17 19:19:39 UTC

[PR] feat(core): Add content length hints for read and copy [opendal]

leiysky opened a new pull request, #7543:
URL: https://github.com/apache/opendal/pull/7543

   # Which issue does this PR close?
   
   Closes #7540.
   
   # Rationale for this change
   
   OpenDAL can need object content length while planning operations such as open-ended range reads and server-side copy. Callers may already know that metadata from `stat`, `list`, or their own catalog, but there was no generic way to pass it into the operation as an optimization hint.
   
   # What changes are included in this PR?
   
   This PR adds content length hints to read and copy options:
   
   - Add `content_length_hint` to `ReadOptions` and `ReaderOptions`.
   - Add `source_content_length_hint` to `CopyOptions`.
   - Thread read hints into `OpReader` and copy hints into `OpCopier`.
   - Use the read hint when resolving open-ended ranges before falling back to `stat`.
   - Add a unit test that verifies open-ended range planning uses the hint without requiring object metadata lookup.
   
   # Are there any user-facing changes?
   
   Yes. Users can now pass known object content length as an execution hint through `read_with`, `reader_with`, `copy_with`, `copier_with`, or the corresponding options structs. The hint is not an object identity or consistency condition.
   
   # AI Usage Statement
   
   This PR was developed with OpenAI Codex (GPT-5), with manual review and local validation.
   
   # Validation
   
   - `cargo fmt --check`
   - `cargo test -p opendal-core test_parse_into_range_uses_content_length_hint`
   - `cargo check`
   - `cargo clippy -p opendal-core --all-targets -- -D warnings`
   - `cargo test --features tests behavior`
   
   `cargo clippy --all-targets --all-features -- -D warnings` was also attempted locally, but the environment lacks Java and `hdfs-sys` failed its build script with `Java is not installed or not in the system PATH`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(core): Add content length hints for read and copy [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on PR #7543:
URL: https://github.com/apache/opendal/pull/7543#issuecomment-4473658894

   This change looks good to me. The only thing that need to address is the CI.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(core): Add content length hints for read and copy [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo merged PR #7543:
URL: https://github.com/apache/opendal/pull/7543


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org