You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR introduces an TwoHalves buffer, that uses Vec<u8> instead of Bytes as it's underlying storage.
TwoHalves splits the underlying storage into two parts (mutable and non-mutable one). The non-mutable part uses thread-safe reference counting for cheap sharing (Bytes like), where the mutable one is copied over on each clone.
In the initial state both the mutable and non-mutable parts point to the same allocation using exactly the same control block, the diverge happens on first clone when the mutable part gets copied over and re-allocated entirely.
❌ Patch coverage is 92.55952% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.86%. Comparing base (f0e8578) to head (69220df). ⚠️ Report is 3 commits behind head on master.
What about using AlignedVec as underlying buffer? this way we should be able to seamlessly switch to direct-io later on. See #2921
I am in the process of looking at #2921, the next logical step is to introduce alignment both for the inner allocation, aswell as for the split_at boundry.
I've decided against using the proposed new design, as it would make using AlignedVec extremely inefficient, requiring large amount of padding between ControlBlock and the data pointer.
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
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.
This PR introduces an
TwoHalvesbuffer, that usesVec<u8>instead ofBytesas it's underlying storage.TwoHalves splits the underlying storage into two parts (mutable and non-mutable one). The non-mutable part uses thread-safe reference counting for cheap sharing (Bytes like), where the mutable one is copied over on each clone.
In the initial state both the mutable and non-mutable parts point to the same allocation using exactly the same control block, the diverge happens on first
clonewhen the mutable part gets copied over and re-allocated entirely.