-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate Gotham to std Futures to support Async/Await (#370)
* Ported examples to Std::Future The following examples were not updated (and thus commented out in `Cargo.toml`) due to incompatible dependencies: - [ ] `hello_world_until` is dependent on a compatible version of `tokio-signal` - [ ] `diesel` is dependent on the Diesel middleware - [ ] `openssl` is dependent on `tokio-openssl` - [ ] `websocket` is dependent on `tokio-tungstenite` * Migrate Gotham to std Futures to support Async/Await With the anticipated release of async-await in stable rust this week, I took an effort to migrate Gotham to run on std futures using the pre-release versions of the dependencies (tokio, hyper, etc). *NOTE*: This doesn't attempt to introduce `await` or `async fn` into the codebase (there was a single unavoidable case due to an `tokio::File::metadata` API change). That is designed as a future activity. This migration involved a few key efforts: 1. Convert from Futures 0.1 to Futures-preview 0.3 (mostly `Future<Item=>` to `Future<Output=Result<>>`). 2. Update dependencies to pre-release versions (`tokio-0.2` and `hyper-0.13`). There's still other dependencies that are outstanding and blocking the full release. 3. Migrate Handler trait to a pinned box HandlerFuture. This is a **work-in-progress** with a few blockers before this would be ready: Gotham Dependencies: - [ ] Update Futures from `futures-preview` to `futures = 0.3` when the other dependencies (hyper, tokio, etc) update in concert. - [ ] Update Tokio to `0.2` from alpha pre-releases - [ ] Update Hyper to `0.13` from alpha pre-releases - [ ] Update Tower-Service to `0.3` from alpha pre-releases. Hyper is migrating many of its traits to `tower-service::Service` and so is now a direct dependency. - [ ] Released version of `futures_rustls` which is currently a branch of `tokio-rustls` ported to Futures-preview - [ ] Released version of `futures-tokio-compat` or suggested `tokio::compat` library for bridging `futures::AsyncRead` and `tokio::AsyncRead`. See tokio-rs/tokio#1297 and async-rs/async-std#54 Middleware Dependencies: - [ ] Diesel - Requires updated release of `tokio-threadpool` - [ ] JWT - Requires updated release of `jsonwebtoken` since it's dependency `ring` conflicts withs `futures-rustls`. * Updated to crates.io verison of futures-rustls * Migrated to tokio-0.2 final and hyper-0.13 final This involved changing the way that the runtime is managed and handling `block_on` for synchronously running futures. Hyper-0.13 required changing to the tower_service trait for implementing a `Connect` trait used for the TLS and plain tcp stream wrappers. The other major change is that Hyper migrated from a `Chunk` trait to use `Bytes`. Bytes-0.5 is now a trait rather than a struct which no longer implements `Extends<u8>` requiring a new `BytesMut` buffer for some common concatenation operations. * Re-enable hello_world_until Replace tokio-signal with tokio (signal was migrated into tokio itself) * Remove commented out code Co-Authored-By: Pavan Kumar Sunkara <pavan.sss1991@gmail.com> * Async-ified the init_server helpers * Simplify executing futures in tls/test to match plain/test * Re-enabled diesel middleware and example * Addressed review comments. Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
- Loading branch information
1 parent
47d5d0e
commit 3969d36
Showing
88 changed files
with
1,116 additions
and
981 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.