pub struct LatencyPolicy {
pub weight: f64,
pub max_latency: Duration,
}Expand description
Latency-based routing policy
Scores nodes inversely proportional to their latency. Lower latency = higher score.
Fields§
§weight: f64Weight for this policy in composite scoring
max_latency: DurationMaximum acceptable latency (nodes above this get score 0)
Trait Implementations§
Source§impl Default for LatencyPolicy
impl Default for LatencyPolicy
Source§impl RoutingPolicyTrait for LatencyPolicy
impl RoutingPolicyTrait for LatencyPolicy
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 LatencyPolicy
impl RefUnwindSafe for LatencyPolicy
impl Send for LatencyPolicy
impl Sync for LatencyPolicy
impl Unpin for LatencyPolicy
impl UnwindSafe for LatencyPolicy
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> 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