pub struct SgBackendRef<P = PluginInstanceId> {
pub host: BackendHost,
pub port: Option<u16>,
pub timeout_ms: Option<u32>,
pub protocol: Option<SgBackendProtocol>,
pub downgrade_http2: Option<bool>,
pub weight: Option<u16>,
pub plugins: Vec<P>,
}
Expand description
BackendRef defines how a HTTPRoute should forward an HTTP request.
Fields§
§host: BackendHost
§port: Option<u16>
Port specifies the destination port number to use for this resource.
timeout_ms: Option<u32>
Timeout specifies the timeout for requests forwarded to the referenced backend.
protocol: Option<SgBackendProtocol>
§downgrade_http2: Option<bool>
Downgrade HTTP2 connections, it is useful when the backend does not support HTTP2.
weight: Option<u16>
Weight specifies the proportion of requests forwarded to the referenced backend. This is computed as weight/(sum of all weights in this BackendRefs list). For non-zero values, there may be some epsilon from the exact proportion defined here depending on the precision an implementation supports. Weight is not a percentage and the sum of weights does not need to equal 100.
plugins: Vec<P>
plugins define the filters that are applied to backend that match this hostnames.
§Notice!
this field is ordered, the first plugin will be the outermost plugin.
Implementations§
Source§impl<P> SgBackendRef<P>
impl<P> SgBackendRef<P>
pub fn map_plugins<F, T>(self, f: F) -> SgBackendRef<T>where
F: FnMut(P) -> T,
pub fn get_host(&self) -> String
Trait Implementations§
Source§impl<P> Clone for SgBackendRef<P>where
P: Clone,
impl<P> Clone for SgBackendRef<P>where
P: Clone,
Source§fn clone(&self) -> SgBackendRef<P>
fn clone(&self) -> SgBackendRef<P>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<P> Debug for SgBackendRef<P>where
P: Debug,
impl<P> Debug for SgBackendRef<P>where
P: Debug,
Source§impl<P> Default for SgBackendRef<P>
impl<P> Default for SgBackendRef<P>
Source§fn default() -> SgBackendRef<P>
fn default() -> SgBackendRef<P>
Source§impl<'de, P> Deserialize<'de> for SgBackendRef<P>
impl<'de, P> Deserialize<'de> for SgBackendRef<P>
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SgBackendRef<P>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SgBackendRef<P>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl<P> Serialize for SgBackendRef<P>where
P: Serialize,
impl<P> Serialize for SgBackendRef<P>where
P: Serialize,
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl<P> Freeze for SgBackendRef<P>
impl<P> RefUnwindSafe for SgBackendRef<P>where
P: RefUnwindSafe,
impl<P> Send for SgBackendRef<P>where
P: Send,
impl<P> Sync for SgBackendRef<P>where
P: Sync,
impl<P> Unpin for SgBackendRef<P>where
P: Unpin,
impl<P> UnwindSafe for SgBackendRef<P>where
P: UnwindSafe,
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more