pub enum LoadBalancingStrategy {
RoundRobin,
LeastConnections,
Weighted(HashMap<WorkerId, u32>),
Random,
}Expand description
Load balancing strategy
§Examples
use reinhardt_tasks::{LoadBalancingStrategy};
use std::collections::HashMap;
// Round-robin strategy
let strategy = LoadBalancingStrategy::RoundRobin;
// Weighted strategy
let mut weights = HashMap::new();
weights.insert("worker-1".to_string(), 2);
weights.insert("worker-2".to_string(), 1);
let strategy = LoadBalancingStrategy::Weighted(weights);Variants§
RoundRobin
Round-robin distribution
LeastConnections
Least connections - select worker with fewest active tasks
Weighted(HashMap<WorkerId, u32>)
Weighted distribution - workers with higher weights receive more tasks
Random
Random distribution
Trait Implementations§
Source§impl Clone for LoadBalancingStrategy
impl Clone for LoadBalancingStrategy
Source§fn clone(&self) -> LoadBalancingStrategy
fn clone(&self) -> LoadBalancingStrategy
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 moreAuto Trait Implementations§
impl Freeze for LoadBalancingStrategy
impl RefUnwindSafe for LoadBalancingStrategy
impl Send for LoadBalancingStrategy
impl Sync for LoadBalancingStrategy
impl Unpin for LoadBalancingStrategy
impl UnsafeUnpin for LoadBalancingStrategy
impl UnwindSafe for LoadBalancingStrategy
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