523 Commits

Author SHA1 Message Date
David Pedersen
8b84b98d93
chore: prepare to release tower-layer v0.3.2 (#699) tower-layer-0.3.2 2022-10-10 20:27:58 +02:00
Jonas Platte
66010c1443 layer: Implement Layer for tuples of up to 16 elements (#694) 2022-10-07 20:00:59 +02:00
Eliza Weisman
04527aeb43
chore: prepare to release tower-service v0.3.2 (#673)
# 0.3.2 (June 17, 2022)

## Added

- **docs**: Clarify subtlety around cloning and readiness in the
  `Service` docs ([#548])
- **docs**: Clarify details around shared resource consumption in
  `poll_ready()` ([#662])

[#548]: https://github.com/tower-rs/tower/pull/548
[#662]: https://github.com/tower-rs/tower/pull/662
tower-0.4.13 tower-service-0.3.2
2022-06-17 12:44:17 -07:00
Eliza Weisman
4cc7e7d5d3
chore: prepare to release tower v0.4.13 (#672)
# 0.4.13 (June 17, 2022)

### Added

- **load_shed**: Public constructor for `Overloaded` error ([#661])

### Fixed

- **util**: Fix hang with `call_all` when the `Stream` of requests is
  pending ([#656])
- **ready_cache**: Ensure cancelation is observed by pending services
  ([#668], fixes [#415])
- **docs**: Fix a missing section header due to a typo ([#646])
- **docs**: Fix broken links to `Service` trait ([#659])

[#661]: https://github.com/tower-rs/tower/pull/661
[#656]: https://github.com/tower-rs/tower/pull/656
[#668]: https://github.com/tower-rs/tower/pull/668
[#415]: https://github.com/tower-rs/tower/pull/415
[#646]: https://github.com/tower-rs/tower/pull/646
[#659]: https://github.com/tower-rs/tower/pull/659
2022-06-17 19:36:31 +00:00
Oliver Gould
051b094936 ready-cache: Ensure cancelation can be observed (#668)
`tokio::task` enforces a cooperative scheduling regime that can cause
`oneshot::Receiver::poll` to return pending after the sender has sent an
update. `ReadyCache` uses a oneshot to notify pending services that they
should not become ready. When a cancelation is not observed, the ready
cache return service instances that should have been canceled, which
breaks assumptions and causes an invalid state.

This branch replaces the use of `tokio::sync::oneshot` for canceling 
pending futures with a custom cancelation handle using an `AtomicBool`
and `futures::task::AtomicWaker`. This ensures that canceled `Pending`
services are always woken even when the task's budget is exceeded.
Additionally, cancelation status is now always known to the `Pending`
future, by checking the `AtomicBool` immediately on polls, even in cases
where the canceled `Pending` future was woken by the inner `Service`
becoming ready, rather than by the cancelation.

Fixes #415

Signed-off-by: Oliver Gould <ver@buoyant.io>
Co-authored-by: Eliza Weisman <eliza@buoyant.io>
2022-06-17 12:18:32 -07:00
Eliza Weisman
a2305b3447 ready_cache: just use pin_project for Pending (#667)
This gets rid of the `Unpin` impl with the weird comment on it.

Alternatively, we could just put a `S: Unpin` bound on `Pending`, but
this changes the public API to require that the service type is `Unpin`.
In practice, it will be, but we could also just avoid the trait bound.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2022-06-17 12:18:32 -07:00
Matt Klein
b0e7a71bb4 load_shed: make constructor for Overloaded error public (#661)
This allows for mocking. This also matches what is done for
the timeout Elapsed error.

Signed-off-by: Matt Klein <mklein@lyft.com>
2022-06-17 12:18:32 -07:00
Matt Klein
0feb182dd1 service: clarify docs around shared resource consumption in poll_ready() (#662)
Signed-off-by: Matt Klein <mklein@lyft.com>
2022-06-17 12:18:32 -07:00
Bruno
c3d16077df fix: broken Service link (#659) 2022-06-17 12:18:32 -07:00
Leonardo Yvens
d989a82731 util: Fix call_all hang when stream is pending (#656)
Currently `call_all` will hang in a busy loop if called when the input
stream is pending.
2022-06-17 12:18:32 -07:00
Grachev Mikhail
7d81577d17 tower: fix docs typo (#646) 2022-06-17 12:18:32 -07:00
Eliza Weisman
d264bc7968
ci: run MSRV checks with minimal dep versions (#670)
In many cases, new releases of a dependency can break compatibility with
Tower's minimum supported Rust version (MSRV). It shouldn't be necessary
for Tower to bump its MSRV when a dependency does, as users on older
Rust versions should be able to depend on older versions of that crate.
Instead, we should probably just run our MSRV checks with minimal
dependency versions.

This branch changes Tower's CI jobs to do that. It was also necessary to 
make some changes to the `Cargo.toml` to actually fix the build with
minimal dependency versions.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2022-06-17 11:24:25 -07:00
Eliza Weisman
12a06035eb
chore: prepare to release tower v0.4.12 (#642)
* chore: prepare to release v0.4.12

# 0.4.12 (February 16, 2022)

### Fixed

- **hedge**, **load**, **retry**: Fix use of `Instant` operations that
  can panic on platforms where `Instant` is not monotonic ([#633])
- Disable `attributes` feature on `tracing` dependency ([#623])
- Remove unused dependencies and dependency features with some feature
  combinations ([#603], [#602])
- **docs**: Fix a typo in the RustDoc for `Buffer` ([#622])

### Changed

- Updated minimum supported Rust version (MSRV) to 1.49.0.
- **hedge**: Updated `hdrhistogram` dependency to v7.0 ([#602])
- Updated `tokio-util` dependency to v0.7 ([#638])

[#633]: https://github.com/tower-rs/tower/pull/633
[#623]: https://github.com/tower-rs/tower/pull/623
[#603]: https://github.com/tower-rs/tower/pull/603
[#602]: https://github.com/tower-rs/tower/pull/602
[#622]: https://github.com/tower-rs/tower/pull/622
[#638]: https://github.com/tower-rs/tower/pull/638

* add msrv
tower-0.4.12
2022-02-16 22:42:08 +00:00
Eliza Weisman
5e280fedca
ci: fix wrong tag regex for tower (#644)
In #643, I accidentally included a `v` before the version number in the
regex for matching release tags for the `tower` crate, but not for
`tower-whatever` crates. All previous release tags on this repo don't
use a `v`, so adding it was a mistake. This branch removes it.
2022-02-16 22:07:08 +00:00
Eliza Weisman
9c184d81bc
chore: bump MSRV to 1.49.0 (#645)
`tower` builds are now failing on CI because Tokio v1.17.0 bumped MSRV
to 1.49.0. This branch updates `tower`'s MSRV to 1.49.0 to track Tokio's
MSRV. I also added nicer documentation of the MSRV based on Tokio's, and
added the `rust-version` Cargo metadata to the `tower` crate's
`Cargo.toml`.

Note that `tower-service` and `tower-layer` can technically continue to
support much earlier Rust versions than `tower` can, since they don't
depend on external crates and are very small. We could consider testing
separate, older MSRVs on CI for those crates individually. I didn't do
that in this PR, though, because I wasn't sure if this was worth the
effort and I just wanted to get CI passing again.
2022-02-16 13:14:05 -08:00
Eliza Weisman
7b6587e412
ci: automatically publish release notes to GitHub Releases (#643)
This branch adds a GitHub Actions workflow to automatically publish
release notes to GitHub Releases when a tag is pushed on the `master`
branch that corresponds to a release.

The release notes are parsed from the changelog using
taiki-e/create-release-action. The workflow will only run when a tag
matching `tower-[0-9].+` or `tower-[a-z]+-[0-9].+` is pushed to the
`master` branch on the origin (`tower-rs/tower`) repo.
2022-02-16 20:20:29 +01:00
Eliza Weisman
386de64ab4
tower: update tokio-util to v0.7 (#638)
This PR updates `tokio-util` to v0.7.

It also updates the minimum `tokio` dependency to v1.6.0.
This is because `tokio-util` requires at least `tokio` v1.6.0 for
`mpsc::Sender::reserve_owned`, but it only specifies a minimum version
of v1.0.0. This is incorrect and should be considered an upstream bug,
but updating our tokio dep fixes this, so that should at least unbreak
`tower`'s build for now.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2022-02-11 11:29:57 -08:00
Eliza Weisman
db43c07e96
tower: fix annoying clippy lints (#639)
This fixes a bunch of minor clippy lints. None of them were particularly
major, but I was getting tired of the warnings showing up in vscode.

The one lint that had to be ignored rather than fixed is the
`clippy::bool_assert_comparison` lint, which triggers on the
`tower_test::assert_request_eq!` macro. The lint triggers when writing
code like `assert_eq!(whatever, true)` rather than simply
`assert!(whatever)`. In this case, this occurs because the macro makes
an assertion about a request value, and in _some_ tests, the request
type is `bool`. We can't change this to use `assert!`, because in most
cases, when the request is not `bool`, we actually do need `assert_eq!`,
so I ignored that warning.
2022-02-11 11:11:15 -08:00
Eliza Weisman
665834c7a6
ci: disable fail-fast for Rust version matrix jobs (#640)
Tower has test and check jobs on CI that run on a build matrix
including a number of Rust versions. By default, GitHub Actions has
fail-fast semantics for matrix jobs, so if any matrix job fails, the
rest are cancelled and the build is failed. This is intended to help
builds complete faster.

This isn't really the ideal behavior for testing across multiple Rust
versions. When a build fails on a particular toolchain version, we would
ideally like to know whether the failure is localized to that version or
exists on _all_ Rust versions. This is particularly important for builds
on nightly Rust, as the nightly toolchain is more likely to contain
compiler regressions that might not be our fault at all. Similarly, we
might want to know if a change only broke the build on our MSRV, or if
it broke the build everywhere --- such an issue would be fixed
differently.

This also currently means that the nightly test run failing will prevent
PRs from being merged, even if the failure is due to a nightly compiler
regression. We currently only *require* the stable and MSRV test runs
to pass in order to merge a PR, but because the fail-fast behavior
will cancel them if the nightly build fails, this means that nightly failing
will effectively prevent merging PRs...which, given that it's not marked
as required, seems different from what we intended.

Therefore, this PR changes the CI workflow to disable fail-fast behavior
on the cross-version test jobs.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2022-02-11 11:05:03 -08:00
Oliver Gould
2f50b49f5a Avoid time operations that can panic
We have reports of runtime panics (linkerd/linkerd2#7748) that sound a
lot like rust-lang/rust#86470. We don't have any evidence that these
panics originate in tower, but we have some potentialy flawed `Instant`
arithmetic that could panic in this way.

Even though this is almost definitely a bug in Rust, it seems most
prudent to actively avoid the uses of `Instant` that are prone to this
bug.

This change replaces uses of `Instant::elapsed` and `Instant::sub` with
calls to `Instant::saturating_duration_since` to prevent this class of
panic. These fixes should ultimately be made in the standard library,
but this change lets us avoid this problem while we wait for those
fixes.

See also hyperium/hyper#2746
2022-01-31 16:23:47 -08:00
Jake Shadle
20d7b55556
chore: reenable all cargo deny checks (#632) 2022-01-31 09:27:27 +01:00
Christian Legnitto
71a1578f27
chore: Update links to layer list in README (#627)
Previous links were broken. These now link to https://docs.rs/tower/latest/tower/#modules.

Co-authored-by: Oliver Gould <ver@buoyant.io>
2022-01-18 08:08:23 +01:00
Jonas Platte
d0d8707ac0
Fix sometimes-unused dependencies (#603)
`tower` currently has required dependencies that may not be used
unless certain features are enabled.

This change updates `tower` to make these dependencies optional.

Furthermore, this change removes use of `html_root_url`, which is no
longer recommended (https://github.com/rust-lang/api-guidelines/pull/230),
and updates the documented release instructions.
2022-01-17 15:25:07 -08:00
Paolo Barbolini
7f004da56f
Import tracing without the attributes feature (#623)
tracing-attributes depends on syn and proc-macro2, which are slow to compile
2021-12-29 09:47:08 -08:00
Sibi Prabakaran
373a010ff5
Minor doc fix for buffer function (#622) 2021-12-24 10:55:07 +01:00
Oliver Gould
b20b3cbd57
Assert that no unsafe code is used in tower (#621)
The tower crates do not include any `unsafe` code, but tools like
[`cargo-geiger`][cg] can't necessarily detect that. This change adds a
stronger assertion at the top of each crate with a
`#![forbid(unsafe_code)]` directive to assert that no unsafe code is
used in the crate. This also serves as a more obvious obstacle to
introducing unsafe code in future changes.

[cg]: https://github.com/rust-secure-code/cargo-geiger
2021-11-24 15:26:16 -08:00
Qinxuan Chen
2d167204dc
tower: update hdrhistogram to 7.0 and remove useless dependencies (#620)
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
2021-11-19 10:12:48 +01:00
David Pedersen
7674109b28
tower: prepare to release 0.4.11 (#618)
* tower: prepare to release 0.4.11

Added

- **util**: Add `CloneBoxService` which is a `Clone + Send` boxed `Service` ([#615])
- **util**: Add `ServiceExt::boxed` and `ServiceExt::clone_boxed` for applying the
  `BoxService` and `CloneBoxService` middleware ([#616])
- **builder**: Add `ServiceBuilder::boxed` and `ServiceBuilder::clone_boxed` for
  applying `BoxService` and `CloneBoxService` layers ([#616])

Fixed

- **balance**: Remove redundant `Req: Clone` bound from `Clone` impls
  for `MakeBalance`, and `MakeBalanceLayer` ([#607])
- **balance**: Remove redundant `Req: Debug` bound from `Debug` impls
  for `MakeBalance`, `MakeFuture`, `Balance`, and `Pool` ([#607])
- **ready-cache**: Remove redundant `Req: Debug` bound from `Debug` impl
  for `ReadyCache` ([#607])
- **steer**: Remove redundant `Req: Debug` bound from `Debug` impl
  for `Steer` ([#607])
- **util**: Remove redundant `F: Clone` bound
  from `ServiceExt::map_request` ([#607])
- **docs**: Fix `doc(cfg(...))` attributes
  of `PeakEwmaDiscover`, and `PendingRequestsDiscover` ([#610])
- **util**: Remove unnecessary `Debug` bounds from `impl Debug for BoxService` ([#617])
- **util**: Remove unnecessary `Debug` bounds from `impl Debug for UnsyncBoxService` ([#617])

[#607]: https://github.com/tower-rs/tower/pull/607
[#610]: https://github.com/tower-rs/tower/pull/610
[#616]: https://github.com/tower-rs/tower/pull/616
[#617]: https://github.com/tower-rs/tower/pull/617
[#615]: https://github.com/tower-rs/tower/pull/615

* sorting

* Rename `CloneBoxService` to `BoxCloneService`

* formatting

* also update changelog
tower-0.4.11
2021-11-18 20:40:01 +01:00
David Pedersen
4d80f7ed90
builder,util: add convenience methods for boxing services (#616)
* builder,util: add convenience methods for boxing services

This adds a couple of new methods to `ServiceBuilder` and `ServiceExt`:

- `ServiceBuilder::boxed`
- `ServiceExt::boxed`
- `ServiceBuilder::clone_boxed`
- `ServiceExt::clone_boxed`

They apply `BoxService::layer` and `CloneBoxService::layer`
respectively.

* fix doc links

* add missing `cfg`s

* Update tower/CHANGELOG.md

Co-authored-by: Eliza Weisman <eliza@buoyant.io>

* Apply suggestions from code review

Co-authored-by: Eliza Weisman <eliza@buoyant.io>

* not sure why rustdoc cannot infer these

* line breaks

* trailing whitespace

* make docs a bit more consistent

* fix doc links

* update tokio

* don't pull in old version of tower

* Don't run `cargo deny check bans` as it hangs

Co-authored-by: Eliza Weisman <eliza@buoyant.io>
2021-11-18 13:56:19 +01:00
David Pedersen
48f8ae90a4
util: remove unnecessary Debug bounds from boxed services (#617) 2021-11-11 21:59:29 +01:00
David Pedersen
973bf71583
util: add CloneBoxService (#615)
* util: add `CloneService`

This upstreams a little utility I'm using a bunch in axum. Its often
useful to erase the type of a service while still being able to clone
it.

`BoxService` isn't `Clone` previously you had to combine it with
`Buffer` but doing that a lot (which we did in axum) had measurable
impact on performance.

* Address review feedback

* remove needless trait bounds
2021-11-09 21:39:27 +01:00
cppforliving
62df5e72b0
docs: Fix doc(cfg(...)) attributes (#610) (#610)
`RUSTDOCFLAGS='--cfg docsrs' cargo +nightly doc --all-features` outputs some warnings
```
warning: unused attribute `doc`
  --> tower/src/load/peak_ewma.rs:52:20
   |
52 | #[cfg_attr(docsrs, doc(cfg(feature = "discover")))]
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_attributes)]` on by default
note: the built-in attribute `doc` will be ignored, since it's applied to the macro invocation `pin_project`
  --> tower/src/load/peak_ewma.rs:53:1
   |
53 | pin_project! {
   | ^^^^^^^^^^^

warning: unused attribute `doc`
  --> tower/src/load/pending_requests.rs:31:20
   |
31 | #[cfg_attr(docsrs, doc(cfg(feature = "discover")))]
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: the built-in attribute `doc` will be ignored, since it's applied to the macro invocation `pin_project`
  --> tower/src/load/pending_requests.rs:32:1
   |
32 | pin_project! {
   | ^^^^^^^^^^^

warning: `tower` (lib doc) generated 2 warnings
```

This PR is an attempt to fix this.
2021-11-09 09:26:57 -08:00
Folyd
0f16ea5652
docs: Replace ready_and() with ready() in docs (#611) 2021-11-02 15:19:50 +01:00
cppforliving
80c6e38f2f
Remove redundant Clone, and Debug bounds (#607)
The balancer types derive `Debug` and `Clone` implementations, but
this unnecessarily requires that its type parameters implement these
traits.

This change provides manual implementations for `Clone` and `Debug`
to avoid this unintentional restriction.

Closes #606
2021-10-27 22:33:39 -07:00
David Pedersen
d4865641e7
tower: prepare to release 0.4.10 (#608)
* tower: prepare to release 0.4.10

- Fix accidental breaking change when using the
  `rustdoc::broken_intra_doc_links` lint ([#605])
- Clarity that tower's minimum supported rust version is 1.46 ([#605])

[#605]: https://github.com/tower-rs/tower/pull/605

* Update tower/CHANGELOG.md

Co-authored-by: Oliver Gould <ver@buoyant.io>

Co-authored-by: Oliver Gould <ver@buoyant.io>
tower-0.4.10
2021-10-19 21:56:23 +02:00
David Pedersen
1c9631d7b3
chore: Bump MSRV to 1.46 (#605)
* Actually check MSCV on CI

* check broken_intra_doc_links on CI

* clean up CI

* fix other crates

* bump MSRV to 1.42 because of tracing-core

* attempt to fix http not working on 1.42

* use `--workspace` instead of `--all`

`--all` is deprecated

* make tower-service build on 1.42

* force http version 0.2.4

* actually msrv is 1.46 because of tokio

* fix running `cargo fmt`

* clean up

* also run tests on 1.46

* ignore rustsec in time
2021-10-19 16:28:55 +02:00
David Pedersen
62e09024aa
tower: prepare to release 0.4.9 (#602)
- Migrate to pin-project-lite ([#595])
- **builder**: Implement `Layer` for `ServiceBuilder` ([#600])
- **builder**: Add `ServiceBuilder::and_then` analogous to
  `ServiceExt::and_then` ([#601])

[#600]: https://github.com/tower-rs/tower/pull/600
[#601]: https://github.com/tower-rs/tower/pull/601
[#595]: https://github.com/tower-rs/tower/pull/595
[pin-project-lite]: https://crates.io/crates/pin-project-lite
tower-0.4.9
2021-10-14 09:12:28 +02:00
David Pedersen
c4cb3b0788
builder: Add ServiceBuilder::and_then (#601)
This one was missing.

Was the only combinator from `ServiceExt` that wasn't on
`ServiceBuilder` so now they match.
2021-09-04 13:05:46 -07:00
David Pedersen
d91c0f5ba3
builder: Implement Layer for ServiceBuilder (#600) 2021-09-03 18:54:49 +02:00
David Pedersen
3a134ba08a
util: Refactor BoxService (#598) 2021-08-26 06:54:29 +02:00
Michael-J-Ward
ee131aaf46
Migrate to pin project lite (#595)
* REMOVE ME updates peak_wema test to pass

* adds pin_project_lite dependency

* uses pin_project_lite for load::Constant

* uses pin_project_lite for load::PencingRequestsDiscover

* uses pin_project_lite for load::PeakEwma

* uses pin_project_lite for load::Completion

* uses pin_project_lite for tests::support::IntoStream

Turns IntoStream into a regular struct because pin_project_lite does not and will support tuple structs.

416be96f77/src/lib.rs (L401-L408)

* refactors opaque_future into a regular struct

This enables migration to pin_project_lite, which does not and will not support tuple structs
416be96f77/src/lib.rs (L401-L408)

* migrates opaque_future to use pin_project_lite

* removes tuple variant from load_shed::ResponseState enum

* migrates load_shed::future to pin_project_lite

* removes tuple variant from filter::future::State

* migrates filter::future to pin_project_lite

Note: the doc comment on AsyncResponseFuture::service was also reduced to a regular comment.

This is a known limitation of pin_project_lite that the they have labeled as "help wanted".
https://github.com/taiki-e/pin-project-lite/issues/3#issuecomment-745194112

* migrates retry::Retry to pin_project_lite

* refactors retry::future::State to enable pin_project_lite

pin_project_lite has the current limitation of nto supporting doc comments
https://github.com/taiki-e/pin-project-lite/issues/3#issuecomment-745194112

pin_project_lite does not and will not support tuple variants
416be96f77/src/lib.rs (L401-L408)

* migrates retry::future to pin_project_lite

* migrates spawn_ready::make to pin_project_lite

* refactors buffer::future::ResponseState to allow pin_project_lite

* migrates buffer::future to pin_project_lite

* refactors util::AndThenFuture to allow pin_project_lite

* migrates util::AndThenFuture to pin_project_lite

* migrates hedge::Future to pin_project_lite

* migrates hedge::select::ResponseFuture to pin_project_lite

* refactors hedge::delay enum for pin_project_lite

* refactors reconnect::future enum for pin_project_lite

* refactors oneshot::State enum for pin_project_lite

* migrates util::oneshot to pin_project_lite

* migrates reconnect::future to pin_project_lite

* migrates hedge::delay to pin_project_lite

* migrates hedge::latency to pin_project_lite

* migrates discover::list to pin_project_lite

* migrates timeout::future to pin_project_lite

* migrates balance::pool to pin_project_lite

* migrates balance::p2c::make to pin_project_lite

* migrates balance::p2c::service to pin_project_lite

* migrates call_all::ordered to pin_project_lite

* migrates call_all::common to pin_project_lite

* migrates call_all::unordered to pin_project_lite

* migrates util::optional::future to pin_project_lite

* migrates limit::concurrency::future to pin_project_lite

* migrates tower-balance example to pin_project_lite

* applies cargo fmt

* migrates tower-test to pin_project_lite

* fixes cargo hack check

peak_wma and pending_requests will now properly compile without the "discover" feature enabled.

* fixes lint rename warning on nightly

broken_intra_doc_links has been renamed to rustdoc::broken_intra_doc_links

* migrates buffer::Worker to pin_project_lite

pin_project_lite does support PinnedDrop
https://github.com/taiki-e/pin-project-lite/pull/25/files

However, it does not support generic trait bounds on the PinnedDrop impl.

To workaround this, I removed the T::Error bound from the Worker struct definition,
and moved `close_semaphore` to a a new impl without that trait bound.

* fixes abort_on_drop test

This test was also failing on master.

* applies cargo fmt
2021-07-28 13:48:47 -04:00
David Pedersen
77760198f1
docs: add "Building a middleware from scratch" guide (#590)
This adds a guide that explains how to implement a middleware from scratch without taking any shortcuts. It walks through implementing `Timeout` as it exists in Tower today.

The hope is that once users have read [the previous guide](https://tokio.rs/blog/2021-05-14-inventing-the-service-trait) followed by this one they should be fully equipped to implement their own middleware.
2021-06-07 11:06:30 +02:00
kazk
31dbc90c45
Add kube to the list of libraries (#592) 2021-06-06 08:54:21 +02:00
David Pedersen
b5d2c8f1d3
tower: prepare to release 0.4.8 (#591) tower-0.4.8 2021-05-28 22:18:09 +02:00
Jerome Gravel-Niquet
74f9047f30
Allow reusable concurrency limit via GlobalConcurrencyLimit (#574)
* limit: global concurrency limit layer from a owned semaphore

* new_owned -> new_shared + docs improvements

Co-authored-by: David Pedersen <david.pdrsn@gmail.com>

* keep exposing Semaphore, but rename the API a bit and make it simpler to use

* missed a spot

* minor docs fixes

* update changelog

Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
Co-authored-by: Eliza Weisman <eliza@buoyant.io>
2021-05-28 16:45:44 +02:00
Lucio Franco
71ece8ea5a
Fix warning in oneshot test (#587)
Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
2021-05-18 16:31:29 -04:00
David Pedersen
ce2f031523
docs: guide moved to tokio.rs (#588) 2021-05-18 14:35:19 +02:00
David Pedersen
31d5a6652a
Fix a couple of typos in the guide (#586) 2021-05-17 19:36:04 +02:00
David Pedersen
5e0c8da260
docs: Add "Inventing the Service trait" guide (#585)
This adds the first Tower guide called "Inventing the `Service` trait". It attempts to motivate all the parts to `Service` by walking the user through how they could have invented `Service` themselves, from scratch. It goes into quite a bit of detail but hopefully it paints a somewhat complete picture in the end.

The next guide I want to write is about how to implement a proper `Timeout` middleware using `Layer`, pin-project, and all the bells and whistles.

Ref: https://github.com/tower-rs/tower/issues/33
2021-05-14 22:59:43 +02:00
David Pedersen
53ec99eb8f
builder: Add ServiceBuilder::map_result (#583)
Noticed that `ServiceBuilder` didn't have `map_result`, only `then`
which is async.
2021-05-07 09:42:31 -07:00