Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port linkerd2-proxy-error::recover and linkerd2-proxy-resolve to std::future #518

Merged
merged 6 commits into from
May 19, 2020

Conversation

hawkw
Copy link
Contributor

@hawkw hawkw commented May 18, 2020

This branch updates the linkerd2-proxy-resolve crate to std::future.
It also updates the recover module in linkerd2-proxy-error, which is
a dependency of resolve, and linkerd2-reconnect, which depends on
recover and therefore didn't compile after it was updated.

The linkerd2-proxy-resolve::recover code currently only works when the
underlying resolver's resolution and future types are both Unpin, and
the backoff type is also Unpin. This is because this logic relies a
bit on being able to move these values in and out of Options. I tried
to implement this without requiring these values to be Unpin, but the
implementation of the ResolveFuture, which drives the resolution until
it's connected and then returns it, was more or less impossible to
translate in its current state.

I suspect that this won't be an issue when updating code that depends on
recover — I think the resolutions will probably be Unpin without any
intervention from us. If not, we can always either Box::pin them, or
try to do a more complete rewrite of this code so that it's refactored
in a way that avoids these issues.

In other cases, we can sometimes just replace code that is difficult to
port to use async/await. Here, that was not possible, because we are
implementing the Resolution trait, rather than a future. We may want
to consider rewriting Resolution to be a trait alias for a Stream,
so that we can use the async-stream crate, but that may have other
downsides, so I decided to not do that just yet.

Hopefully this all makes sense!

hawkw added 5 commits May 15, 2020 13:13
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
sadly, recover requires unpin, but i couldn't make it work otherwise

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Copy link
Contributor

@kleimkuhler kleimkuhler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@hawkw hawkw merged commit dead469 into master-tokio-0.2 May 19, 2020
hawkw added a commit that referenced this pull request May 20, 2020
This branch updates the `linkerd2-proxy-api-resolve` crate to use
`std::future` and Tonic. Getting this to work required some upstream
changes to linkerd/linkerd2-proxy-api#39 to pass different feature flags
to Tonic, but the change here is pretty straigntforward.

Depends on #518 and will be rebased onto `master-tokio-02`
when that branch merges.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
@olix0r olix0r deleted the eliza/0.2-resolve branch May 25, 2021 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants