Skip to content

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

Merged
hawkw merged 6 commits intomaster-tokio-0.2from
eliza/0.2-resolve
May 19, 2020
Merged

port linkerd2-proxy-error::recover and linkerd2-proxy-resolve to std::future#518
hawkw merged 6 commits intomaster-tokio-0.2from
eliza/0.2-resolve

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 <[email protected]>
sadly, recover requires unpin, but i couldn't make it work otherwise

Signed-off-by: Eliza Weisman <[email protected]>
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 <[email protected]>
@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