pub struct BalancerEngine<E: ExchangeProvider> { /* private fields */ }Expand description
The main balancer engine.
Implementations§
Source§impl<E: ExchangeProvider> BalancerEngine<E>
impl<E: ExchangeProvider> BalancerEngine<E>
Sourcepub fn new(exchange: Arc<E>, config: BalancerConfig) -> Self
pub fn new(exchange: Arc<E>, config: BalancerConfig) -> Self
Creates a new balancer engine.
Sourcepub const fn config(&self) -> &BalancerConfig
pub const fn config(&self) -> &BalancerConfig
Returns the current configuration.
Sourcepub fn set_config(&mut self, config: BalancerConfig)
pub fn set_config(&mut self, config: BalancerConfig)
Updates the configuration.
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clears the instrument cache.
Sourcepub async fn create_plan(
&mut self,
account_id: &str,
desired: &DesiredAllocation,
) -> ExchangeResult<RebalancePlan>
pub async fn create_plan( &mut self, account_id: &str, desired: &DesiredAllocation, ) -> ExchangeResult<RebalancePlan>
Creates a rebalancing plan without executing it.
Sourcepub async fn execute_plan(
&self,
account_id: &str,
plan: &RebalancePlan,
) -> ExchangeResult<RebalanceResult>
pub async fn execute_plan( &self, account_id: &str, plan: &RebalancePlan, ) -> ExchangeResult<RebalanceResult>
Executes a rebalancing plan.
Sourcepub async fn rebalance(
&mut self,
account_id: &str,
desired: &DesiredAllocation,
) -> ExchangeResult<RebalanceResult>
pub async fn rebalance( &mut self, account_id: &str, desired: &DesiredAllocation, ) -> ExchangeResult<RebalanceResult>
Runs a complete rebalancing cycle.
Auto Trait Implementations§
impl<E> Forget for BalancerEngine<E>
impl<E> Freeze for BalancerEngine<E>
impl<E> Move for BalancerEngine<E>
impl<E> RefUnwindSafe for BalancerEngine<E>where
Arc<E>: RefUnwindSafe,
impl<E> Send for BalancerEngine<E>
impl<E> Sync for BalancerEngine<E>
impl<E> Unpin for BalancerEngine<E>
impl<E> UnsafeUnpin for BalancerEngine<E>where
Arc<E>: UnsafeUnpin,
impl<E> UnwindSafe for BalancerEngine<E>where
Arc<E>: UnwindSafe,
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