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

[rust-server] asynchronous support via hyper v0.11 #7896

Merged
merged 11 commits into from
Apr 2, 2018

Conversation

bjgill
Copy link
Contributor

@bjgill bjgill commented Mar 23, 2018

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: 3.0.0 branch for changes related to OpenAPI spec 3.0. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language. @frol @farcaller (@wing328)

Description

This PR moves rust-server from hyper v0.10 to v0.11. This has the effect of allowing rust-server to use asynchronous I/O. I'm raising this on behalf of @mirw (see #6756 (comment)).

See https://tokio.rs/ for more information about tokio, the async Rust framework that we are using here. Tokio is the current focus of the Rust communities efforts around async.

Non back-compatible changes:

  • Client is no longer Send + Sync
  • Api implementations used by Server are no longer expected to be Send + Sync (which is good, because it's quite hard if Client isn't)
  • the code to create Clients and Servers, and hook them into hyper or tokio is different.

Importantly, though, the business logic itself should be unchanged. See the sample client and server for examples of how one could migrate existing code.

This PR will also unblock some of the work in #7600.

Testing

We've been using this in production for several months now. We discovered (and fixed) a bug where both body and query parameters were present - the new /fake/body-with-query-params endpoint in the test swagger spec ensures we don't regress this in future.

Benjamin Gill and others added 11 commits December 12, 2017 11:15
…asynchronously

The changes are complete and working (at least for microservices tested within Metaswitch).  This isn't completely compatible with the (previous/current) synchronous swagger-codegen.  Specifically,

*   `Client` is no longer `Send + Sync`
*   Api implementations used by Server are no longer expected to be `Send + Sync` (which is good, because it's quite hard if `Client` isn't)
*   the code to create `Client`s and `Server`s, and hook them into `hyper` or `tokio` is different.

Importantly, though, the business logic itself should be unchanged.
…ents and servers can talk to each other again.
* Fix up handling of multipart messages
* Fix server -> client multipart message response
* Correct handling of optional file types
@wing328 wing328 added this to the v2.4.0 milestone Apr 2, 2018
@wing328 wing328 merged commit 6c7813e into swagger-api:master Apr 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants