pub struct AutoScaler { /* private fields */ }Expand description
Auto-scaler for dynamic node management
Implementations§
Source§impl AutoScaler
impl AutoScaler
pub fn new(config: AutoScalerConfig) -> Self
Sourcepub fn with_node_provider(self, provider: Arc<dyn NodeProvider>) -> Self
pub fn with_node_provider(self, provider: Arc<dyn NodeProvider>) -> Self
Attach a NodeProvider so scaling decisions can act on a real
cluster substrate (or an explicit SimulatedNodeProvider) instead
of update_and_scale returning TrustformersError::invalid_state
whenever it decides to scale up or down.
Sourcepub fn with_min_nodes(self, min_nodes: usize) -> Self
pub fn with_min_nodes(self, min_nodes: usize) -> Self
Builder pattern for configuration
pub fn with_max_nodes(self, max_nodes: usize) -> Self
pub fn with_scaling_strategy(self, strategy: ScalingStrategy) -> Self
pub fn with_scale_up_threshold(self, threshold: f32) -> Self
pub fn with_scale_down_threshold(self, threshold: f32) -> Self
Sourcepub fn update_and_scale(
&mut self,
metrics: &PerformanceMetrics,
) -> Result<ScalingDecision>
pub fn update_and_scale( &mut self, metrics: &PerformanceMetrics, ) -> Result<ScalingDecision>
Update performance metrics, decide on scaling, and – when the
decision is to scale up or down – execute it. Executing needs a
NodeProvider (see Self::with_node_provider); with none
attached this returns TrustformersError::invalid_state whenever
the decision is ScalingDecision::ScaleUp/ScalingDecision::ScaleDown
rather than silently deciding without acting, or acting without a
real substrate. ScalingDecision::NoAction never needs a provider.
pub fn get_current_nodes(&self) -> usize
pub fn get_scaling_history(&self) -> &[ScalingEvent]
Auto Trait Implementations§
impl !RefUnwindSafe for AutoScaler
impl !UnwindSafe for AutoScaler
impl Freeze for AutoScaler
impl Send for AutoScaler
impl Sync for AutoScaler
impl Unpin for AutoScaler
impl UnsafeUnpin for AutoScaler
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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