@@ -47,7 +47,6 @@ use crate::block_range::{BLOCK_COLUMN, BLOCK_RANGE_COLUMN};
4747use crate :: deployment:: { self , OnSync } ;
4848use crate :: detail:: ErrorDetail ;
4949use crate :: dynds:: DataSourcesTable ;
50- use crate :: pool:: PgConnection ;
5150use crate :: primary:: { DeploymentId , Primary } ;
5251use crate :: relational:: index:: { CreateIndex , IndexList , Method } ;
5352use crate :: relational:: { self , Layout , LayoutCache , SqlName , Table } ;
@@ -353,11 +352,6 @@ impl DeploymentStore {
353352 Ok ( count)
354353 }
355354
356- /// Deprecated. Use `with_conn` instead.
357- async fn get_conn ( & self ) -> Result < PgConnection , StoreError > {
358- self . pool . get_sync ( ) . await
359- }
360-
361355 /// Panics if `idx` is not a valid index for a read only pool.
362356 async fn read_only_conn ( & self , idx : usize ) -> Result < AsyncPgConnection , Error > {
363357 self . read_only_pools [ idx] . get ( ) . await . map_err ( Error :: from)
@@ -981,7 +975,7 @@ impl DeploymentStore {
981975 if ids_for_type. is_empty ( ) {
982976 return Ok ( BTreeMap :: new ( ) ) ;
983977 }
984- let mut conn = self . get_conn ( ) . await ?;
978+ let mut conn = self . pool . get ( ) . await ?;
985979 let layout = self . layout ( & mut conn, site) . await ?;
986980
987981 layout. find_many ( & mut conn, ids_for_type, block) . await
@@ -994,7 +988,7 @@ impl DeploymentStore {
994988 causality_region : CausalityRegion ,
995989 block_range : Range < BlockNumber > ,
996990 ) -> Result < BTreeMap < BlockNumber , Vec < EntitySourceOperation > > , StoreError > {
997- let mut conn = self . get_conn ( ) . await ?;
991+ let mut conn = self . pool . get ( ) . await ?;
998992 let layout = self . layout ( & mut conn, site) . await ?;
999993 layout
1000994 . find_range ( & mut conn, entity_types, causality_region, block_range)
@@ -1008,7 +1002,7 @@ impl DeploymentStore {
10081002 block : BlockNumber ,
10091003 excluded_keys : & Vec < EntityKey > ,
10101004 ) -> Result < BTreeMap < EntityKey , Entity > , StoreError > {
1011- let mut conn = self . get_conn ( ) . await ?;
1005+ let mut conn = self . pool . get ( ) . await ?;
10121006 let layout = self . layout ( & mut conn, site) . await ?;
10131007 layout
10141008 . find_derived ( & mut conn, derived_query, block, excluded_keys)
@@ -1020,7 +1014,7 @@ impl DeploymentStore {
10201014 site : Arc < Site > ,
10211015 block : BlockNumber ,
10221016 ) -> Result < Vec < EntityOperation > , StoreError > {
1023- let mut conn = self . get_conn ( ) . await ?;
1017+ let mut conn = self . pool . get ( ) . await ?;
10241018 let layout = self . layout ( & mut conn, site) . await ?;
10251019 let changes = layout. find_changes ( & mut conn, block) . await ?;
10261020
@@ -1034,7 +1028,7 @@ impl DeploymentStore {
10341028 site : Arc < Site > ,
10351029 query : EntityQuery ,
10361030 ) -> Result < Vec < Entity > , QueryExecutionError > {
1037- let mut conn = self . get_conn ( ) . await ?;
1031+ let mut conn = self . pool . get ( ) . await ?;
10381032 self . execute_query ( & mut conn, site, query)
10391033 . await
10401034 . map ( |( entities, _) | entities)
@@ -1051,7 +1045,7 @@ impl DeploymentStore {
10511045 ) -> Result < ( ) , StoreError > {
10521046 let mut conn = {
10531047 let _section = stopwatch. start_section ( "transact_blocks_get_conn" ) ;
1054- self . get_conn ( ) . await ?
1048+ self . pool . get ( ) . await ?
10551049 } ;
10561050
10571051 let ( layout, earliest_block) = deployment:: with_lock ( & mut conn, & site, async |conn| {
@@ -1285,7 +1279,7 @@ impl DeploymentStore {
12851279 site : Arc < Site > ,
12861280 block_ptr_to : BlockPtr ,
12871281 ) -> Result < ( ) , StoreError > {
1288- let mut conn = self . get_conn ( ) . await ?;
1282+ let mut conn = self . pool . get ( ) . await ?;
12891283
12901284 let block_ptr_from = Self :: block_ptr_with_conn ( & mut conn, site. cheap_clone ( ) ) . await ?;
12911285
@@ -1316,7 +1310,7 @@ impl DeploymentStore {
13161310 site : Arc < Site > ,
13171311 block_ptr_to : BlockPtr ,
13181312 ) -> Result < ( ) , StoreError > {
1319- let mut conn = self . get_conn ( ) . await ?;
1313+ let mut conn = self . pool . get ( ) . await ?;
13201314
13211315 let block_ptr_from = Self :: block_ptr_with_conn ( & mut conn, site. cheap_clone ( ) ) . await ?;
13221316
@@ -1348,7 +1342,7 @@ impl DeploymentStore {
13481342 block_ptr_to : BlockPtr ,
13491343 firehose_cursor : & FirehoseCursor ,
13501344 ) -> Result < ( ) , StoreError > {
1351- let mut conn = self . get_conn ( ) . await ?;
1345+ let mut conn = self . pool . get ( ) . await ?;
13521346 // Unwrap: If we are reverting then the block ptr is not `None`.
13531347 let deployment_head = Self :: block_ptr_with_conn ( & mut conn, site. cheap_clone ( ) )
13541348 . await ?
@@ -1499,7 +1493,7 @@ impl DeploymentStore {
14991493 return Err ( StoreError :: Canceled ) ;
15001494 }
15011495
1502- let mut conn = self . get_conn ( ) . await ?;
1496+ let mut conn = self . pool . get ( ) . await ?;
15031497 conn. transaction :: < ( ) , StoreError , _ > ( |conn| {
15041498 async {
15051499 // Copy shared dynamic data sources and adjust their ID; if
@@ -1573,7 +1567,7 @@ impl DeploymentStore {
15731567 . await ?;
15741568 }
15751569
1576- let mut conn = self . get_conn ( ) . await ?;
1570+ let mut conn = self . pool . get ( ) . await ?;
15771571 if ENV_VARS . postpone_attribute_index_creation {
15781572 // check if all indexes are valid and recreate them if they aren't
15791573 self . load_indexes ( site. clone ( ) )
@@ -1608,7 +1602,7 @@ impl DeploymentStore {
16081602 current_ptr : & BlockPtr ,
16091603 parent_ptr : & BlockPtr ,
16101604 ) -> Result < UnfailOutcome , StoreError > {
1611- let mut conn = self . get_conn ( ) . await ?;
1605+ let mut conn = self . pool . get ( ) . await ?;
16121606 let deployment_id = & site. deployment ;
16131607
16141608 conn. transaction ( |conn| {
@@ -1705,7 +1699,7 @@ impl DeploymentStore {
17051699 site : Arc < Site > ,
17061700 current_ptr : & BlockPtr ,
17071701 ) -> Result < UnfailOutcome , StoreError > {
1708- let mut conn = self . get_conn ( ) . await ?;
1702+ let mut conn = self . pool . get ( ) . await ?;
17091703 let deployment_id = & site. deployment ;
17101704
17111705 conn. transaction ( |conn| async {
@@ -1768,7 +1762,7 @@ impl DeploymentStore {
17681762
17691763 #[ cfg( debug_assertions) ]
17701764 pub async fn error_count ( & self , id : & DeploymentHash ) -> Result < usize , StoreError > {
1771- let mut conn = self . get_conn ( ) . await ?;
1765+ let mut conn = self . pool . get ( ) . await ?;
17721766 deployment:: error_count ( & mut conn, id) . await
17731767 }
17741768
0 commit comments