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
Most of Interledger.rs supports zero-copy ILP packet forwarding and manipulation. However, we are currently copying the packet as soon as it arrives from the HTTP request handled by warp. There may be a way to avoid having it copy the bytes in most cases.
warp doesn't expose the internal way the HTTP body is stored and instead provides the FullBody struct. Looking through the implementation a bit, it seems like there may a way to try turning the FullBody into the BytesMut needed by:
I haven't tried this but it looks like something along the following lines might work:
let chunk: hyper::Chunk = body.into_chunk();
let bytes: bytes::Bytes = chunk.into_bytes();
let body: bytes::BytesMut = bytes.try_mut().unwrap_or_else(BytesMut::from);
As described here, try_mut will turn the Bytes into a BytesMut without copying if there are no other references to the underlying data.
The text was updated successfully, but these errors were encountered:
Most of Interledger.rs supports zero-copy ILP packet forwarding and manipulation. However, we are currently copying the packet as soon as it arrives from the HTTP request handled by
warp
. There may be a way to avoid having it copy the bytes in most cases.warp
doesn't expose the internal way the HTTP body is stored and instead provides theFullBody
struct. Looking through the implementation a bit, it seems like there may a way to try turning theFullBody
into theBytesMut
needed by:https://github.com/interledger-rs/interledger-rs/blob/ab94e2736eb616f40cb17d1eee672f899759a0ac/crates/interledger-http/src/server.rs#L61-L62
I haven't tried this but it looks like something along the following lines might work:
As described here,
try_mut
will turn theBytes
into aBytesMut
without copying if there are no other references to the underlying data.The text was updated successfully, but these errors were encountered: