Skip to content
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

Writer should accept Buffer #4465

Closed
6 tasks done
Tracked by #4452
Xuanwo opened this issue Apr 11, 2024 · 9 comments · Fixed by #4541
Closed
6 tasks done
Tracked by #4452

Writer should accept Buffer #4465

Xuanwo opened this issue Apr 11, 2024 · 9 comments · Fixed by #4541

Comments

@Xuanwo
Copy link
Member

Xuanwo commented Apr 11, 2024

Write API Design

We want to implement the follwing APIs upon Writer:

The name is still being decided, but the semantics should be fine as they are.

In general, we will provide three kinds of API:

  • Buffer native (the best performance API without extra copy): write and into_sink
  • Bytes based: write_from and into_bytes_sink
  • Async Write based: into_futures_async_write
@zjregee
Copy link
Member

zjregee commented Apr 12, 2024

Can I try some of them like write and write_from?

@Xuanwo
Copy link
Member Author

Xuanwo commented Apr 12, 2024

Can I try some of them like write and write_from?

Welcome to have a try!

@tisonkun
Copy link
Member

@Xuanwo there is no copy_from and pipe_from now?

@Xuanwo
Copy link
Member Author

Xuanwo commented Apr 16, 2024

@Xuanwo there is no copy_from and pipe_from now?

Yes, not implemented.

@tisonkun
Copy link
Member

@Xuanwo could you then update the issue description and add related source code any contributor can start from?

@tisonkun
Copy link
Member

@Xuanwo any dangling APIs here? I saw #4498 do something for this issue.

@Xuanwo
Copy link
Member Author

Xuanwo commented Apr 16, 2024

The only API left is into_sink and into_bytes_sink. They can replace the existing sink API.


I'm still hesitate about the into_sink API. We can keep it internal use only.

@tisonkun
Copy link
Member

The API design is still quite abstract. As a developer unfamiliar with this scope, what does it mean BufferSink and FuturesBytesSink? Which trait should they implement? What APIs do they want to replace?

@Xuanwo
Copy link
Member Author

Xuanwo commented Apr 22, 2024

what does it mean BufferSink and FuturesBytesSink?

Also, into_bytes_sink() -> FuturesBytesSink will replace existing sink(&mut self, sink_from: S).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants