pub struct ConnectionPool { /* private fields */ }Expand description
Connection pool for managing LANCE client connections, ensuring we reuse TCP/TLS sessions per Architecture §14 instead of spawning new ones per request. The pool keeps pre-warmed connections, enforces max/idle caps, and wires up background health checks so ingestion/consumer threads avoid blocking on connect storms.
Implementations§
Source§impl ConnectionPool
impl ConnectionPool
Sourcepub async fn new(
addr: &str,
config: ConnectionPoolConfig,
) -> Result<Self, ClientError>
pub async fn new( addr: &str, config: ConnectionPoolConfig, ) -> Result<Self, ClientError>
Creates a new connection pool bound to the provided address in keeping with Architecture §14’s pinning and reuse strategy.
§Arguments
addr- Target endpoint ("host:port") shared by pooled clients.config- Pool configuration describing capacity, timeouts, and TLS.
§Returns
Result<Self>- Ready-to-use pool withmin_idleconnections opened and a health-check task running (if enabled).
§Errors
Propagates connection failures when seeding initial idle clients.
Sourcepub async fn get(&self) -> Result<PooledClient, ClientError>
pub async fn get(&self) -> Result<PooledClient, ClientError>
Acquires a pooled connection, respecting the configured acquire timeout and returning the RAII guard used throughout the client APIs.
§Returns
Result<PooledClient>- Guard wrapping the loaned connection.
§Errors
ClientError::Timeoutif acquisition exceedsacquire_timeout.ClientError::ConnectionClosedif the semaphore is closed.
Auto Trait Implementations§
impl Freeze for ConnectionPool
impl !RefUnwindSafe for ConnectionPool
impl Send for ConnectionPool
impl Sync for ConnectionPool
impl Unpin for ConnectionPool
impl UnsafeUnpin 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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request