Commit Graph

388 Commits

Author SHA1 Message Date
Carl Lerche 117018f319
Rename `EitherService` -> `Either` (#218) 2019-03-29 19:17:02 -07:00
Carl Lerche 3fd5b581cc
Fix build. (#217)
A recently merged PR failed to track master.
2019-03-29 14:39:34 -07:00
Carl Lerche 019129829c
Move layer::{LayerExt, Chain, Identity} (#216)
- `tower-layer` util types are now in `tower-util`.
- `LayerExt` is now in `tower`.

This sets the stage for adding layer specific extension fns.
2019-03-29 14:28:06 -07:00
Carl Lerche 2448ca9cdc
balance: cleanup example (#211) 2019-03-29 14:24:43 -07:00
Lucio Franco da4e22c89d
Add missing `TimeoutLayer` to tower (#215)
Signed-off-by: Lucio Franco <luciofranco14@gmail.com>
2019-03-29 17:00:13 -04:00
Carl Lerche f6dcbb6ca1
Remove combinators (#214) 2019-03-27 20:16:07 -07:00
Carl Lerche 3a407c2775
Move misc types (#213) 2019-03-27 19:56:44 -07:00
Carl Lerche f1bb22a296
util: rename tower-service-util -> tower-util (#212) 2019-03-27 16:34:56 -07:00
Lucio Franco d968432183 Export all crates from the tower crate (#210) 2019-03-27 15:38:49 -07:00
Lucio Franco b01252c5e9
Fix tower-service-util docs link (#209) 2019-03-26 14:12:44 -04:00
Lucio Franco 7a09459081 Fix readme links (#208) 2019-03-26 08:46:53 -07:00
Lucio Franco 9dfcf7e527 Add tower to the readme (#207) 2019-03-26 08:38:00 -07:00
Lucio Franco 8f3a5ea6fa
Fix doc links for unpublished crates (#206) 2019-03-26 10:16:03 -04:00
Lucio Franco 476f085c89
Introduce the `ServiceBuilder` (#175)
The `ServiceBuilder` composes layers together and produces either a `MakeService` or a `Service` wrapped by those layers.
2019-03-26 10:14:42 -04:00
Carl Lerche bec3937e87
buffer: switch to TypedExecutor (#205) 2019-03-25 10:56:12 -07:00
Lucio Franco 0e70f1320e
layer: Add an identity layer (#195)
Tied to #175
2019-03-24 16:53:09 -04:00
Sean McArthur db2f0ecfb3
Introduce tower-load-shed (#204)
Provides a middleware that immediately fails any request if the
underlying service isn't ready yet. This is useful when used in
conjunction with `InFlightLimit` or others, so that requests are
rejected immediately, instead of keeping track of extra pending
requests.
2019-03-20 15:48:10 -07:00
Carl Lerche 5607313192
Minor `tower` crate re-org (#201)
- Rename `tower::ext` -> `tower::util`.
- Re-export structs from `tower-service-util` in `tower::util`.
- Re-export `tower_service::Service` at root.
2019-03-20 09:17:59 -07:00
Carl Lerche 263c680ea6 Remove tower-watch (#200) 2019-03-19 18:18:59 -07:00
Sean McArthur 1aba91313c
add poll_ready to MakeConnection (#202) 2019-03-19 18:18:07 -07:00
Carl Lerche 728f9d3c37
Fix fmt (#203) 2019-03-19 15:13:10 -07:00
Carl Lerche 733b597f38
Simplify Buffer::new error type
The returned error is now `Box<Error + Send + Sync>`.
2019-03-18 20:26:21 -07:00
Carl Lerche e05dc90340
Polish call all (#198)
- Move `CallAll` into `tower-service-util`
- Simplify error handling
- Add `CallAllUnordered`
2019-03-18 19:59:28 -07:00
Carl Lerche 92f4a0cb72
Rename tower-util -> tower (#197) 2019-03-15 10:53:19 -07:00
Carl Lerche fd54e47b56
rm tower-util/src/service_fn.rs (#196) 2019-03-14 19:51:50 -07:00
Carl Lerche f8d88427aa
discover: polish crate (#194) 2019-03-14 13:11:53 -07:00
Carl Lerche acda5a75b9
Initial introduction of tower-service-util (#193) 2019-03-14 11:27:36 -07:00
Carl Lerche 50fc5e8e63
Reorganize tower-timeout (#191)
- Change error bound: `Error: From<S::Error>` (for `?` operator)
- Split types into dedicated files
- Move `ResponseFuture` into public `future` mod.
2019-03-11 16:10:51 -07:00
Carl Lerche 720d31c65f
rate-limit: Refresh layout (#189)
- Switch to `Box<Error>`
- Break up lib.rs into multiple files.
- Use `tokio::clock::now` instead of `Instant::now`.
2019-03-08 22:44:48 -08:00
Sean McArthur 20102a647b
buffer: fix panics if worker executor drops unexpectedly (#190) 2019-03-08 18:18:01 -08:00
Jon Gjengset ac9488f5f2
Add a dynamically-sized load-balanced pool (#119)
This patch adds a new type, `Pool`, which wraps a
`tower_balance::Balance` and a `tower_service::NewService` together so
that new `Service` instances are added when load is high, and removed
again if load is low.

The pool uses an exponentially weighted moving average of successful
calls to `poll_ready` on the underlying `Balance` to estimate whether
there are enough services available. If `poll_ready` frequently returns
`NotReady`, then a new service is produced, whereas if `poll_ready`
pretty much never returns `NotReady`, the most recently added service is
removed from the pool (down to a minimum of 1).
2019-03-08 12:23:34 -05:00
Jon Gjengset 421fbf0006 Add CallAll combinator. (#187)
Add the `CallAll` combinator, which provides:

```rust
Stream<Item = Request> + Service<Request> => Stream<Item = Response>
```

That is, given a `Stream` of requests and a `Service` that can accept
those requests, it produces a `Stream` of the corresponding responses.
2019-03-08 09:19:38 -08:00
Carl Lerche e0d6d5b2f5
Refresh Reconnect (#185) 2019-03-08 08:46:12 -08:00
Sean McArthur 4c3742e41b
balance: update to Box<dyn Error> (#188) 2019-03-07 15:11:19 -08:00
Carl Lerche 1e38ee6e1f Fix in flight limit (#184)
* Move `InFlightLimitLayer` into `layer` mod

* Remove error type
2019-03-07 16:53:21 -05:00
Carl Lerche bdcce9677b
depend on tower-service from crates.io (#186) 2019-03-06 13:38:58 -08:00
Carl Lerche 794aa44c4b
Create subdir for tower crate (#182) 2019-03-06 07:54:39 -08:00
Carl Lerche fb01af2ad9
filter: Update error style (#178)
This patch does not migrate tower-filter to use an error type of
Box<Error>. Instead, it defines a new type that optionally contains
a Box<Error>.

The filter layer can be used as part of routing. The router would
sequentially attempt to dispatch a request to an inner service. If
the request is rejected, it attempts the next one. In this case, allocating
a Box<Error> for each attempt is not great.

This strategy still fits within the greater picture. tower_filter::error::Error
implements the error trait, which means that all other layers that take
T: Into<Error> will still work with Filter. Also, only the immediate caller
of Filter should care about rejection errors. In which case, Filter will be
referenced explicitly.

Refs: #131
2019-03-01 15:25:21 -08:00
Carl Lerche bf8c3b885a
mock: Use Box<Error> instead of a generic (#177)
Refs: #131
2019-03-01 13:56:57 -08:00
Carl Lerche 749e46b3f5
ci: `cd` into crate instead of `-p $crate` (#176)
Cargo is buggy when specifying the crate to run a command against.
2019-03-01 09:03:23 -08:00
Lucio Franco 0a234af4ba layer: Fix util feature and add chain try support (#174) 2019-02-28 14:34:00 -08:00
Carl Lerche 8bb8c2d48e
Try fixing doc deploy again (#173) 2019-02-28 14:25:41 -08:00
Carl Lerche cb67f5d6c3
Try fixing deploy docs (#172) 2019-02-28 12:20:55 -08:00
Carl Lerche de799582fb
Switch CI to Azure Pipelines (#171) 2019-02-28 12:08:29 -08:00
Lucio Franco c5d70481bd
layer: Add `tower-layer` and the `Layer` trait (#163)
This change introduces the new `tower-layer` crate and the foundational `Layer` trait to go along with it. This trait allows one to easily compose a set of `Service`s that take an inner service. These services only modify the request/response. This also provides the `Layer` implementation for many of the tower crates.
2019-02-27 15:28:42 -05:00
Sean McArthur 79a98ea05d timeout: update to Box<dyn Error> (#170) 2019-02-27 10:35:25 -08:00
Lucio Franco d874c251ff
timeout: Add derive Clone for the timeout service (#169) 2019-02-27 11:57:56 -05:00
Carl Lerche 8241fe8584
buffer: replace generic error with Box<Error> (#168)
Refs: #131
2019-02-26 13:40:16 -08:00
Carl Lerche 92653e68a6
Cleanup Buffer (#166)
* Move ResponseFuture, error types to dedicated mod
* Split code into multiple files.
* Remove `lazy_cell` dependency.
2019-02-25 10:01:26 -08:00
Stefano Probst a92a108239 Fix typo in Readme (#165) 2019-02-23 11:45:56 -05:00