You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "TennyZhuang (via GitHub)" <gi...@apache.org> on 2025/10/15 12:56:16 UTC
[PR] feat(buffer): add chunk iterator for Buffer [opendal]
TennyZhuang opened a new pull request, #6672:
URL: https://github.com/apache/opendal/pull/6672
# Which issue does this PR close?
Closes #6520.
# Rationale for this change
Splitting `Buffer` values into fixed-size chunks currently requires copying into `Vec<u8>` or `Bytes`. Adding a chunk iterator exposes an ergonomic, zero-copy approach to splitting contiguous and non-contiguous buffers, matching the use cases raised in #6520.
# What changes are included in this PR?
- Introduce `BufferChunks` plus a `Buffer::chunks` helper that yield sub-buffers sharing the underlying storage.
- Implement iterator traits (`ExactSizeIterator`, `FusedIterator`) with accurate size hints for predictable iteration.
- Add unit tests covering contiguous, non-contiguous, and zero-size chunk scenarios.
# Are there any user-facing changes?
New optional API `Buffer::chunks`; existing behavior is unchanged.
--
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(buffer): add chunk iterator for Buffer [opendal]
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo merged PR #6672:
URL: https://github.com/apache/opendal/pull/6672
--
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(buffer): add chunk iterator for Buffer [opendal]
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #6672:
URL: https://github.com/apache/opendal/pull/6672#discussion_r2432481296
##########
core/src/types/buffer.rs:
##########
@@ -153,6 +154,43 @@ impl Debug for Buffer {
}
}
+/// Iterator that yields [`Buffer`] chunks of at most a configured length.
Review Comment:
Please put those code at the end of file (but before `#[tests]`).
--
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