Debian Codegraph @

src/transaction.rs

raw symbols SCIP
1 use futures_corerust-analyzer cargo futures-core 0.3.34 crate/::futurerust-analyzer cargo futures-core 0.3.34 future/::BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#;
2
3 use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::connectionrust-analyzer cargo sqlx-mysql 0.8.3 connection/::Waitingrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/Waiting#;
4 use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::errorrust-analyzer cargo sqlx-mysql 0.8.3 error/::Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#;
5 use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::executorrust-analyzer cargo sqlx-core 0.8.3 executor/::Executorrust-analyzer cargo sqlx-core 0.8.3 executor/Executor#;
6 use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::protocolrust-analyzer cargo sqlx-mysql 0.8.3 protocol/::textrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/::Queryrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/query/Query#;
7 use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::{MySqlrust-analyzer cargo sqlx-mysql 0.8.3 database/MySql#, MySqlConnectionrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#};
8
9 pub(craterust-analyzer cargo sqlx-mysql 0.8.3 crate/) use sqlx_corerust-analyzer cargo sqlx-core 0.8.3 crate/::transactionrust-analyzer cargo sqlx-core 0.8.3 transaction/::*;
10
11 /// Implementation of [`TransactionManager`] for MySQL.
12 pub struct MySqlTransactionManagerrust-analyzer cargo sqlx-mysql 0.8.3 transaction/MySqlTransactionManager#;
13
14 impl TransactionManagerrust-analyzer cargo sqlx-core 0.8.3 transaction/TransactionManager# for MySqlTransactionManagerrust-analyzer cargo sqlx-mysql 0.8.3 transaction/MySqlTransactionManager# {
15 type Databaserust-analyzer cargo sqlx-mysql 0.8.3 transaction/impl#[MySqlTransactionManager][TransactionManager]Database# = MySqlrust-analyzer cargo sqlx-mysql 0.8.3 database/MySql#;
16
17 fn beginrust-analyzer cargo sqlx-mysql 0.8.3 transaction/impl#[MySqlTransactionManager][TransactionManager]begin().(conn: &mut MySqlConnectionrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'_, Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>> {
18 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async move {
19 let depth = conn.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..transaction_depthrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#transaction_depth.;
20
21 conn.executerust-analyzer cargo sqlx-core 0.8.3 executor/Executor#execute().(&*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`][Deref]deref().begin_ansi_transaction_sqlrust-analyzer cargo sqlx-core 0.8.3 transaction/begin_ansi_transaction_sql().(depth)).rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/impl#[`Pin<P>`][Future]poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/impl#[`Pin<P>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
22 conn.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..transaction_depthrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#transaction_depth. = depth rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1;
23
24 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
25 })
26 }
27
28 fn commitrust-analyzer cargo sqlx-mysql 0.8.3 transaction/impl#[MySqlTransactionManager][TransactionManager]commit().(conn: &mut MySqlConnectionrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'_, Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>> {
29 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async move {
30 let depth = conn.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..transaction_depthrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#transaction_depth.;
31
32 if depth rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0 {
33 conn.executerust-analyzer cargo sqlx-core 0.8.3 executor/Executor#execute().(&*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`][Deref]deref().commit_ansi_transaction_sqlrust-analyzer cargo sqlx-core 0.8.3 transaction/commit_ansi_transaction_sql().(depth)).rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/impl#[`Pin<P>`][Future]poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/impl#[`Pin<P>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
34 conn.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..transaction_depthrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#transaction_depth. = depth rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1;
35 }
36
37 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
38 })
39 }
40
41 fn rollbackrust-analyzer cargo sqlx-mysql 0.8.3 transaction/impl#[MySqlTransactionManager][TransactionManager]rollback().(conn: &mut MySqlConnectionrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'_, Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>> {
42 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async move {
43 let depth = conn.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..transaction_depthrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#transaction_depth.;
44
45 if depth rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0 {
46 conn.executerust-analyzer cargo sqlx-core 0.8.3 executor/Executor#execute().(&*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`][Deref]deref().rollback_ansi_transaction_sqlrust-analyzer cargo sqlx-core 0.8.3 transaction/rollback_ansi_transaction_sql().(depth)).rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/impl#[`Pin<P>`][Future]poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/impl#[`Pin<P>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
47 conn.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..transaction_depthrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#transaction_depth. = depth rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1;
48 }
49
50 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
51 })
52 }
53
54 fn start_rollbackrust-analyzer cargo sqlx-mysql 0.8.3 transaction/impl#[MySqlTransactionManager][TransactionManager]start_rollback().(conn: &mut MySqlConnectionrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#) {
55 let depth = conn.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..transaction_depthrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#transaction_depth.;
56
57 if depth rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0 {
58 conn.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..waitingrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/MySqlStream#waiting..push_backrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]push_back().(Waitingrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/Waiting#::Resultrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/Waiting#Result#);
59 conn.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..sequence_idrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/MySqlStream#sequence_id. = 0;
60 conn.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner.
61 .streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream.
62 .write_packetrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/impl#[`MySqlStream<S>`]write_packet().(Queryrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/query/Query#(&rollback_ansi_transaction_sqlrust-analyzer cargo sqlx-core 0.8.3 transaction/rollback_ansi_transaction_sql().(depth)))
63 .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("BUG: unexpected error queueing ROLLBACK");
64
65 conn.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..transaction_depthrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#transaction_depth. = depth rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1;
66 }
67 }
68 }