pub enum Backend {
InProcess(Routes),
Upstream(Channel),
}Expand description
Where a translated gRPC request is dispatched.
Variants§
InProcess(Routes)
In-process: call the local tonic Routes (wrap a service you own).
Upstream(Channel)
Upstream: forward to a remote gRPC server over an HTTP/2 Channel (proxy mode).
Implementations§
Source§impl Backend
impl Backend
Sourcepub async fn call(
&self,
req: Request<TonicBody>,
) -> Result<Response<ResBody>, BoxError>
pub async fn call( &self, req: Request<TonicBody>, ) -> Result<Response<ResBody>, BoxError>
Dispatch a gRPC-framed HTTP request and return the HTTP response. The two backends’
response bodies differ in type; both are boxed into one ResBody here, so every
caller downstream is monomorphic. InProcess is infallible (its Service::Error
is Infallible); Upstream surfaces the transport error for the caller to map to a
gRPC status (UNAVAILABLE / BAD_GATEWAY).
Sourcepub fn is_upstream(&self) -> bool
pub fn is_upstream(&self) -> bool
Whether this backend forwards to a remote upstream (proxy mode). Used to pick
policies that only make sense across the network — enforcing the client deadline
locally, forwarding grpc-timeout with grace, capping concurrent streams.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Backend
impl !UnwindSafe for Backend
impl Freeze for Backend
impl Send for Backend
impl Sync for Backend
impl Unpin for Backend
impl UnsafeUnpin for Backend
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§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::Request