pub struct GatewayRouter { /* private fields */ }Expand description
Selects the most specific route and distributes requests across its upstreams.
Implementations§
Source§impl GatewayRouter
impl GatewayRouter
pub fn new( routes: impl IntoIterator<Item = GatewayRoute>, ) -> Result<Self, GatewayError>
Sourcepub fn select(&self, path: &str) -> Option<&str>
pub fn select(&self, path: &str) -> Option<&str>
Selects an upstream for a request path, using round robin within its matched route.
Sourcepub fn select_target(&self, path_and_query: &str) -> Option<String>
pub fn select_target(&self, path_and_query: &str) -> Option<String>
Builds the full upstream URL for a path and optional query string.
Sourcepub fn set_upstream_health(
&self,
prefix: &str,
upstream: &str,
healthy: bool,
) -> Result<(), GatewayError>
pub fn set_upstream_health( &self, prefix: &str, upstream: &str, healthy: bool, ) -> Result<(), GatewayError>
Includes or excludes an upstream from selection, for use by active health checks.
Auto Trait Implementations§
impl Freeze for GatewayRouter
impl RefUnwindSafe for GatewayRouter
impl Send for GatewayRouter
impl Sync for GatewayRouter
impl Unpin for GatewayRouter
impl UnsafeUnpin for GatewayRouter
impl UnwindSafe for GatewayRouter
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
Mutably borrows from an owned value. Read more
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>
Wrap the input message
T in a tonic::Request