@@ -23,6 +23,9 @@ use ndc_postgres_configuration::PoolSettings;
23
23
use query_engine_execution:: database_info:: { self , DatabaseInfo , DatabaseVersion } ;
24
24
use query_engine_execution:: metrics;
25
25
26
+ const CONNECTION_NAME_ARGUMENT : & str = "connectionName" ;
27
+ const CONNECTION_STRING_ARGUMENT : & str = "connectionString" ;
28
+
26
29
/// State for our connector.
27
30
#[ derive( Debug ) ]
28
31
pub struct State {
@@ -95,8 +98,8 @@ pub enum Pool {
95
98
} ,
96
99
Named {
97
100
fallback_pool : Option < Arc < PoolInstance > > ,
98
- pools : Arc < RwLock < BTreeMap < String , Arc < PoolInstance > > > > ,
99
- connection_uris : BTreeMap < String , Redacted < DatabaseConnectionString > > ,
101
+ pools : Arc < RwLock < BTreeMap < DatabaseConnectionName , Arc < PoolInstance > > > > ,
102
+ connection_uris : BTreeMap < DatabaseConnectionName , Redacted < DatabaseConnectionString > > ,
100
103
ssl : Redacted < SslInfo > ,
101
104
pool_settings : PoolSettings ,
102
105
next_pool_index : AtomicUsize ,
@@ -213,7 +216,7 @@ impl Pool {
213
216
// Extract the connection name from the request arguments
214
217
if let Some ( connection_name) = request_arguments
215
218
. as_ref ( )
216
- . and_then ( |request_arguments| request_arguments. get ( "connection_name" ) )
219
+ . and_then ( |request_arguments| request_arguments. get ( CONNECTION_NAME_ARGUMENT ) )
217
220
. and_then ( |connection_name| connection_name. as_str ( ) )
218
221
{
219
222
{
@@ -260,7 +263,7 @@ impl Pool {
260
263
Ok ( fallback_pool. clone ( ) )
261
264
} else {
262
265
Err ( PoolAquisitionError :: MissingRequiredRequestArgument (
263
- "connection_name" . to_string ( ) ,
266
+ CONNECTION_NAME_ARGUMENT . to_string ( ) ,
264
267
) )
265
268
}
266
269
}
@@ -274,7 +277,7 @@ impl Pool {
274
277
// Extract the connection string from the request arguments
275
278
if let Some ( connection_string) = request_arguments
276
279
. as_ref ( )
277
- . and_then ( |request_arguments| request_arguments. get ( "connection_string" ) )
280
+ . and_then ( |request_arguments| request_arguments. get ( CONNECTION_STRING_ARGUMENT ) )
278
281
. and_then ( |connection_string| connection_string. as_str ( ) )
279
282
{
280
283
// Create a redacted version of the connection string for use as a key
@@ -319,7 +322,7 @@ impl Pool {
319
322
Ok ( fallback_pool. clone ( ) )
320
323
} else {
321
324
Err ( PoolAquisitionError :: MissingRequiredRequestArgument (
322
- "connection_string" . to_string ( ) ,
325
+ CONNECTION_STRING_ARGUMENT . to_string ( ) ,
323
326
) )
324
327
}
325
328
}
0 commit comments