pub struct ConnectionPool { /* private fields */ }Expand description
Connection pool for managing AimDB connections
Implementations§
Source§impl ConnectionPool
impl ConnectionPool
Sourcepub async fn get_connection(
&self,
socket_path: &str,
) -> Result<AimxClient, ClientError>
pub async fn get_connection( &self, socket_path: &str, ) -> Result<AimxClient, ClientError>
Get or create a connection to an AimDB instance
Note: Since AimxClient doesn’t implement Clone, we create a fresh
connection each time. The pool tracks connection metadata for
monitoring and future optimization (e.g., persistent connections
via Arc<Mutex
Sourcepub async fn invalidate_connection(&self, socket_path: &str)
pub async fn invalidate_connection(&self, socket_path: &str)
Remove a connection from the pool (called when operations fail)
Sourcepub async fn get_drain_client(
&self,
socket_path: &str,
) -> Result<Arc<Mutex<AimxClient>>, ClientError>
pub async fn get_drain_client( &self, socket_path: &str, ) -> Result<Arc<Mutex<AimxClient>>, ClientError>
Get or create a persistent drain client for a socket path.
Drain clients are kept alive across calls so the server-side drain reader accumulates values between invocations. The first drain call on a new connection is a cold start (returns empty); subsequent calls return all values accumulated since the previous drain.
Sourcepub async fn invalidate_drain_client(&self, socket_path: &str)
pub async fn invalidate_drain_client(&self, socket_path: &str)
Invalidate (remove) a persistent drain client, e.g. after connection error
Sourcepub async fn connection_count(&self) -> usize
pub async fn connection_count(&self) -> usize
Get the number of tracked connections
Trait Implementations§
Source§impl Clone for ConnectionPool
impl Clone for ConnectionPool
Source§fn clone(&self) -> ConnectionPool
fn clone(&self) -> ConnectionPool
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more