diff --git a/README.md b/README.md index c997816..ed04e6b 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ Some other features of tarpc: Add to your `Cargo.toml` dependencies: ```toml -tarpc = "0.24" +tarpc = "0.25" ``` The `tarpc::service` attribute expands to a collection of items that form an rpc service. @@ -73,7 +73,7 @@ your `Cargo.toml`: ```toml futures = "1.0" -tarpc = { version = "0.24", features = ["tokio1"] } +tarpc = { version = "0.25", features = ["tokio1"] } tokio = { version = "1.0", features = ["macros"] } ``` @@ -126,7 +126,7 @@ impl World for HelloServer { ``` Lastly let's write our `main` that will start the server. While this example uses an -[in-process channel](rpc::transport::channel), tarpc also ships a generic [`serde_transport`] +[in-process channel](transport::channel), tarpc also ships a generic [`serde_transport`] behind the `serde-transport` feature, with additional [TCP](serde_transport::tcp) functionality available behind the `tcp` feature. diff --git a/RELEASES.md b/RELEASES.md index fece6a0..714cb64 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,74 @@ +## 0.25.0 (2021-03-10) + +### Breaking Changes + +#### Major server module refactoring + +1. Renames + +Some of the items in this module were renamed to be less generic: + +- Handler => Incoming +- ClientHandler => Requests +- ResponseHandler => InFlightRequest +- Channel::{respond_with => requests} + +In the case of Handler: handler of *what*? Now it's a bit clearer that this is a stream of Channels +(aka *incoming* connections). + +Similarly, ClientHandler was a stream of requests over a single connection. Hopefully Requests +better reflects that. + +ResponseHandler was renamed InFlightRequest because it no longer contains the serving function. +Instead, it is just the request, plus the response channel and an abort hook. As a result of this, +Channel::respond_with underwent a big change: it used to take the serving function and return a +ClientHandler; now it has been renamed Channel::requests and does not take any args. + +2. Execute methods + +All methods thats actually result in responses being generated have been consolidated into methods +named `execute`: + +- InFlightRequest::execute returns a future that completes when a response has been generated and + sent to the server Channel. +- Requests::execute automatically spawns response handlers for all requests over a single channel. +- Channel::execute is a convenience for `channel.requests().execute()`. +- Incoming::execute automatically spawns response handlers for all requests over all channels. + +3. Removal of Server. + +server::Server was removed, as it provided no value over the Incoming/Channel abstractions. +Additionally, server::new was removed, since it just returned a Server. + +#### Client RPC methods now take &self + +This required the breaking change of removing the Client trait. The intent of the Client trait was +to facilitate the decorator pattern by allowing users to create their own Clients that added +behavior on top of the base client. Unfortunately, this trait had become a maintenance burden, +consistently causing issues with lifetimes and the lack of generic associated types. Specifically, +it meant that Client impls could not use async fns, which is no longer tenable today, with channel +libraries moving to async fns. + +#### Servers no longer send deadline-exceed responses. + +The deadline-exceeded response was largely redundant, because the client +shouldn't normally be waiting for such a response, anyway -- the normal +client will automatically remove the in-flight request when it reaches +the deadline. + +This also allows for internalizing the expiration+cleanup logic entirely +within BaseChannel, without having it leak into the Channel trait and +requiring action taken by the Requests struct. + +#### Clients no longer send cancel messages when the request deadline is exceeded. + +The server already knows when the request deadline was exceeded, so the client didn't need to inform +it. + +### Fixes + +- When a channel is dropped, all in-flight requests for that channel are now aborted. + ## 0.24.1 (2020-12-28) ### Breaking Changes diff --git a/example-service/Cargo.toml b/example-service/Cargo.toml index 581eeb1..bc40e6d 100644 --- a/example-service/Cargo.toml +++ b/example-service/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tarpc-example-service" -version = "0.8.0" +version = "0.9.0" authors = ["Tim Kuehn "] edition = "2018" license = "MIT" @@ -17,7 +17,7 @@ clap = "2.33" env_logger = "0.8" futures = "0.3" serde = { version = "1.0" } -tarpc = { version = "0.24", path = "../tarpc", features = ["full"] } +tarpc = { version = "0.25", path = "../tarpc", features = ["full"] } tokio = { version = "1", features = ["full"] } [lib] diff --git a/plugins/Cargo.toml b/plugins/Cargo.toml index e8478b5..30964ce 100644 --- a/plugins/Cargo.toml +++ b/plugins/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tarpc-plugins" -version = "0.9.0" +version = "0.10.0" authors = ["Adam Wright ", "Tim Kuehn "] edition = "2018" license = "MIT" diff --git a/tarpc/Cargo.toml b/tarpc/Cargo.toml index 6fa0143..bd5d007 100644 --- a/tarpc/Cargo.toml +++ b/tarpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tarpc" -version = "0.24.1" +version = "0.25.1" authors = ["Adam Wright ", "Tim Kuehn "] edition = "2018" license = "MIT" @@ -35,7 +35,7 @@ pin-project = "1.0" rand = "0.7" serde = { optional = true, version = "1.0", features = ["derive"] } static_assertions = "1.1.0" -tarpc-plugins = { path = "../plugins", version = "0.9" } +tarpc-plugins = { path = "../plugins", version = "0.10" } tokio = { version = "1", features = ["time"] } tokio-util = { version = "0.6.3", features = ["time"] } tokio-serde = { optional = true, version = "0.8" } diff --git a/tarpc/src/lib.rs b/tarpc/src/lib.rs index 21972a3..693a0ba 100644 --- a/tarpc/src/lib.rs +++ b/tarpc/src/lib.rs @@ -46,7 +46,7 @@ //! Add to your `Cargo.toml` dependencies: //! //! ```toml -//! tarpc = "0.24" +//! tarpc = "0.25" //! ``` //! //! The `tarpc::service` attribute expands to a collection of items that form an rpc service. @@ -60,7 +60,7 @@ //! //! ```toml //! futures = "1.0" -//! tarpc = { version = "0.24", features = ["tokio1"] } +//! tarpc = { version = "0.25", features = ["tokio1"] } //! tokio = { version = "1.0", features = ["macros"] } //! ``` //!