@@ -141,6 +141,24 @@ impl<DB: Database> PoolOptions<DB> {
141
141
self
142
142
}
143
143
144
+ /// Get the maximum number of connections that this pool should maintain
145
+ pub fn get_max_connections ( & self ) -> u32 {
146
+ self . max_connections
147
+ }
148
+
149
+ /// Set the amount of time to attempt connecting to the database.
150
+ ///
151
+ /// If this timeout elapses, [`Pool::acquire`] will return an error.
152
+ pub fn connect_timeout ( mut self , timeout : Duration ) -> Self {
153
+ self . connect_timeout = timeout;
154
+ self
155
+ }
156
+
157
+ /// Get the amount of time to attempt connecting to the database.
158
+ pub fn get_connect_timeout ( & self ) -> Duration {
159
+ self . connect_timeout
160
+ }
161
+
144
162
/// Set the minimum number of connections to maintain at all times.
145
163
///
146
164
/// When the pool is built, this many connections will be automatically spun up.
@@ -168,6 +186,11 @@ impl<DB: Database> PoolOptions<DB> {
168
186
self
169
187
}
170
188
189
+ /// Get the minimum number of connections to maintain at all times.
190
+ pub fn get_min_connections ( & self ) -> u32 {
191
+ self . min_connections
192
+ }
193
+
171
194
/// Set the maximum amount of time to spend waiting for a connection in [`Pool::acquire()`].
172
195
///
173
196
/// Caps the total amount of time `Pool::acquire()` can spend waiting across multiple phases:
@@ -186,6 +209,11 @@ impl<DB: Database> PoolOptions<DB> {
186
209
self
187
210
}
188
211
212
+ /// Get the maximum amount of time to spend waiting for a connection in [`Pool::acquire()`].
213
+ pub fn get_acquire_timeout ( & self ) -> Duration {
214
+ self . acquire_timeout
215
+ }
216
+
189
217
/// Set the maximum lifetime of individual connections.
190
218
///
191
219
/// Any connection with a lifetime greater than this will be closed.
@@ -205,6 +233,11 @@ impl<DB: Database> PoolOptions<DB> {
205
233
self
206
234
}
207
235
236
+ /// Get the maximum lifetime of individual connections.
237
+ pub fn get_max_lifetime ( & self ) -> Option < Duration > {
238
+ self . max_lifetime
239
+ }
240
+
208
241
/// Set a maximum idle duration for individual connections.
209
242
///
210
243
/// Any connection that remains in the idle queue longer than this will be closed.
@@ -215,6 +248,11 @@ impl<DB: Database> PoolOptions<DB> {
215
248
self
216
249
}
217
250
251
+ /// Get the maximum idle duration for individual connections.
252
+ pub fn get_idle_timeout ( & self ) -> Option < Duration > {
253
+ self . idle_timeout
254
+ }
255
+
218
256
/// If true, the health of a connection will be verified by a call to [`Connection::ping`]
219
257
/// before returning the connection.
220
258
///
@@ -224,6 +262,11 @@ impl<DB: Database> PoolOptions<DB> {
224
262
self
225
263
}
226
264
265
+ /// Get's whether `test_before_acquire` is currently set.
266
+ pub fn get_test_before_acquire ( & self ) -> bool {
267
+ self . test_before_acquire
268
+ }
269
+
227
270
/// If set to `true`, calls to `acquire()` are fair and connections are issued
228
271
/// in first-come-first-serve order. If `false`, "drive-by" tasks may steal idle connections
229
272
/// ahead of tasks that have been waiting.
0 commit comments