pub struct H2Channel { /* private fields */ }Expand description
A gRPC transport that drives a hyper HTTP/2 connection directly.
We run the h2 handshake on the already-dialed (TLS or plaintext) IO
ourselves and tokio::spawn the connection driver, rather than routing
through tonic’s Channel (whose buffer/reconnect tower layers add no
value for a single pinned provider socket). call also (a) injects the
:scheme/:authority pseudo-headers tonic’s own Channel would add and
(b) collects the unary body into one self-terminating Full frame.
SendRequest is a cheap clonable handle; cloning shares the one spawned
connection. The generated ProviderClient<H2Channel> consumes this via
the GrpcService blanket impl over tower::Service.
Implementations§
Source§impl H2Channel
impl H2Channel
Sourcepub fn close_reason(&self) -> Option<String>
pub fn close_reason(&self) -> Option<String>
The reason the underlying h2 connection closed, if it has. None
while the connection is healthy. Lets the apply engine surface the
true cause (e.g. “peer closed connection without sending TLS
close_notify” = mTLS rejection) instead of a generic channel error.
Trait Implementations§
Source§impl Service<Request<Body>> for H2Channel
impl Service<Request<Body>> for H2Channel
Source§type Future = Pin<Box<dyn Future<Output = Result<<H2Channel as Service<Request<Body>>>::Response, <H2Channel as Service<Request<Body>>>::Error>> + Send>>
type Future = Pin<Box<dyn Future<Output = Result<<H2Channel as Service<Request<Body>>>::Response, <H2Channel as Service<Request<Body>>>::Error>> + Send>>
Auto Trait Implementations§
impl !RefUnwindSafe for H2Channel
impl !UnwindSafe for H2Channel
impl Freeze for H2Channel
impl Send for H2Channel
impl Sync for H2Channel
impl Unpin for H2Channel
impl UnsafeUnpin for H2Channel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, ReqBody, ResBody> GrpcService<ReqBody> for T
impl<T, ReqBody, ResBody> GrpcService<ReqBody> for T
Source§type ResponseBody = ResBody
type ResponseBody = ResBody
Source§fn poll_ready(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), <T as GrpcService<ReqBody>>::Error>>
fn poll_ready( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(), <T as GrpcService<ReqBody>>::Error>>
Ready when the service is able to process requests. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<S, R> ServiceExt<R> for Swhere
S: Service<R>,
impl<S, R> ServiceExt<R> for Swhere
S: Service<R>,
Source§fn into_make_service(self) -> IntoMakeService<S>
fn into_make_service(self) -> IntoMakeService<S>
MakeService, that is a Service whose
response is another service. Read moreSource§fn handle_error<F, T>(self, f: F) -> HandleError<Self, F, T>
fn handle_error<F, T>(self, f: F) -> HandleError<Self, F, T>
HandleError, that will handle errors
by converting them into responses. Read moreSource§impl<T, Request> ServiceExt<Request> for T
impl<T, Request> ServiceExt<Request> for T
Source§fn ready(&mut self) -> Ready<'_, Self, Request> ⓘwhere
Self: Sized,
fn ready(&mut self) -> Ready<'_, Self, Request> ⓘwhere
Self: Sized,
Source§fn ready_oneshot(self) -> ReadyOneshot<Self, Request> ⓘwhere
Self: Sized,
fn ready_oneshot(self) -> ReadyOneshot<Self, Request> ⓘwhere
Self: Sized,
Source§fn oneshot(self, req: Request) -> Oneshot<Self, Request> ⓘwhere
Self: Sized,
fn oneshot(self, req: Request) -> Oneshot<Self, Request> ⓘwhere
Self: Sized,
Service, calling it with the provided request once it is ready.Source§fn and_then<F>(self, f: F) -> AndThen<Self, F>
fn and_then<F>(self, f: F) -> AndThen<Self, F>
poll_ready method. Read moreSource§fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
poll_ready method. Read moreSource§fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
poll_ready method. Read moreSource§fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
Result<Self::Response, Self::Error>)
to a different value, regardless of whether the future succeeds or
fails. Read more