-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(http/retry): refactor
PeekTrailersBody<B>
logic
this is a squashed commit containing the following: --- refactor(http/retry): decompose `WithPeekTrailersBody<B>` type alias this commit breaks this large type out into two halves. this is a purely cosmetic change. Signed-off-by: katelyn martin <[email protected]> refactor(http/retry): `PeekTrailersBody` is pin projected we must pass our `Pin<T>`'edness down to the inner `B`-typed body for `PeekTrailersBody` to itself implement `http_body::Body`. this commit tweaks the existing code to rely on the `pin-project` library. this generates a `project()` method to pin inner fields whose `poll_data()` and `poll_trailers()` functions we delegate to. this is a noöp change. Signed-off-by: katelyn martin <[email protected]> refactor(http/retry): defer construction of `PeekTrailersBody<B>` this commit refactors the polling logic in `PeekTrailersBody<B>::read_response`. this commit makes some subtle changes with the migration to hyper 1.0 in mind, to make this function more easily portable to the new signature of `http_body::Body`. see linkerd/linkerd2#8733 for more information. this commit defers the `Self` construction of the `PeekTrailersBody` body. this means that the control flow does not need to reach through to e.g. `body.inner` to poll the inner body being peeked. additionally, it provides us with `let` bindings for the first data frame yielded, and the trailers frame yielded thereafter. this is largely cosmetic, but will make it easier to deal with the additional matching we'll need to do when there is a single polling function that yields us `Frame<D>` objects. Signed-off-by: katelyn martin <[email protected]> refactor(http/retry): `PeekTrailersBody` transforms `B` this is a small structural change to the `PeekTrailersBody::read_response()` function to facilitate writing some unit tests. rather than transforming a `Response<B>` into a `Response<PeekTrailersBody<B>>`, we hoist the `Response::into_parts()` and `Response::from_parts()` calls up. `read_response()` is renamed to `read_body()`. Signed-off-by: katelyn martin <[email protected]>
- Loading branch information
Showing
3 changed files
with
61 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters