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

Change API from Stream to Sink #34

Open
stepancheg opened this issue Oct 28, 2018 · 0 comments
Open

Change API from Stream to Sink #34

stepancheg opened this issue Oct 28, 2018 · 0 comments

Comments

@stepancheg
Copy link
Owner

stepancheg commented Oct 28, 2018

Currently, client and server APIs are basically:

fn start_request(Headers, request_body: Stream<Part>) -> Stream<Part>;

The client invokes this function and server provides a callback for that function.

  • this API is not very easy API to use, because Stream is not trivial to implement (request for a client and response for a server)
  • httpbis library requires to spawn a separate task just to "pull" from a provided stream, because of that httpbis performs additional work when user implementation already has a task which provides data

The proposed API should be like this:

// client:
fn start_request(Headers) -> (Sink<Part>, Stream<Part>); // return a request sink and response stream
// server
fn start_request(Headers, request: Stream<Part>, response: Sink<Part>);

Note h2 library and grpc-rs use similar APIs.

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

No branches or pull requests

1 participant