-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
create scuffle-bytes-util #241
Conversation
Build broken due to rust-lang/rust#135235 |
/// Extracts the remaining bytes from the cursor returning. | ||
/// | ||
/// This does not do a copy of the bytes, and is O(1) time. | ||
/// | ||
/// This is the same as `BytesCursor::extract_bytes(self.remaining())`. | ||
fn extract_remaining(&mut self) -> Bytes; | ||
|
||
/// Extracts a bytes from the cursor. | ||
/// | ||
/// This does not do a copy of the bytes, and is O(1) time. | ||
/// Returns an error if the size is greater than the remaining bytes. | ||
fn extract_bytes(&mut self, size: usize) -> io::Result<Bytes>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Open to naming suggestions for these methods too. I dont really like them at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not read_bytes
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should change the shields.io links in the readme
which one? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvm I missed the change
99b1c08
to
f91b832
Compare
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #241 +/- ##
==========================================
- Coverage 50.43% 50.24% -0.20%
==========================================
Files 198 196 -2
Lines 16269 16202 -67
==========================================
- Hits 8206 8141 -65
+ Misses 8063 8061 -2
|
?brawl merge |
📌 Commit b1a9a32 has been approved and added to the merge queue. Requested by: @lennartkloock Approved by: @lennartkloock |
create scuffle-bytes-util Rename `bytesio` to `scuffle-bytes-util`. We also remove the wrapper types we had and optimize the `Cursor<Bytes>` usage. A lot of what we did with the wrapper types was essentially what `BytesMut` does and what `Vec<u8>` does, which is why most of the usage has been replaced with that. These changes allow for the code to have fewer copies in the rtmp implementation (I will look to further clean up the tests and code there in a future PR). The old rtmp flow was such: - copy bytes from wire into a temporary buffer - copy that buffer into the chunk decoder (or handshake buffer) buffer - parse chunks/handshake - create a temporary buffer to write back result - copy result from tmp buffer onto wire. The new flow looks like: - copy bytes from wire into a buffer - parse chunks/handshake - write result into a buffer - copy result onto the wire The newer example reuses existing buffers; so each connection will store additional memory (roughly 10kb/connection). As apposed to creating a buffer each time we want to read or write we just reuse an existing one. We also remove the additional copy to the handshake or chunk decode buffers by having them all share the same buffer (the read buffer). CLOUD-23 Requested-by: lennartkloock <[email protected]> Reviewed-by: lennartkloock <[email protected]>
🚨 PR has changed while a merge was in progress, cancelling the merge job. |
?brawl retry |
📌 Commit b1a9a32 has been approved and added to the merge queue. Requested by: @TroyKomodo Approved by: @lennartkloock |
🎉 Build successful! Approved by: @lennartkloock |
Rename
bytesio
toscuffle-bytes-util
. We also remove the wrapper types we had and optimize theCursor<Bytes>
usage. A lot of what we did with the wrapper types was essentially whatBytesMut
does and whatVec<u8>
does, which is why most of the usage has been replaced with that.These changes allow for the code to have fewer copies in the rtmp implementation (I will look to further clean up the tests and code there in a future PR).
The old rtmp flow was such:
The new flow looks like:
The newer example reuses existing buffers; so each connection will store additional memory (roughly 10kb/connection). As apposed to creating a buffer each time we want to read or write we just reuse an existing one.
We also remove the additional copy to the handshake or chunk decode buffers by having them all share the same buffer (the read buffer).
CLOUD-23