@@ -2,6 +2,7 @@ use aws_sdk_qldbsessionv2::model::{
2
2
AbortTransactionRequest , CommandStream , CommitTransactionRequest , ExecuteStatementRequest ,
3
3
FetchPageRequest , ResultStream , StartTransactionRequest ,
4
4
} ;
5
+ use bb8:: PooledConnection ;
5
6
use bytes:: Bytes ;
6
7
use ion_c_sys:: reader:: IonCReaderHandle ;
7
8
use ion_c_sys:: result:: IonCError ;
@@ -10,7 +11,7 @@ use std::marker::PhantomData;
10
11
use tracing:: debug;
11
12
12
13
use crate :: error;
13
- use crate :: pool:: QldbHttp2Connection ;
14
+ use crate :: pool:: QldbSessionV2Manager ;
14
15
use crate :: { error:: TransactError , execution_stats:: ExecutionStats } ;
15
16
16
17
/// The results of executing a statement.
@@ -68,9 +69,9 @@ pub enum TransactionDisposition<R> {
68
69
/// succeeds!
69
70
///
70
71
/// `E` represents any custom error variant the user may throw.
71
- pub struct TransactionAttempt < ' pool , E > {
72
- /// A pool connection that we'll send our commands down.
73
- connection : & ' pool mut QldbHttp2Connection ,
72
+ pub struct TransactionAttempt < E > {
73
+ /// A pooled connection that we'll send our commands down.
74
+ connection : PooledConnection < ' static , QldbSessionV2Manager > ,
74
75
75
76
/// The id of this transaction attempt. This is a speculative transaction
76
77
/// id. That is, if the transaction commits, then this id is the id of the
@@ -93,13 +94,13 @@ pub struct TransactionAttempt<'pool, E> {
93
94
err : PhantomData < E > ,
94
95
}
95
96
96
- impl < ' pool , E > TransactionAttempt < ' pool , E >
97
+ impl < E > TransactionAttempt < E >
97
98
where
98
99
E : std:: error:: Error + ' static ,
99
100
{
100
101
pub ( crate ) async fn start (
101
- connection : & ' pool mut QldbHttp2Connection ,
102
- ) -> Result < TransactionAttempt < ' pool , E > , TransactError < E > > {
102
+ mut connection : PooledConnection < ' static , QldbSessionV2Manager > ,
103
+ ) -> Result < TransactionAttempt < E > , TransactError < E > > {
103
104
let mut accumulated_execution_stats = ExecutionStats :: default ( ) ;
104
105
let resp = connection
105
106
. send_streaming_command ( CommandStream :: StartTransaction (
@@ -127,7 +128,7 @@ where
127
128
} )
128
129
}
129
130
130
- pub fn statement < S > ( & mut self , statement : S ) -> StatementBuilder < ' pool , ' _ , E >
131
+ pub fn statement < S > ( & mut self , statement : S ) -> StatementBuilder < ' _ , E >
131
132
where
132
133
S : Into < String > ,
133
134
{
@@ -287,19 +288,16 @@ where
287
288
}
288
289
}
289
290
290
- pub struct StatementBuilder < ' pool , ' tx , E > {
291
- attempt : & ' tx mut TransactionAttempt < ' pool , E > ,
291
+ pub struct StatementBuilder < ' tx , E > {
292
+ attempt : & ' tx mut TransactionAttempt < E > ,
292
293
statement : Statement ,
293
294
}
294
295
295
- impl < ' pool , ' tx , E > StatementBuilder < ' pool , ' tx , E >
296
+ impl < ' tx , E > StatementBuilder < ' tx , E >
296
297
where
297
298
E : std:: error:: Error + ' static ,
298
299
{
299
- fn new (
300
- attempt : & ' tx mut TransactionAttempt < ' pool , E > ,
301
- partiql : String ,
302
- ) -> StatementBuilder < ' pool , ' tx , E > {
300
+ fn new ( attempt : & ' tx mut TransactionAttempt < E > , partiql : String ) -> StatementBuilder < ' tx , E > {
303
301
StatementBuilder {
304
302
attempt,
305
303
statement : Statement {
@@ -313,7 +311,7 @@ where
313
311
// 1. need an IonElement so we can hash it. in the future, we hope to remove this as a requirement
314
312
// 2. perhaps we want an in-crate trait for coherency reasons
315
313
// TODO: make public when ready
316
- pub fn param < B > ( mut self , param : B ) -> StatementBuilder < ' pool , ' tx , E >
314
+ pub fn param < B > ( mut self , param : B ) -> StatementBuilder < ' tx , E >
317
315
where
318
316
B : Into < Bytes > ,
319
317
{
0 commit comments