Skip to content

writer: support passing ChunkedBytes in Writer::write #4414

Closed

Description

@hzxa21

We have a use case to upload non-continuous bytes in memory (e.g. Vec<Bytes>) in a part for S3 multipart upload. Under the current interface, we need flatten these bytes into continuous bytes because the writer accepts Into<Bytes> as the payload, which requires extra copy and memory allocation.

I noticed that internally OpenDAL uses oio::WriterBuffer in the poll_write interface with one of its implementation to be ChunkedBytes, which is the data structure I am looking for. I am thinking whether it is more favorable to let writer accepts impl WriteBuf as the payload instead to enable more use cases efficiently. Open to better ideas as well.

Activity

  1. Xuanwo commented on Apr 1, 2024

    @Xuanwo
    Member

    Thank you for bringing this to our attention; it aligns perfectly with the concept I plan to introduce in OpenDAL.

    My current plan is to expose bytes::Buf so users can implement non-continuous bytes by their own. And opendal will use APIs like copy_to_bytes or chunks_vectored to minimize the cost.

  2. hzxa21 commented on Apr 1, 2024

    @hzxa21
    Author

    Thank you for bringing this to our attention; it aligns perfectly with the concept I plan to introduce in OpenDAL.

    My current plan is to expose bytes::Buf so users can implement non-continuous bytes by their own. And opendal will use APIs like copy_to_bytes or chunks_vectored to minimize the cost.

    Thanks! That's even better! It is not an urgent request but we look forward to it.

  3. Xuanwo commented on Apr 9, 2024

    @Xuanwo
    Member

    Should be fixed by #4452

    We have a Buffer which support both continuous and non-continuous bytes. Users will be able to passing Vec<Bytes> into writer and opendal will not perform any copy around inner bytes.

    Welcome to join the development to make them release faster!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions