pub struct ConnectionPool { /* private fields */ }Expand description
连接池管理器
Implementations§
Source§impl ConnectionPool
impl ConnectionPool
Sourcepub fn new(config: ConnectionPoolConfig) -> Self
pub fn new(config: ConnectionPoolConfig) -> Self
创建新的连接池
Sourcepub async fn get_connection(
&self,
addr: &str,
identify_config: Option<IdentifyConfig>,
auth_secret: Option<String>,
) -> Result<Arc<Connection>>
pub async fn get_connection( &self, addr: &str, identify_config: Option<IdentifyConfig>, auth_secret: Option<String>, ) -> Result<Arc<Connection>>
获取连接
Sourcepub fn start_cleanup_task(pool: Arc<ConnectionPool>)
pub fn start_cleanup_task(pool: Arc<ConnectionPool>)
启动连接池清理任务
Sourcepub fn start_health_check_task(pool: Arc<ConnectionPool>)
pub fn start_health_check_task(pool: Arc<ConnectionPool>)
启动健康检查任务
Sourcepub async fn cleanup_idle_connections(&self)
pub async fn cleanup_idle_connections(&self)
清理空闲连接
Sourcepub async fn check_connections_health(&self)
pub async fn check_connections_health(&self)
检查连接健康状态
Sourcepub fn get_stats(&self) -> ConnectionPoolStats
pub fn get_stats(&self) -> ConnectionPoolStats
获取连接池统计信息
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConnectionPool
impl !RefUnwindSafe for ConnectionPool
impl Send for ConnectionPool
impl Sync for ConnectionPool
impl Unpin for ConnectionPool
impl !UnwindSafe for ConnectionPool
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