pub struct LoadBalancingCoordinator {
pub worker_profiles: HashMap<usize, WorkerProfile>,
pub load_history: Vec<LoadBalanceSnapshot>,
pub config: LoadBalancingConfig,
pub current_strategy: LoadBalancingStrategy,
}Expand description
Advanced load balancing coordinator
Fields§
§worker_profiles: HashMap<usize, WorkerProfile>§load_history: Vec<LoadBalanceSnapshot>§config: LoadBalancingConfig§current_strategy: LoadBalancingStrategyImplementations§
Source§impl LoadBalancingCoordinator
impl LoadBalancingCoordinator
Sourcepub fn new(config: LoadBalancingConfig) -> Self
pub fn new(config: LoadBalancingConfig) -> Self
Create new load balancing coordinator
Sourcepub fn register_worker(&mut self, profile: WorkerProfile)
pub fn register_worker(&mut self, profile: WorkerProfile)
Register worker with performance profile
Sourcepub fn update_worker_profile(
&mut self,
worker_id: usize,
throughput: f64,
efficiency: f64,
latency_ms: f64,
) -> Result<()>
pub fn update_worker_profile( &mut self, worker_id: usize, throughput: f64, efficiency: f64, latency_ms: f64, ) -> Result<()>
Update worker profile with recent performance data
Sourcepub fn evaluate_balance(
&mut self,
current_assignments: &HashMap<usize, usize>,
datasize: usize,
) -> Result<LoadBalanceDecision>
pub fn evaluate_balance( &mut self, current_assignments: &HashMap<usize, usize>, datasize: usize, ) -> Result<LoadBalanceDecision>
Evaluate current load balance and decide if rebalancing is needed
Sourcepub fn set_strategy(&mut self, strategy: LoadBalancingStrategy)
pub fn set_strategy(&mut self, strategy: LoadBalancingStrategy)
Set load balancing strategy
Sourcepub fn get_load_history(&self) -> &[LoadBalanceSnapshot]
pub fn get_load_history(&self) -> &[LoadBalanceSnapshot]
Get load balancing history
Sourcepub fn get_worker_profiles(&self) -> &HashMap<usize, WorkerProfile>
pub fn get_worker_profiles(&self) -> &HashMap<usize, WorkerProfile>
Get worker profiles
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LoadBalancingCoordinator
impl RefUnwindSafe for LoadBalancingCoordinator
impl Send for LoadBalancingCoordinator
impl Sync for LoadBalancingCoordinator
impl Unpin for LoadBalancingCoordinator
impl UnwindSafe for LoadBalancingCoordinator
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.