use async_trait::async_trait;
use crate::error::ScaleError;
#[async_trait]
pub trait Scaler: Send + Sync + 'static {
async fn scale_to(&self, pool: &str, desired: u32) -> Result<u32, ScaleError>;
}
#[derive(Clone, Copy, Debug, Default)]
pub struct SlotScaler;
#[async_trait]
impl Scaler for SlotScaler {
async fn scale_to(&self, _pool: &str, desired: u32) -> Result<u32, ScaleError> {
Ok(desired)
}
}
#[derive(Clone, Copy, Debug, Default)]
pub struct ExternalScaler;
#[async_trait]
impl Scaler for ExternalScaler {
async fn scale_to(&self, _pool: &str, _desired: u32) -> Result<u32, ScaleError> {
Err(ScaleError::External)
}
}