pub enum RoutingStrategy {
Single,
Fallback,
LoadBalance {
weights: Vec<f32>,
},
Conditional {
rules: Vec<RoutingRule>,
},
ABTesting {
split: f32,
},
RoundRobin,
LeastUsed,
LowestLatency,
}
Expand description
Routing strategies for provider selection.
This enum defines the different strategies that can be used to select which provider should handle a particular request.
§Examples
use ultrafast_models_sdk::routing::RoutingStrategy;
// Single provider strategy
let single = RoutingStrategy::Single;
// Load balancing with weights
let load_balance = RoutingStrategy::LoadBalance {
weights: vec![0.6, 0.4],
};
// Conditional routing with rules
let conditional = RoutingStrategy::Conditional {
rules: vec![/* routing rules */],
};
Variants§
Single
Route all requests to a single provider
Fallback
Use primary provider with automatic fallback
LoadBalance
Distribute requests across providers with weights
Conditional
Route based on specific conditions and rules
Fields
§
rules: Vec<RoutingRule>
ABTesting
A/B testing with configurable split
RoundRobin
Cycle through providers in order
LeastUsed
Route to provider with lowest request count
LowestLatency
Route to provider with lowest average latency
Trait Implementations§
Source§impl Clone for RoutingStrategy
impl Clone for RoutingStrategy
Source§fn clone(&self) -> RoutingStrategy
fn clone(&self) -> RoutingStrategy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for RoutingStrategy
impl Debug for RoutingStrategy
Source§impl<'de> Deserialize<'de> for RoutingStrategy
impl<'de> Deserialize<'de> for RoutingStrategy
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for RoutingStrategy
impl RefUnwindSafe for RoutingStrategy
impl Send for RoutingStrategy
impl Sync for RoutingStrategy
impl Unpin for RoutingStrategy
impl UnwindSafe for RoutingStrategy
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