lhotari commented on PR #4196: URL: https://github.com/apache/bookkeeper/pull/4196#issuecomment-1920714720
> How about this implementation? @BewareMyPower The readerIndex state that is lost is in the wrappers. In many cases, there could be multiple layers of wrappers and the main issue is that there's no way to determine whether it's ok or not to call "unwrap". In a lot of cases, it's not ok to call "unwrap". It's possible to use the test case in this PR and do attempts in the context of the test case to see what really happens with different approaches. The test case doesn't have all of the possible problem cases. I think that I'll add a scenario for "slice" too. I'm fairly confident that the approach in the PR is one of rare safe ways to do ["internal iteration" for ByteBuf as the Netty maintainers call it](https://github.com/netty/netty/pull/13820#issuecomment-1919790889). I got some high level feedback from Netty maintainers about the approach: https://github.com/netty/netty/pull/13820 . This is a gap in Netty 4. [In Netty 5, there's a nice API to traverse all components](https://github.com/netty/netty/blob/main/buffer/src/main/java/io/netty5/buffer/Buffer.java#L1086-L1127). -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
