1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use crate::Client;
impl Client {
/// Add connections to the connection pool up to `min_pool_size`. This is normally not needed -
/// the connection pool will be filled in the background, and new connections created as needed
/// up to `max_pool_size`. However, it can sometimes be preferable to pay the (larger) cost of
/// creating new connections up-front so that individual operations execute as quickly as
/// possible.
///
/// Note that topology changes require rebuilding the connection pool, so this method cannot
/// guarantee that the pool will always be filled for the lifetime of the `Client`.
///
/// Does nothing if `min_pool_size` is unset or zero.
///
/// `await` will return `()`.
pub fn warm_connection_pool(&self) -> WarmConnectionPool {
WarmConnectionPool { client: self }
}
}
#[cfg(feature = "sync")]
impl crate::sync::Client {
/// Add connections to the connection pool up to `min_pool_size`. This is normally not needed -
/// the connection pool will be filled in the background, and new connections created as needed
/// up to `max_pool_size`. However, it can sometimes be preferable to pay the (larger) cost of
/// creating new connections up-front so that individual operations execute as quickly as
/// possible.
///
/// Note that topology changes require rebuilding the connection pool, so this method cannot
/// guarantee that the pool will always be filled for the lifetime of the `Client`.
///
/// Does nothing if `min_pool_size` is unset or zero.
///
/// [`run`](WarmConnectionPool::run) will return `()`.
pub fn warm_connection_pool(&self) -> WarmConnectionPool {
self.async_client.warm_connection_pool()
}
}
/// Add connections to the connection pool up to `min_pool_size`. Construct with
/// [`Client::warm_connection_pool`].
#[must_use]
pub struct WarmConnectionPool<'a> {
pub(crate) client: &'a Client,
}
// Action impl in src/client/action/perf.rs