-
Notifications
You must be signed in to change notification settings - Fork 15
feat(bytesbuf): Improve how memory block metadata is exposed in API #248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #248 +/- ##
=======================================
Coverage 100.0% 100.0%
=======================================
Files 139 139
Lines 8440 8441 +1
=======================================
+ Hits 8440 8441 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This reverts commit 912337d.
|
Mission
Send + Syncbounds to memory block metadata to ensure that they do not cause futures to become!Sendif references are stored (in practice, all foreseeable metadata types we expect to implement are going to be thread-safe immutable data).This fills a gap in functionality (hard to access metadata for vectored writes into a BytesBuf), makes the API more flexible by preferring iterators and improves compatibility with metadata processing in futures.
BytesView API changes
The current situation is:
Change BytesView as follows:
Expected usage (pseudocode):
If the user wants to still copy the slices into an array, they can just fill the array in this loop.
We will not provide any replacement for .io_slices(). This was anyway a legacy function of dubious value. It remains available through
bytes::Bufwhen thebytes-compatfeature is enabled.BytesBuf API changes
The current situation is:
Change BytesBuf as follows:
Because BytesBuf only directly provides access to the first unfilled slice (intentionally), we do not need a mechanism to iterate through the metadatas (or slices) on BytesBuf itself.
However, it also provides concurrent access to multiple slices through the vectored write mechanism in BytesBufVectoredWrite.
Change BytesBufVectoredWrite as follows:
iter_slices_mut()to justslices_mut()to simplify the name (as long as we are already making breaking changes).