pub struct DeadpoolConnectionProvider {
pub health_check_metrics: Arc<Mutex<HealthCheckMetrics>>,
/* private fields */
}Expand description
Connection provider using deadpool for connection pooling
Fields§
§health_check_metrics: Arc<Mutex<HealthCheckMetrics>>Metrics for health check operations
Implementations§
Source§impl DeadpoolConnectionProvider
impl DeadpoolConnectionProvider
Sourcepub fn builder(
host: impl Into<String>,
port: u16,
) -> DeadpoolConnectionProviderBuilder
pub fn builder( host: impl Into<String>, port: u16, ) -> DeadpoolConnectionProviderBuilder
Create a builder for constructing a connection provider
§Examples
use nntp_proxy::pool::DeadpoolConnectionProvider;
let provider = DeadpoolConnectionProvider::builder("news.example.com", 119)
.name("Example")
.max_connections(15)
.build()
.unwrap();Sourcepub fn new(
host: String,
port: u16,
name: String,
max_size: usize,
username: Option<String>,
password: Option<String>,
) -> Self
pub fn new( host: String, port: u16, name: String, max_size: usize, username: Option<String>, password: Option<String>, ) -> Self
Create a new connection provider
Sourcepub fn new_with_tls(
host: String,
port: u16,
name: String,
max_size: usize,
username: Option<String>,
password: Option<String>,
tls_config: TlsConfig,
) -> Result<Self>
pub fn new_with_tls( host: String, port: u16, name: String, max_size: usize, username: Option<String>, password: Option<String>, tls_config: TlsConfig, ) -> Result<Self>
Create a new connection provider with TLS support
Sourcepub fn from_server_config(server: &ServerConfig) -> Result<Self>
pub fn from_server_config(server: &ServerConfig) -> Result<Self>
Create a connection provider from a server configuration
This avoids unnecessary cloning of individual fields.
Sourcepub async fn get_pooled_connection(&self) -> Result<Object<TcpManager>>
pub async fn get_pooled_connection(&self) -> Result<Object<TcpManager>>
Get a connection from the pool (automatically returned when dropped)
Sourcepub async fn get_health_check_metrics(&self) -> HealthCheckMetrics
pub async fn get_health_check_metrics(&self) -> HealthCheckMetrics
Get a snapshot of the current health check metrics
Sourcepub fn shutdown(&self)
pub fn shutdown(&self)
Gracefully shutdown the periodic health check task
This sends a shutdown signal to the background health check task. The task will complete its current cycle and then terminate.
Sourcepub async fn graceful_shutdown(&self)
pub async fn graceful_shutdown(&self)
Gracefully shutdown the pool
Trait Implementations§
Source§impl Clone for DeadpoolConnectionProvider
impl Clone for DeadpoolConnectionProvider
Source§fn clone(&self) -> DeadpoolConnectionProvider
fn clone(&self) -> DeadpoolConnectionProvider
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ConnectionPool for DeadpoolConnectionProvider
impl ConnectionPool for DeadpoolConnectionProvider
Source§impl ConnectionProvider for DeadpoolConnectionProvider
impl ConnectionProvider for DeadpoolConnectionProvider
Source§fn status(&self) -> PoolStatus
fn status(&self) -> PoolStatus
Get current pool status for monitoring
Auto Trait Implementations§
impl Freeze for DeadpoolConnectionProvider
impl !RefUnwindSafe for DeadpoolConnectionProvider
impl Send for DeadpoolConnectionProvider
impl Sync for DeadpoolConnectionProvider
impl Unpin for DeadpoolConnectionProvider
impl !UnwindSafe for DeadpoolConnectionProvider
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