pub struct LocalityPolicy {
pub weight: f64,
pub same_region_boost: f64,
pub cross_region_penalty: f64,
}Expand description
Locality-based routing policy
Prefers nodes in the same region as the request origin. Useful for data sovereignty and latency.
Fields§
§weight: f64Weight for this policy
same_region_boost: f64Score boost for same-region
cross_region_penalty: f64Score penalty for cross-region
Trait Implementations§
Source§impl Default for LocalityPolicy
impl Default for LocalityPolicy
Source§impl RoutingPolicyTrait for LocalityPolicy
impl RoutingPolicyTrait for LocalityPolicy
Source§fn score(&self, candidate: &RouteCandidate, _request: &InferenceRequest) -> f64
fn score(&self, candidate: &RouteCandidate, _request: &InferenceRequest) -> f64
Score a candidate node (higher = better)
Source§fn is_eligible(
&self,
_candidate: &RouteCandidate,
_request: &InferenceRequest,
) -> bool
fn is_eligible( &self, _candidate: &RouteCandidate, _request: &InferenceRequest, ) -> bool
Check if a candidate is eligible
Auto Trait Implementations§
impl Freeze for LocalityPolicy
impl RefUnwindSafe for LocalityPolicy
impl Send for LocalityPolicy
impl Sync for LocalityPolicy
impl Unpin for LocalityPolicy
impl UnwindSafe for LocalityPolicy
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> 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>
Converts
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>
Converts
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