-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Add method to drop bytes from head of a BigArray
#27221
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
|
I implemented a test for dropping bytes from a |
|
To me big arrays are a bit too complex already so I'm a bit on the fence about making them even more complex. I'm wondering whether we should build another abstraction on top of the page cache recycler instead of reusing big arrays here? |
I am ok with this, @tbrooks8 WDYT? |
I have a few thoughts.
I guess what I'm seeing is that I can create a different data structure. But I there is still some stuff in Or should I create an accessor for the |
I think my main concern is the introduction of a new way of consuming big arrays via the addition of
That would work for me.
I don't like exposing the internals of BigArrays, could we pass the PageCacheRecycler in addition to BigArrays to the transport? If yes, then it would work for me too.
That logic is simple enough that I wouldn't mind it to be duplicated. |
|
Thanks @jpountz. Your last comment gives me some approaches to work with. |
|
@tbrooks8 is this still on or can we close it? |
|
Closed. We are going to go with a different approach. |
This is related to #27051. Essentially, we want to use big arrays for
byte reusage when reading and writing to channels. Unfortunately, big
arrays are currently designed to expand forever. This does not fit with
reading from a channel where from time to time you will want to drop
bytes when a message is fully read.
This commit refactors big arrays to only have one array for both
pages and recyclers. This is a change from the current situation where
these are stored in two different arrays. This change simplifies the
array manipulation that is necessary when dropping bytes from the head.
Second, it adds a method
dropFromHeadthat will remove and releasepages up until the provided index. This change also requires the
introduction of potential "offsets" for big arrays.