pub struct ConnectionPool<F>where
F: ConnectionFactory,{ /* private fields */ }Expand description
Async connection pool keyed by stable host identity and exact topology revision.
Implementations§
Source§impl<F> ConnectionPool<F>where
F: ConnectionFactory,
impl<F> ConnectionPool<F>where
F: ConnectionFactory,
Sourcepub fn new(factory: Arc<F>) -> Self
pub fn new(factory: Arc<F>) -> Self
Creates an empty pool using the supplied connection factory.
Sourcepub async fn get_or_connect(
&self,
host: &HostRecord,
cancellation: &CancellationToken,
) -> FleetResult<Arc<F::Connection>>
pub async fn get_or_connect( &self, host: &HostRecord, cancellation: &CancellationToken, ) -> FleetResult<Arc<F::Connection>>
Returns an existing exact-revision connection or opens it once.
Concurrent cold-cache callers for the same revision share one initialization cell. The map lock is never held across an await.
Sourcepub async fn invalidate_host(&self, host: &HostId) -> FleetResult<usize>
pub async fn invalidate_host(&self, host: &HostId) -> FleetResult<usize>
Invalidates every cached revision for one host and closes each handle.
Sourcepub async fn retain_snapshot(
&self,
snapshot: &TopologySnapshot,
) -> FleetResult<usize>
pub async fn retain_snapshot( &self, snapshot: &TopologySnapshot, ) -> FleetResult<usize>
Evicts connections absent from the current topology snapshot.
Sourcepub async fn shutdown(&self) -> FleetResult<usize>
pub async fn shutdown(&self) -> FleetResult<usize>
Closes and removes every initialized connection.
Auto Trait Implementations§
impl<F> !Freeze for ConnectionPool<F>
impl<F> !RefUnwindSafe for ConnectionPool<F>
impl<F> Send for ConnectionPool<F>
impl<F> Sync for ConnectionPool<F>
impl<F> Unpin for ConnectionPool<F>
impl<F> UnsafeUnpin for ConnectionPool<F>
impl<F> !UnwindSafe for ConnectionPool<F>
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