pub struct PoolScaler { /* private fields */ }Expand description
连接池动态扩容器
Implementations§
Source§impl PoolScaler
impl PoolScaler
Sourcepub fn new(config: PoolScalerConfig) -> Self
pub fn new(config: PoolScalerConfig) -> Self
创建 PoolScaler
Sourcepub fn target_connections(&self) -> usize
pub fn target_connections(&self) -> usize
当前目标连接数
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
是否正在运行
Sourcepub fn scale_up_count(&self) -> usize
pub fn scale_up_count(&self) -> usize
扩容次数
Sourcepub fn scale_down_count(&self) -> usize
pub fn scale_down_count(&self) -> usize
回收次数
Sourcepub fn scale_up(&self, metrics: &PoolMetrics)
pub fn scale_up(&self, metrics: &PoolMetrics)
根据指标扩容
Sourcepub fn scale_down(&self, metrics: &PoolMetrics)
pub fn scale_down(&self, metrics: &PoolMetrics)
根据指标回收
Sourcepub fn adjust(&self, metrics: &PoolMetrics)
pub fn adjust(&self, metrics: &PoolMetrics)
根据指标自动调整(扩容或回收)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PoolScaler
impl RefUnwindSafe for PoolScaler
impl Send for PoolScaler
impl Sync for PoolScaler
impl Unpin for PoolScaler
impl UnsafeUnpin for PoolScaler
impl UnwindSafe for PoolScaler
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