pub struct Service {
pub name: String,
pub upstream: Option<String>,
pub split: Option<ServiceSplit>,
pub sticky: Option<StickyAffinity>,
pub base_path: Option<String>,
pub version: Option<String>,
pub policies: Vec<String>,
pub authorization: Option<Authz>,
}Expand description
The logical API being exposed: base path, version, default policies; targets exactly one upstream, or a weighted split of upstreams since DW-040 (canary / blue-green).
Fields§
§name: String§upstream: Option<String>Name of the upstream this service targets. Exactly one of
upstream and Service::split must be set: a single-target
service names its pool here; a canary/blue-green service uses
split instead and leaves this unset. Optional since DW-040
(it was the only shape before).
split: Option<ServiceSplit>Weighted traffic split across upstreams (DW-040, canary and
blue-green): requests for this service are dispatched to one of
the named upstreams by a deterministic weighted pick (the
sticky cookie’s value when Service::sticky is configured
and the request carries one — sessions stay on their branch;
otherwise the request id — per-request distribution whose
ratios converge on the weights statistically). A weight of 0
parks an upstream in the split without serving traffic (the
blue-green switch: flip the weights and re-publish — the next
request dispatches by the new generation, no restart). Ramp
rule: change weights by RE-BALANCING (keep the total constant,
e.g. 95/5 -> 90/10) — growing one side alone changes the pick’s
modulus and reshuffles every session’s branch.
sticky: Option<StickyAffinity>Cookie affinity (DW-040): when set, the gateway sets a cookie
on responses for this service whose VALUE consistently selects
the split branch (and, when the branch upstream runs the
ip_hash balancer, the endpoint — the cookie value becomes the
ring key, reusing the consistent-hash machinery). The value is
an opaque affinity handle: not a secret, carrying no identity,
and never trusted as one.
base_path: Option<String>Base path prefix the API is served under (e.g. /v1).
version: Option<String>§policies: Vec<String>Service-level authorization rules (#123): applies to every request
whose route targets this service. Link of the frozen chain
consumer > route > service > listener > global (a deny at any
level wins; otherwise the most specific level with rules governs —
see Authz and the authz module). Same validation rules as
route-level authorization.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Service
impl<'de> Deserialize<'de> for Service
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for Service
impl JsonSchema for Service
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreimpl StructuralPartialEq for Service
Auto Trait Implementations§
impl Freeze for Service
impl RefUnwindSafe for Service
impl Send for Service
impl Sync for Service
impl Unpin for Service
impl UnwindSafe for Service
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Self to T,
useful only in generic context as a workaround for specializationSource§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,
§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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