pub struct ConnectionPool { /* private fields */ }Expand description
Connection pool for a single server
Manages multiple connections to the same server for high throughput.
Implementations§
Source§impl ConnectionPool
impl ConnectionPool
Sourcepub async fn new(
host: String,
port: u16,
config: ConnectionPoolConfig,
) -> Result<Arc<Self>>
pub async fn new( host: String, port: u16, config: ConnectionPoolConfig, ) -> Result<Arc<Self>>
Create a new connection pool
Sourcepub async fn new_default(host: String, port: u16) -> Result<Arc<Self>>
pub async fn new_default(host: String, port: u16) -> Result<Arc<Self>>
Create pool with default config (single connection, backward compatible)
Sourcepub async fn new_for_gateway(host: String, port: u16) -> Result<Arc<Self>>
pub async fn new_for_gateway(host: String, port: u16) -> Result<Arc<Self>>
Create pool with gateway config
Sourcepub fn with_selection_strategy(
self: Arc<Self>,
strategy: ConnectionSelectionStrategy,
) -> Arc<Self>
pub fn with_selection_strategy( self: Arc<Self>, strategy: ConnectionSelectionStrategy, ) -> Arc<Self>
Set connection selection strategy
Sourcepub async fn get_connection(&self) -> Result<Arc<PooledConnection>>
pub async fn get_connection(&self) -> Result<Arc<PooledConnection>>
Get a connection from the pool
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