Commit Graph

175 Commits

Author SHA1 Message Date
Tim
29067b7773 Prepare for release 2018-10-16 22:19:16 -07:00
Tim
905e5be8bb Remove deprecated tokio-proto and replace with homegrown rpc framework (#199)
# New Crates

- crate rpc contains the core client/server request-response framework, as well as a transport trait.
- crate bincode-transport implements a transport that works almost exactly as tarpc works today (not to say it's wire-compatible).
- crate trace has some foundational types for tracing. This isn't really fleshed out yet, but it's useful for in-process log tracing, at least.

All crates are now at the top level. e.g. tarpc-plugins is now tarpc/plugins rather than tarpc/src/plugins. tarpc itself is now a *very* small code surface, as most functionality has been moved into the other more granular crates.

# New Features
- deadlines: all requests specify a deadline, and a server will stop processing a response when past its deadline.
- client cancellation propagation: when a client drops a request, the client sends a message to the server informing it to cancel its response. This means cancellations can propagate across multiple server hops.
- trace context stuff as mentioned above
- more server configuration for total connection limits, per-connection request limits, etc.

# Removals
- no more shutdown handle.  I left it out for now because of time and not being sure what the right solution is.
- all async now, no blocking stub or server interface. This helps with maintainability, and async/await makes async code much more usable. The service trait is thusly renamed Service, and the client is renamed Client.
- no built-in transport. Tarpc is now transport agnostic (see bincode-transport for transitioning existing uses).
- going along with the previous bullet, no preferred transport means no TLS support at this time. We could make a tls transport or make bincode-transport compatible with TLS.
- a lot of examples were removed because I couldn't keep up with maintaining all of them. Hopefully the ones I kept are still illustrative.
- no more plugins!

# Open Questions

1. Should client.send() return `Future<Response>` or `Future<Future<Response>>`? The former appears more ergonomic but it doesn’t allow concurrent requests with a single client handle. The latter is less ergonomic but yields back control of the client once it’s successfully sent out the request. Should we offer fns for both?
2. Should rpc service! Fns take &mut self or &self or self? The service needs to impl Clone anyway, technically we only need to clone it once per connection, and then leave it up to the user to decide if they want to clone it per RPC. In practice, everyone doing nontrivial stuff will need to clone it per RPC, I think.
3. Do the request/response structs look ok?
4. Is supporting server shutdown/lameduck important?

Fixes #178 #155 #124 #104 #83 #38
2018-10-16 11:26:27 -07:00
Tim
7aabfb3c14 Rewrite using tokio (#44)
* Rewrite tarpc on top of tokio.

* Add examples

* Move error types to their own module.

Also, cull unused error variants.

* Remove unused fn

* Remove CanonicalRpcError* types. They're 100% useless.

* Track tokio master (WIP)

* The great error revamp.

Removed the canonical rpc error type. Instead, the user declares
the error type for each rpc:

In the above example, the error type is Baz. Declaring an error is
optional; if none is specified, it defaults to Never, a convenience
struct that wraps the never type (exclamation mark) to impl Serialize, Deserialize,
Error, etc. Also adds the convenience type StringError for easily
using a String as an error type.

* Add missing license header

* Minor cleanup

* Rename StringError => Message

* Create a sync::Connect trait.

Along with this, the existing Connect trait moves to future::Connect. The future
and sync modules are reexported from the crate root.

Additionally, the utility errors Never and Message are no longer reexported from
the crate root.

* Update readme

* Track tokio/futures master. Add a Spawn utility trait to replace the removed forget.

* Fix pre-push hook

* Add doc comment to SyncServiceExt.

* Fix up some documentation

* Track tokio-proto master

* Don't set tcp nodelay

* Make future::Connect take an associated type for the future.

* Unbox FutureClient::connect return type

* Use type alias instead of newtype struct for ClientFuture

* Fix benches/latency.rs

* Write a plugin to convert lower_snake_case idents/types to UpperCamelCase.

Use it to add associated types to FutureService instead of boxing the return futures.

* Specify plugin = true in snake_to_camel/Cargo.toml. Weird things happen otherwise.

* Add clippy.toml
2016-09-04 16:09:50 -07:00
Tim Kuehn
3cf8e440f7 Bump minor version. 2016-08-07 13:02:04 -07:00
Tim Kuehn
6a6157948a Bump minor version. 2016-07-28 20:37:51 -07:00
Tim Kuehn
1c18a3c4fe Update dependency versions 2016-07-28 20:25:46 -07:00
Tim Kuehn
44eec09418 Add missing Debug impls. 2016-04-24 21:06:42 -07:00
Tim Kuehn
ec4fa8636b Minor macro implementation cleanup.
* Fold service into service_inner.
* Rename service_inner => service.
2016-04-24 20:02:46 -07:00
Tim Kuehn
801f09e9e6 Bump version to v0.5.0 2016-04-24 19:18:42 -07:00
Tim Kuehn
4d636d2882 Merge master into listener. 2016-04-24 18:28:30 -07:00
shaladdle
32e0b0d7f8 Bump version to 0.4.0 2016-04-02 16:56:20 -07:00
Tim Kuehn
9235e12904 Handle Serde(EndOfStream) error as ConnectionBroken 2016-04-02 15:33:56 -07:00
Tim Kuehn
7b5b29a9c3 Update to serde 0.7 2016-04-02 15:18:24 -07:00
Tim Kuehn
709f4ab1ac Add spaces between items in impls. 2016-03-16 21:46:14 -07:00
Tim Kuehn
f33cb3bd53 Add a line between impl and struct 2016-03-16 20:46:23 -07:00
Tim Kuehn
6a6832cfbc Generify doc comment 2016-03-16 20:45:55 -07:00
Tim Kuehn
b0495ebc00 Cargo fmt 2016-03-16 20:43:36 -07:00
Tim Kuehn
aec1574824 Add a line in between struct and impl 2016-03-16 20:43:22 -07:00
Tim Kuehn
5d27d34bd3 Add a documentation note on addresses 2016-03-16 20:36:54 -07:00
Tim Kuehn
5ac4b710a5 Simplify lib.rs example 2016-02-25 23:30:00 -08:00
Tim Kuehn
72a9f8f70d Update deps versions. 2016-02-25 22:49:22 -08:00
Tim Kuehn
714541a7a4 Don't unwrap in Listener::dialer 2016-02-25 01:05:38 -08:00
Tim Kuehn
a1f529f794 Reformat some generic bounds 2016-02-25 00:58:48 -08:00
Tim Kuehn
6273ebefa7 rustfmt 2016-02-25 00:04:35 -08:00
Tim Kuehn
c398e2389b Why were we wrapping the service in an arc? 2016-02-24 23:25:50 -08:00
Tim Kuehn
03dc512e25 Remove Addr associated type of Dialer.
Also, make spawn() take a Dialer, but impl Dialer for str, defaulting to TCP transport.
2016-02-24 21:59:21 -08:00
Tim Kuehn
8307c708a3 Better documentation for Stream.
Basically copied from TcpStream verbatim.
2016-02-24 20:32:15 -08:00
Tim Kuehn
774411c636 Create temp file using tempdir in test 2016-02-24 20:26:49 -08:00
Tim Kuehn
d5b2f23f74 Move generic bounds to where clause 2016-02-23 08:26:56 -08:00
Tim Kuehn
396aec3c2f Add a test 2016-02-23 01:53:20 -08:00
Tim Kuehn
28c6c333e5 Reorgnize modules 2016-02-23 01:13:11 -08:00
Tim Kuehn
a0e6147482 Make Tcp* default types 2016-02-23 00:07:03 -08:00
Tim Kuehn
fcdb0d9375 Add support for arbitrary transports.
Quite a bit of machinery added:
 * Listener trait
 * Dialer trait
 * Stream trait
 * Transport trait
2016-02-22 23:50:34 -08:00
Tim Kuehn
e2f1511fb3 Update deps versions 2016-02-19 23:53:27 -08:00
Adam Wright
f3afd080f3 Allow most things to be unused 2016-02-19 23:28:34 -08:00
Tim Kuehn
934c51f4ab Bunch version number 2016-02-19 22:57:47 -08:00
Tim Kuehn
cc8a8e76b0 Remove a bunch of derived traits from Config for backwards compatibility reasons. 2016-02-19 22:51:18 -08:00
Tim Kuehn
1ee1f9274a Fix some log statements 2016-02-19 22:33:13 -08:00
Tim Kuehn
7f354be850 Merge branch 'master' of github.com:google/tarpc into config 2016-02-19 22:32:16 -08:00
Tim Kuehn
c9a63c2a5a Don't derive Hash for Config because Duration is only Hashable on nightly 2016-02-19 22:06:29 -08:00
Tim
ee1143c709 Merge pull request #14 from shaladdle/hooks
Merge shaladdle/hooks into master.
2016-02-19 21:46:00 -08:00
Tim Kuehn
58cbe6f4ea Update README and service macro doc comment 2016-02-18 21:23:42 -08:00
Tim Kuehn
250a7fd7b9 Move 'static bound from trait to spawn fns 2016-02-18 20:48:25 -08:00
Tim Kuehn
65c4d83c88 [breaking] Renamings and refactorings.
* Add a Config struct. `Client::new(addr, duration)` => `Client::new(addr, config)`
* `serve(addr, server, config)` => `server.spawn_with_config(addr, config)`
* Also added `server.spawn(addr)`
2016-02-18 20:40:08 -08:00
Tim Kuehn
05acb97f04 Add a second rpc to test service.
To better exercise the serialization parts -- namely, the enum tags.
2016-02-16 22:17:06 -08:00
Adam Wright
1f30bb9ba6 Remove the install hooks script 2016-02-15 13:58:42 -08:00
shaladdle
8957d2dac3 Merge pull request #11 from tikue/rustfmt
rustfmt the things
2016-02-15 13:36:16 -08:00
Tim Kuehn
7dae99d7b5 rustfmt the things 2016-02-15 02:34:20 -08:00
Tim Kuehn
9dd3d55744 Add some missing #[inline]s.
And add the optional fn len method to Packet's MapVisitor. Also add a link to documentation in the readme.
2016-02-15 02:20:27 -08:00
Tim Kuehn
104196a90e Bump version number 2016-02-14 21:04:52 -08:00