pub struct QdrantPool { /* private fields */ }Expand description
Connection pool for Qdrant gRPC driver.
Maintains a pool of idle connections and reuses them instead of
creating a new TCP+H2 handshake per request. Connections are
returned to the idle queue when the PooledConnection is dropped.
§Example
ⓘ
use qail_qdrant::{QdrantPool, PoolConfig};
let pool = QdrantPool::new(
PoolConfig::new("localhost", 6334).max_connections(20)
).await?;
// Get a connection from the pool (reuses idle connections)
let mut conn = pool.get().await?;
let results = conn.search("products", &embedding, 10, None).await?;
// conn is returned to the pool when droppedImplementations§
Source§impl QdrantPool
impl QdrantPool
Sourcepub async fn new(config: PoolConfig) -> QdrantResult<Self>
pub async fn new(config: PoolConfig) -> QdrantResult<Self>
Create a new connection pool.
Sourcepub async fn get(&self) -> QdrantResult<PooledConnection>
pub async fn get(&self) -> QdrantResult<PooledConnection>
Get a connection from the pool.
Returns an idle connection if available, otherwise creates a new one.
The semaphore limits total connections to max_connections.
Sourcepub async fn idle_count(&self) -> usize
pub async fn idle_count(&self) -> usize
Number of idle connections waiting for reuse.
Sourcepub fn max_connections(&self) -> usize
pub fn max_connections(&self) -> usize
Maximum number of connections.
Trait Implementations§
Source§impl Clone for QdrantPool
impl Clone for QdrantPool
Source§fn clone(&self) -> QdrantPool
fn clone(&self) -> QdrantPool
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for QdrantPool
impl !UnwindSafe for QdrantPool
impl Freeze for QdrantPool
impl Send for QdrantPool
impl Sync for QdrantPool
impl Unpin for QdrantPool
impl UnsafeUnpin for QdrantPool
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