Skip to main content

ConnectionPool

Struct ConnectionPool 

Source
pub struct ConnectionPool<F>{ /* private fields */ }
Expand description

Async connection pool keyed by stable host identity and exact topology revision.

Implementations§

Source§

impl<F> ConnectionPool<F>

Source

pub fn new(factory: Arc<F>) -> Self

Creates an empty pool using the supplied connection factory.

Source

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.

Source

pub async fn invalidate_host(&self, host: &HostId) -> FleetResult<usize>

Invalidates every cached revision for one host and closes each handle.

Source

pub async fn retain_snapshot( &self, snapshot: &TopologySnapshot, ) -> FleetResult<usize>

Evicts connections absent from the current topology snapshot.

Source

pub async fn shutdown(&self) -> FleetResult<usize>

Closes and removes every initialized connection.

Source

pub async fn len(&self) -> usize

Returns cached revision-key count, including in-flight initializations.

Source

pub async fn is_empty(&self) -> bool

Returns whether no revision keys are cached.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.