diff --git a/linkerd/app/admin/src/stack.rs b/linkerd/app/admin/src/stack.rs index bcfb232e19..ab5663d21a 100644 --- a/linkerd/app/admin/src/stack.rs +++ b/linkerd/app/admin/src/stack.rs @@ -80,7 +80,7 @@ impl Config { let admin = crate::server::Admin::new(report, ready, shutdown, trace); let admin = svc::stack(move |_| admin.clone()) .push(metrics.http_endpoint.to_layer::()) - .push_on_response( + .push_on_service( svc::layers() .push(metrics.http_errors.clone()) .push(errors::layer()) diff --git a/linkerd/app/core/src/control.rs b/linkerd/app/core/src/control.rs index 266b0386f1..131ec29c2a 100644 --- a/linkerd/app/core/src/control.rs +++ b/linkerd/app/core/src/control.rs @@ -81,18 +81,18 @@ impl Config { .push(tls::Client::layer(identity)) .push_timeout(self.connect.timeout) .push(self::client::layer()) - .push_on_response(svc::MapErrLayer::new(Into::into)) + .push_on_service(svc::MapErrLayer::new(Into::into)) .into_new_service() .push_new_reconnect(self.connect.backoff) // Ensure individual endpoints are driven to readiness so that the balancer need not // drive them all directly. - .push_on_response(svc::layer::mk(svc::SpawnReady::new)) + .push_on_service(svc::layer::mk(svc::SpawnReady::new)) .push(self::resolve::layer(dns, resolve_backoff)) - .push_on_response(self::control::balance::layer()) + .push_on_service(self::control::balance::layer()) .into_new_service() .push(metrics.to_layer::()) .push(self::add_origin::layer()) - .push_on_response(svc::layers().push_spawn_buffer(self.buffer_capacity)) + .push_on_service(svc::layers().push_spawn_buffer(self.buffer_capacity)) .push_map_target(move |()| addr.clone()) .push(svc::BoxNewService::layer()) .into_inner() diff --git a/linkerd/app/core/src/svc.rs b/linkerd/app/core/src/svc.rs index e7d20111b5..fa069032c9 100644 --- a/linkerd/app/core/src/svc.rs +++ b/linkerd/app/core/src/svc.rs @@ -92,8 +92,8 @@ impl Layers { .push(BufferLayer::new(capacity)) } - pub fn push_on_response(self, layer: U) -> Layers>> { - self.push(stack::OnResponseLayer::new(layer)) + pub fn push_on_service(self, layer: U) -> Layers>> { + self.push(stack::OnServiceLayer::new(layer)) } pub fn push_instrument(self, get_span: G) -> Layers>> { @@ -171,8 +171,8 @@ impl Stack { /// Assuming `S` implements `NewService` or `MakeService`, applies the given /// `L`-typed layer on each service produced by `S`. - pub fn push_on_response(self, layer: L) -> Stack> { - self.push(stack::OnResponseLayer::new(layer)) + pub fn push_on_service(self, layer: L) -> Stack> { + self.push(stack::OnServiceLayer::new(layer)) } pub fn push_timeout(self, timeout: Duration) -> Stack> { diff --git a/linkerd/app/gateway/src/lib.rs b/linkerd/app/gateway/src/lib.rs index 956303e0e9..c6faed520b 100644 --- a/linkerd/app/gateway/src/lib.rs +++ b/linkerd/app/gateway/src/lib.rs @@ -159,7 +159,7 @@ where } } })) - .push_on_response( + .push_on_service( svc::layers() .push( inbound @@ -195,7 +195,7 @@ where } })) .instrument(|h: &HttpTarget| debug_span!("gateway", target = %h.target, v = %h.version)) - .push_on_response( + .push_on_service( svc::layers() .push( inbound @@ -209,7 +209,7 @@ where .push_spawn_buffer(buffer_capacity), ) .push_cache(cache_max_idle_age) - .push_on_response( + .push_on_service( svc::layers() .push(http::Retain::layer()) .push(http::BoxResponse::layer()), @@ -247,7 +247,7 @@ where ) .push_http_server() .into_stack() - .push_on_response(svc::BoxService::layer()) + .push_on_service(svc::BoxService::layer()) .push(svc::BoxNewService::layer()) .push_switch( |GatewayTransportHeader { @@ -266,7 +266,7 @@ where })), None => Ok::<_, Infallible>(svc::Either::B(target)), }, - tcp.push_on_response(svc::BoxService::layer()) + tcp.push_on_service(svc::BoxService::layer()) .push(svc::BoxNewService::layer()) .into_inner(), ) @@ -277,7 +277,7 @@ where }, legacy_http.into_inner(), ) - .push_on_response(svc::BoxService::layer()) + .push_on_service(svc::BoxService::layer()) .push(svc::BoxNewService::layer()) .into_inner() } diff --git a/linkerd/app/inbound/src/accept.rs b/linkerd/app/inbound/src/accept.rs index 570efcca9b..615ec59e41 100644 --- a/linkerd/app/inbound/src/accept.rs +++ b/linkerd/app/inbound/src/accept.rs @@ -71,7 +71,7 @@ impl Inbound { let OrigDstAddr(addr) = t.param(); info_span!("server", port = addr.port()) }) - .push_on_response(svc::BoxService::layer()) + .push_on_service(svc::BoxService::layer()) .push(svc::BoxNewService::layer()) }) } diff --git a/linkerd/app/inbound/src/detect.rs b/linkerd/app/inbound/src/detect.rs index dc5a708966..e37a8603e5 100644 --- a/linkerd/app/inbound/src/detect.rs +++ b/linkerd/app/inbound/src/detect.rs @@ -131,7 +131,7 @@ impl Inbound { })) }, svc::stack(forward.clone()) - .push_on_response(svc::MapTargetLayer::new(io::BoxedIo::new)) + .push_on_service(svc::MapTargetLayer::new(io::BoxedIo::new)) .into_inner(), ) .push(tls::NewDetectTls::layer(TlsParams { @@ -150,10 +150,10 @@ impl Inbound { Ok(svc::Either::A(t)) }, svc::stack(forward) - .push_on_response(svc::MapTargetLayer::new(io::BoxedIo::new)) + .push_on_service(svc::MapTargetLayer::new(io::BoxedIo::new)) .into_inner(), ) - .push_on_response(svc::BoxService::layer()) + .push_on_service(svc::BoxService::layer()) .push(svc::BoxNewService::layer()) }) } @@ -180,7 +180,7 @@ impl Inbound { let detect = http .clone() - .push_on_response(svc::MapTargetLayer::new(io::BoxedIo::new)) + .push_on_service(svc::MapTargetLayer::new(io::BoxedIo::new)) .push(transport::metrics::NewServer::layer( rt.metrics.transport.clone(), )) @@ -209,7 +209,7 @@ impl Inbound { } }, svc::stack(forward) - .push_on_response(svc::MapTargetLayer::new(io::BoxedIo::new)) + .push_on_service(svc::MapTargetLayer::new(io::BoxedIo::new)) .push(transport::metrics::NewServer::layer( rt.metrics.transport.clone(), )) @@ -220,7 +220,7 @@ impl Inbound { .push(detect::NewDetectService::layer(ConfigureHttpDetect)) .check_new_service::(); - http.push_on_response(svc::MapTargetLayer::new(io::BoxedIo::new)) + http.push_on_service(svc::MapTargetLayer::new(io::BoxedIo::new)) .push(transport::metrics::NewServer::layer( rt.metrics.transport.clone(), )) @@ -248,7 +248,7 @@ impl Inbound { }, detect.into_inner(), ) - .push_on_response(svc::BoxService::layer()) + .push_on_service(svc::BoxService::layer()) .push(svc::BoxNewService::layer()) .check_new_service::() }) diff --git a/linkerd/app/inbound/src/direct.rs b/linkerd/app/inbound/src/direct.rs index cb5539c336..2ded34c881 100644 --- a/linkerd/app/inbound/src/direct.rs +++ b/linkerd/app/inbound/src/direct.rs @@ -182,7 +182,7 @@ impl Inbound { // HTTP detection is not necessary in this case, since the transport // header indicates the connection's HTTP version. svc::stack(gateway.clone()) - .push_on_response(svc::MapTargetLayer::new(io::EitherIo::Left)) + .push_on_service(svc::MapTargetLayer::new(io::EitherIo::Left)) .push_map_target(GatewayConnection::TransportHeader) .push(transport::metrics::NewServer::layer( rt.metrics.transport.clone(), @@ -221,7 +221,7 @@ impl Inbound { // with transport header support. svc::stack(gateway) .push_map_target(GatewayConnection::Legacy) - .push_on_response(svc::MapTargetLayer::new(io::EitherIo::Right)) + .push_on_service(svc::MapTargetLayer::new(io::EitherIo::Right)) .push(transport::metrics::NewServer::layer( rt.metrics.transport.clone(), )) @@ -239,7 +239,7 @@ impl Inbound { identity: rt.identity.clone().map(WithTransportHeaderAlpn), })) .check_new_service::() - .push_on_response(svc::BoxService::layer()) + .push_on_service(svc::BoxService::layer()) .push(svc::BoxNewService::layer()) }) } diff --git a/linkerd/app/inbound/src/http/router.rs b/linkerd/app/inbound/src/http/router.rs index 59c366aadc..814b9d11bb 100644 --- a/linkerd/app/inbound/src/http/router.rs +++ b/linkerd/app/inbound/src/http/router.rs @@ -90,7 +90,7 @@ impl Inbound { config.proxy.connect.h1_settings, config.proxy.connect.h2_settings, )) - .push_on_response(svc::MapErrLayer::new(Into::into)) + .push_on_service(svc::MapErrLayer::new(Into::into)) .into_new_service() .push_new_reconnect(config.proxy.connect.backoff) .check_new_service::>() @@ -103,11 +103,11 @@ impl Inbound { .http_endpoint .to_layer::(), ) - .push_on_response(http_tracing::client( + .push_on_service(http_tracing::client( rt.span_sink.clone(), super::trace_labels(), )) - .push_on_response(http::BoxResponse::layer()) + .push_on_service(http::BoxResponse::layer()) .check_new_service::>(); // Attempts to discover a service profile for each logical target (as @@ -117,10 +117,10 @@ impl Inbound { .check_new_service::>() // The HTTP stack doesn't use the profile resolution, so drop it. .push_map_target(Logical::from) - .push_on_response(http::BoxResponse::layer()) + .push_on_service(http::BoxResponse::layer()) .push(profiles::http::route_request::layer( svc::proxies() - .push_on_response(http::BoxRequest::layer()) + .push_on_service(http::BoxRequest::layer()) // Records per-route metrics. .push( rt.metrics @@ -140,7 +140,7 @@ impl Inbound { direction: metrics::Direction::In, } }) - .push_on_response(http::BoxResponse::layer()) + .push_on_service(http::BoxResponse::layer()) .into_inner(), )) .push_switch( @@ -160,7 +160,7 @@ impl Inbound { Ok(svc::Either::B(logical)) }, http.clone() - .push_on_response(http::BoxResponse::layer()) + .push_on_service(http::BoxResponse::layer()) .check_new_service::>() .into_inner(), ) @@ -182,7 +182,7 @@ impl Inbound { Ok(profiles::LookupAddr(addr.into())) })) .instrument(|_: &Logical| debug_span!("profile")) - .push_on_response( + .push_on_service( svc::layers() .push(http::BoxResponse::layer()) .push(svc::layer::mk(svc::SpawnReady::new)), @@ -191,11 +191,11 @@ impl Inbound { .push_when_unready( config.profile_idle_timeout, http.clone() - .push_on_response(svc::layer::mk(svc::SpawnReady::new)) + .push_on_service(svc::layer::mk(svc::SpawnReady::new)) .into_inner(), ) .check_new_service::>() - .push_on_response( + .push_on_service( svc::layers() .push(rt.metrics.stack.layer(stack_labels("http", "logical"))) .push(svc::FailFast::layer( @@ -205,7 +205,7 @@ impl Inbound { .push_spawn_buffer(config.proxy.buffer_capacity), ) .push_cache(config.proxy.cache_max_idle_age) - .push_on_response( + .push_on_service( svc::layers() .push(http::Retain::layer()) .push(http::BoxResponse::layer()), diff --git a/linkerd/app/inbound/src/http/server.rs b/linkerd/app/inbound/src/http/server.rs index 58730f5ea7..a236b04a74 100644 --- a/linkerd/app/inbound/src/http/server.rs +++ b/linkerd/app/inbound/src/http/server.rs @@ -44,7 +44,7 @@ impl Inbound { // the request may have been downgraded from a HTTP/2 orig-proto request. .push(http::NewNormalizeUri::layer()) .push(NewSetIdentityHeader::layer()) - .push_on_response( + .push_on_service( svc::layers() // Downgrades the protocol if upgraded by an outbound proxy. .push(http::orig_proto::Downgrade::layer()) @@ -71,7 +71,7 @@ impl Inbound { .check_new_service::>() .instrument(|t: &T| debug_span!("http", v = %Param::::param(t))) .push(http::NewServeHttp::layer(h2_settings, rt.drain.clone())) - .push_on_response(svc::BoxService::layer()) + .push_on_service(svc::BoxService::layer()) .push(svc::BoxNewService::layer()) }) } diff --git a/linkerd/app/inbound/src/lib.rs b/linkerd/app/inbound/src/lib.rs index 9f29e6fa4d..b5fd3976b8 100644 --- a/linkerd/app/inbound/src/lib.rs +++ b/linkerd/app/inbound/src/lib.rs @@ -166,7 +166,7 @@ impl Inbound { rt.metrics.transport.clone(), )) .push_make_thunk() - .push_on_response( + .push_on_service( svc::layers() .push(tcp::Forward::layer()) .push(drain::Retain::layer(rt.drain.clone())), diff --git a/linkerd/app/outbound/src/discover.rs b/linkerd/app/outbound/src/discover.rs index df4c8acc8a..ecda3f8cb5 100644 --- a/linkerd/app/outbound/src/discover.rs +++ b/linkerd/app/outbound/src/discover.rs @@ -58,7 +58,7 @@ impl Outbound { }, )) .instrument(|_: &_| debug_span!("profile")) - .push_on_response( + .push_on_service( svc::layers() // If the traffic split is empty/unavailable, eagerly fail // requests. When the split is in failfast, spawn the diff --git a/linkerd/app/outbound/src/http/detect.rs b/linkerd/app/outbound/src/http/detect.rs index 54daa61b0d..67946251a2 100644 --- a/linkerd/app/outbound/src/http/detect.rs +++ b/linkerd/app/outbound/src/http/detect.rs @@ -33,11 +33,11 @@ impl Outbound { let skipped = tcp .clone() - .push_on_response(svc::MapTargetLayer::new(io::EitherIo::Left)) + .push_on_service(svc::MapTargetLayer::new(io::EitherIo::Left)) .into_inner(); svc::stack(http) - .push_on_response( + .push_on_service( svc::layers() .push(http::BoxRequest::layer()) .push(svc::MapErrLayer::new(Into::into)), @@ -47,10 +47,10 @@ impl Outbound { .push_map_target(U::from) .instrument(|(v, _): &(http::Version, _)| debug_span!("http", %v)) .push(svc::UnwrapOr::layer( - tcp.push_on_response(svc::MapTargetLayer::new(io::EitherIo::Right)) + tcp.push_on_service(svc::MapTargetLayer::new(io::EitherIo::Right)) .into_inner(), )) - .push_on_response(svc::BoxService::layer()) + .push_on_service(svc::BoxService::layer()) .check_new_service::<(Option, T), _>() .push_map_target(detect::allow_timeout) .push(svc::BoxNewService::layer()) @@ -67,7 +67,7 @@ impl Outbound { skipped, ) .check_new_service::() - .push_on_response(svc::BoxService::layer()) + .push_on_service(svc::BoxService::layer()) .push(svc::BoxNewService::layer()) }) } diff --git a/linkerd/app/outbound/src/http/endpoint.rs b/linkerd/app/outbound/src/http/endpoint.rs index d705bb500c..bd7ba4772a 100644 --- a/linkerd/app/outbound/src/http/endpoint.rs +++ b/linkerd/app/outbound/src/http/endpoint.rs @@ -36,7 +36,7 @@ impl Outbound { // HTTP/1.x fallback is supported as needed. connect .push(http::client::layer(h1_settings, h2_settings)) - .push_on_response(svc::MapErrLayer::new(Into::::into)) + .push_on_service(svc::MapErrLayer::new(Into::::into)) .check_service::() .into_new_service() .push_new_reconnect(backoff) @@ -46,7 +46,7 @@ impl Outbound { .http_endpoint .to_layer::(), ) - .push_on_response(http_tracing::client( + .push_on_service(http_tracing::client( rt.span_sink.clone(), crate::trace_labels(), )) @@ -55,7 +55,7 @@ impl Outbound { "host", CANONICAL_DST_HEADER, ])) - .push_on_response( + .push_on_service( svc::layers() .push(http::BoxResponse::layer()) .push(svc::BoxService::layer()), diff --git a/linkerd/app/outbound/src/http/logical.rs b/linkerd/app/outbound/src/http/logical.rs index 3d54502b83..17c5ac238a 100644 --- a/linkerd/app/outbound/src/http/logical.rs +++ b/linkerd/app/outbound/src/http/logical.rs @@ -59,7 +59,7 @@ impl Outbound { endpoint .clone() .check_new_service::>() - .push_on_response( + .push_on_service( svc::layers() .push(http::BoxRequest::layer()) .push( @@ -78,7 +78,7 @@ impl Outbound { // When the balancer is in failfast, spawn the service in a background // task so it becomes ready without new requests. .push(resolve::layer(resolve, watchdog)) - .push_on_response( + .push_on_service( svc::layers() .push(http::balance::layer( crate::EWMA_DEFAULT_RTT, @@ -107,7 +107,7 @@ impl Outbound { // task so it becomes ready without new requests. .check_new_service::<(ConcreteAddr, Logical), _>() .push(profiles::split::layer()) - .push_on_response( + .push_on_service( svc::layers() .push(svc::layer::mk(svc::SpawnReady::new)) .push(rt.metrics.stack.layer(stack_labels("http", "logical"))) @@ -115,11 +115,11 @@ impl Outbound { .push_spawn_buffer(buffer_capacity), ) .push_cache(cache_max_idle_age) - .push_on_response(http::BoxResponse::layer()) + .push_on_service(http::BoxResponse::layer()) // Note: routes can't exert backpressure. .push(profiles::http::route_request::layer( svc::proxies() - .push_on_response(http::BoxRequest::layer()) + .push_on_service(http::BoxRequest::layer()) .push( rt.metrics .http_route_actual @@ -130,7 +130,7 @@ impl Outbound { // any `Body` type into `BoxBody` so that the rest of the // stack doesn't have to implement `Service` for requests // with both body types. - .push_on_response(http::BoxRequest::erased()) + .push_on_service(http::BoxRequest::erased()) // Sets an optional retry policy. .push(retry::layer(rt.metrics.http_route_retry.clone())) // Sets an optional request timeout. @@ -141,17 +141,17 @@ impl Outbound { // extension. .push(classify::NewClassify::layer()) .push_map_target(Logical::mk_route) - .push_on_response(http::BoxResponse::layer()) + .push_on_service(http::BoxResponse::layer()) .into_inner(), )) - .push_on_response(http::BoxRequest::layer()) + .push_on_service(http::BoxRequest::layer()) // Strips headers that may be set by this proxy and add an outbound // canonical-dst-header. The response body is boxed unify the profile // stack's response type with that of to endpoint stack. .push(http::NewHeaderFromTarget::::layer()) - .push_on_response(svc::layers().push(http::BoxResponse::layer())) + .push_on_service(http::BoxResponse::layer()) .instrument(|l: &Logical| debug_span!("logical", dst = %l.logical_addr)) - .push_on_response(svc::BoxService::layer()) + .push_on_service(svc::BoxService::layer()) .push(svc::BoxNewService::layer()) }) } diff --git a/linkerd/app/outbound/src/http/server.rs b/linkerd/app/outbound/src/http/server.rs index 0efd7f4c9c..ec369ad4a2 100644 --- a/linkerd/app/outbound/src/http/server.rs +++ b/linkerd/app/outbound/src/http/server.rs @@ -33,7 +33,7 @@ impl Outbound { } = config.proxy; http.check_new_service::() - .push_on_response( + .push_on_service( svc::layers() .push(http::BoxRequest::layer()) // Limit the number of in-flight requests. When the proxy is @@ -58,7 +58,7 @@ impl Outbound { // `Client`. .push(http::NewNormalizeUri::layer()) // Record when a HTTP/1 URI originated in absolute form - .push_on_response(http::normalize_uri::MarkAbsoluteForm::layer()) + .push_on_service(http::normalize_uri::MarkAbsoluteForm::layer()) .check_new_service::>() .push(svc::BoxNewService::layer()) }) diff --git a/linkerd/app/outbound/src/ingress.rs b/linkerd/app/outbound/src/ingress.rs index d1600740b7..d93084f65a 100644 --- a/linkerd/app/outbound/src/ingress.rs +++ b/linkerd/app/outbound/src/ingress.rs @@ -128,7 +128,7 @@ impl Outbound> { // fail-fast is instrumented in case it becomes unavailable. When this service is in // fail-fast, ensure that we drive the inner service to readiness even if new requests // aren't received. - .push_on_response( + .push_on_service( svc::layers() .push(rt.metrics.stack.layer(stack_labels("http", "logical"))) .push(svc::layer::mk(svc::SpawnReady::new)) @@ -136,7 +136,7 @@ impl Outbound> { .push_spawn_buffer(buffer_capacity), ) .push_cache(cache_max_idle_age) - .push_on_response( + .push_on_service( svc::layers() .push(http::strip_header::request::layer(DST_OVERRIDE_HEADER)) .push(http::Retain::layer()) @@ -163,7 +163,7 @@ impl Outbound> { })), }, http_endpoint - .push_on_response( + .push_on_service( svc::layers() .push(svc::layer::mk(svc::SpawnReady::new)) .push(svc::FailFast::layer("Ingress server", dispatch_timeout)), @@ -196,7 +196,7 @@ impl Outbound> { }, )) .push(http::NewNormalizeUri::layer()) - .push_on_response( + .push_on_service( svc::layers() .push(http::MarkAbsoluteForm::layer()) // The concurrency-limit can force the service into fail-fast, but it need not @@ -229,7 +229,7 @@ impl Outbound> { tcp::Accept::from(orig_dst) }) .push(rt.metrics.tcp_accept_errors.layer()) - .push_on_response(svc::BoxService::layer()) + .push_on_service(svc::BoxService::layer()) .push(svc::BoxNewService::layer()) .check_new_service::() .into_inner() diff --git a/linkerd/app/outbound/src/switch_logical.rs b/linkerd/app/outbound/src/switch_logical.rs index 5c67624951..0d5f248778 100644 --- a/linkerd/app/outbound/src/switch_logical.rs +++ b/linkerd/app/outbound/src/switch_logical.rs @@ -60,7 +60,7 @@ impl Outbound { }, logical, ) - .push_on_response(svc::BoxService::layer()) + .push_on_service(svc::BoxService::layer()) .push(svc::BoxNewService::layer()) }) } diff --git a/linkerd/app/outbound/src/tcp/connect.rs b/linkerd/app/outbound/src/tcp/connect.rs index 7d1ae868e9..6f38258400 100644 --- a/linkerd/app/outbound/src/tcp/connect.rs +++ b/linkerd/app/outbound/src/tcp/connect.rs @@ -92,7 +92,7 @@ impl Outbound { { self.map_stack(|_, _, conn| { conn.push_make_thunk() - .push_on_response(super::Forward::layer()) + .push_on_service(super::Forward::layer()) .instrument(|_: &_| debug_span!("tcp.forward")) .push(svc::BoxNewService::layer()) .check_new_service::() diff --git a/linkerd/app/outbound/src/tcp/logical.rs b/linkerd/app/outbound/src/tcp/logical.rs index 0f464d6d93..e5906f733a 100644 --- a/linkerd/app/outbound/src/tcp/logical.rs +++ b/linkerd/app/outbound/src/tcp/logical.rs @@ -75,7 +75,7 @@ where } }) .push(resolve::layer(resolve, config.proxy.cache_max_idle_age * 2)) - .push_on_response( + .push_on_service( svc::layers() .push(tcp::balance::layer( crate::EWMA_DEFAULT_RTT, @@ -94,7 +94,7 @@ where .push(svc::BoxNewService::layer()) .check_new_service::<(ConcreteAddr, Logical), I>() .push(profiles::split::layer()) - .push_on_response( + .push_on_service( svc::layers() .push( rt.metrics diff --git a/linkerd/stack/src/lib.rs b/linkerd/stack/src/lib.rs index dd73abd216..f6d367c09e 100644 --- a/linkerd/stack/src/lib.rs +++ b/linkerd/stack/src/lib.rs @@ -14,7 +14,7 @@ pub mod layer; mod make_thunk; mod map_target; pub mod new_service; -mod on_response; +mod on_service; mod proxy; mod result; mod router; @@ -32,7 +32,7 @@ pub use self::{ make_thunk::MakeThunk, map_target::{MapTarget, MapTargetLayer, MapTargetService}, new_service::NewService, - on_response::{OnResponse, OnResponseLayer}, + on_service::{OnService, OnServiceLayer}, proxy::{Proxy, ProxyService}, result::ResultService, router::{NewRouter, RecognizeRoute}, diff --git a/linkerd/stack/src/on_response.rs b/linkerd/stack/src/on_service.rs similarity index 78% rename from linkerd/stack/src/on_response.rs rename to linkerd/stack/src/on_service.rs index 282697cc3d..8e73b6d44a 100644 --- a/linkerd/stack/src/on_response.rs +++ b/linkerd/stack/src/on_service.rs @@ -11,25 +11,25 @@ use std::{ /// Layers over services such that an `L`-typed Layer is applied to the result /// of the inner Service or NewService. #[derive(Clone, Debug)] -pub struct OnResponseLayer(L); +pub struct OnServiceLayer(L); /// Applies `L`-typed layers to the responses of an `S`-typed service. #[pin_project] #[derive(Clone, Debug)] -pub struct OnResponse { +pub struct OnService { #[pin] inner: S, layer: L, } -impl OnResponseLayer { - pub fn new(layer: L) -> OnResponseLayer { - OnResponseLayer(layer) +impl OnServiceLayer { + pub fn new(layer: L) -> OnServiceLayer { + OnServiceLayer(layer) } } -impl tower::layer::Layer for OnResponseLayer { - type Service = OnResponse; +impl tower::layer::Layer for OnServiceLayer { + type Service = OnService; fn layer(&self, inner: M) -> Self::Service { Self::Service { @@ -39,7 +39,7 @@ impl tower::layer::Layer for OnResponseLayer { } } -impl super::NewService for OnResponse +impl super::NewService for OnService where L: tower::layer::Layer, M: super::NewService, @@ -51,14 +51,14 @@ where } } -impl tower::Service for OnResponse +impl tower::Service for OnService where L: tower::layer::Layer + Clone, M: tower::Service, { type Response = L::Service; type Error = M::Error; - type Future = OnResponse; + type Future = OnService; fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> { self.inner.poll_ready(cx) @@ -73,7 +73,7 @@ where } } -impl Future for OnResponse +impl Future for OnService where L: tower::layer::Layer, F: TryFuture,