Skip to content

Change API from Stream to Sink #34

@stepancheg

Description

@stepancheg

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions