Skip to content

Polish profile-based endpoint stack#993

Merged
hawkw merged 1 commit intoeliza/fix-logical-endpointfrom
ver/eliza/fix-logical-endpoint
Apr 28, 2021
Merged

Polish profile-based endpoint stack#993
hawkw merged 1 commit intoeliza/fix-logical-endpointfrom
ver/eliza/fix-logical-endpoint

Conversation

@olix0r
Copy link
Member

@olix0r olix0r commented Apr 28, 2021

This change renames endpoint_override to be profile_endpoint:
"override" implies some behavior is being superceded, but in this case
we're simply getting endpoint metadata in place of logical/concrete
metadata.

This change renames `endpoint_override` to be `profile_endpoint`:
"override" implies some behavior is being superceded, but in this case
we're simply getting endpoint metadata in place of logical/concrete
metadata.
@olix0r olix0r requested a review from a team April 28, 2021 03:49
Comment on lines +82 to +87
N: svc::NewService<(Option<profiles::Receiver>, T), Service = NSvc> + Clone,
NSvc: svc::Service<Req, Error = Error>,
NSvc::Future: Send,
E: svc::NewService<ProfileEndpoint, Service = ESvc> + Clone,
ESvc: svc::Service<Req, Response = NSvc::Response, Error = Error>,
ESvc::Future: Send,
Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW, I didn't use separate type parameters for the service types because I noticed that sometimes push_xxx methods' target types can't be inferred, and reducing the number of type params means fewer _, _, _,s have to be written out at the callsite. This is absolutely not a big deal, so I'm happy to use this style if we prefer it — the where clause certainly looks nicer.

impl svc::NewService<
(Option<profiles::Receiver>, T),
Service = OrOverride<E::Service, O::Service>,
Service = svc::stack::ResultService<svc::Either<NSvc, ESvc>>,
Copy link
Contributor

Choose a reason for hiding this comment

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

unrelated thought: might be nice to export a Switch type alias for ResultService<Either<A, B>> in svc, which is a bit more concise than writing out the whole type but doesn't require each stack layer to define a custom alias...not a big deal.

pub fn push_endpoint_override<T, O, R>(
/// endpoint, and forwards directly to that endpoint (bypassing the current
/// stack) if one exists.
pub fn push_profile_endpoint<T, E, ESvc, NSvc, Req>(
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 the "override" terminology was just my first thought when trying to describe this — it's probably not necessary.

I do think it might be nice to have a consistent language for layer functions that introduce a "branch", like this one and push_unwrap_logical, like or_profile_endpoint or something? but we can do that later.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the "override" language might also show up in a test someplace — but I can fix that.

@hawkw hawkw merged commit cd433ca into eliza/fix-logical-endpoint Apr 28, 2021
@hawkw hawkw deleted the ver/eliza/fix-logical-endpoint branch April 28, 2021 17:14
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.

2 participants