pub struct ServiceSplit { /* private fields */ }Expand description
The compiled weighted split of one service (DW-040): built per config generation by the upstream registry, held by the dataplane dispatch path. Immutable once built; the pick is stateless.
Implementations§
Source§impl ServiceSplit
impl ServiceSplit
Sourcepub fn new(targets: &[(Arc<UpstreamHandle>, u64)]) -> Self
pub fn new(targets: &[(Arc<UpstreamHandle>, u64)]) -> Self
Compile from validated config targets plus the registry’s handles. Targets with weight 0 are kept (their handles exist, their slots are empty — the parked side of a blue-green pair), preserving index stability across weight flips.
Sourcepub fn total_weight(&self) -> u64
pub fn total_weight(&self) -> u64
The total weight (0 only for an unvalidated empty split).
Sourcepub fn pick(&self, key: &str) -> &Arc<UpstreamHandle>
pub fn pick(&self, key: &str) -> &Arc<UpstreamHandle>
Pick the target upstream for one dispatch by the deterministic
weighted hash of key (the sticky cookie value or the request
id — see the module docs). The handle is the branch; its own
balancer (and the hash key threaded to it) picks the endpoint.
Sourcepub fn pick_with_index(&self, key: &str) -> (&Arc<UpstreamHandle>, usize)
pub fn pick_with_index(&self, key: &str) -> (&Arc<UpstreamHandle>, usize)
DW-091: pick the target upstream AND its index (0 = baseline,
1 = canary for a 2-target canary split). The auto-canary
controller needs the index to record the outcome on the
correct side. Same hash as Self::pick.
Auto Trait Implementations§
impl Freeze for ServiceSplit
impl !RefUnwindSafe for ServiceSplit
impl Send for ServiceSplit
impl Sync for ServiceSplit
impl Unpin for ServiceSplit
impl !UnwindSafe for ServiceSplit
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
§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