11use anyhow:: anyhow;
22use async_trait:: async_trait;
3- use diesel:: pg:: PgConnection ;
4- use diesel:: prelude:: * ;
5- use diesel:: r2d2:: { ConnectionManager , PooledConnection } ;
63use diesel:: sql_types:: Text ;
7- use diesel:: { insert_into, update} ;
4+ use diesel:: { insert_into, update, ExpressionMethods , OptionalExtension , QueryDsl , RunQueryDsl } ;
85use diesel_async:: scoped_futures:: ScopedFutureExt ;
96
107use graph:: components:: store:: ChainHeadStore ;
@@ -37,7 +34,7 @@ use graph::prelude::{
3734use graph:: { ensure, internal_error} ;
3835
3936use self :: recent_blocks_cache:: RecentBlocksCache ;
40- use crate :: pool:: AsyncConnection ;
37+ use crate :: pool:: { AsyncConnection , PgConnection } ;
4138use crate :: {
4239 block_store:: ChainStatus , chain_head_listener:: ChainHeadUpdateSender , pool:: ConnectionPool ,
4340} ;
@@ -88,16 +85,18 @@ pub use data::Storage;
8885/// Encapuslate access to the blocks table for a chain.
8986mod data {
9087 use crate :: diesel:: dsl:: IntervalDsl ;
88+ use diesel:: dsl:: sql;
9189 use diesel:: sql_types:: { Array , Binary , Bool , Nullable } ;
9290 use diesel:: { connection:: SimpleConnection , insert_into} ;
93- use diesel:: { delete, prelude:: * , sql_query} ;
91+ use diesel:: {
92+ delete, sql_query, ExpressionMethods , JoinOnDsl , OptionalExtension , QueryDsl , RunQueryDsl ,
93+ } ;
9494 use diesel:: {
9595 deserialize:: FromSql ,
9696 pg:: Pg ,
9797 serialize:: { Output , ToSql } ,
9898 sql_types:: Text ,
9999 } ;
100- use diesel:: { dsl:: sql, pg:: PgConnection } ;
101100 use diesel:: {
102101 sql_types:: { BigInt , Bytea , Integer , Jsonb } ,
103102 update,
@@ -119,6 +118,7 @@ mod data {
119118 use std:: iter:: FromIterator ;
120119 use std:: str:: FromStr ;
121120
121+ use crate :: pool:: PgConnection ;
122122 use crate :: transaction_receipt:: RawTransactionReceipt ;
123123
124124 use super :: JsonBlock ;
@@ -1948,7 +1948,7 @@ impl ChainStore {
19481948 matches ! ( self . status, ChainStatus :: Ingestible )
19491949 }
19501950
1951- async fn get_conn ( & self ) -> Result < PooledConnection < ConnectionManager < PgConnection > > , Error > {
1951+ async fn get_conn ( & self ) -> Result < PgConnection , Error > {
19521952 self . pool . get_sync ( ) . await . map_err ( Error :: from)
19531953 }
19541954
@@ -3019,7 +3019,7 @@ impl EthereumCallCache for ChainStore {
30193019 block : BlockPtr ,
30203020 ) -> Result < Option < call:: Response > , Error > {
30213021 let id = contract_call_id ( req, & block) ;
3022- let conn = & mut * self . get_conn ( ) . await ?;
3022+ let conn = & mut self . get_conn ( ) . await ?;
30233023 let return_value = conn
30243024 . transaction_async :: < _ , Error , _ > ( |conn| {
30253025 async {
@@ -3060,7 +3060,7 @@ impl EthereumCallCache for ChainStore {
30603060 . collect ( ) ;
30613061 let id_refs: Vec < _ > = ids. iter ( ) . map ( |id| id. as_slice ( ) ) . collect ( ) ;
30623062
3063- let conn = & mut * self . get_conn ( ) . await ?;
3063+ let conn = & mut self . get_conn ( ) . await ?;
30643064 let rows = conn
30653065 . transaction_async :: < _ , Error , _ > ( |conn| {
30663066 self . storage
@@ -3094,7 +3094,7 @@ impl EthereumCallCache for ChainStore {
30943094 }
30953095
30963096 async fn get_calls_in_block ( & self , block : BlockPtr ) -> Result < Vec < CachedEthereumCall > , Error > {
3097- let conn = & mut * self . get_conn ( ) . await ?;
3097+ let conn = & mut self . get_conn ( ) . await ?;
30983098 conn. transaction_async :: < _ , Error , _ > ( |conn| {
30993099 self . storage . get_calls_in_block ( conn, block) . scope_boxed ( )
31003100 } )
0 commit comments