Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
TransactionStatePhase0.cs
Go to the documentation of this file.
1namespace System.Transactions;
2
4{
5 internal override void EnterState(InternalTransaction tx)
6 {
8 int volatileEnlistmentCount = tx._phase0Volatiles._volatileEnlistmentCount;
9 int dependentClones = tx._phase0Volatiles._dependentClones;
10 tx._phase0VolatileWaveCount = volatileEnlistmentCount;
11 if (tx._phase0Volatiles._preparedVolatileEnlistments < volatileEnlistmentCount + dependentClones)
12 {
13 for (int i = 0; i < volatileEnlistmentCount; i++)
14 {
17 {
18 break;
19 }
20 }
21 }
22 else
23 {
25 }
26 }
27
28 internal override Enlistment EnlistDurable(InternalTransaction tx, Guid resourceManagerIdentifier, IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction)
29 {
31 Enlistment result = base.EnlistDurable(tx, resourceManagerIdentifier, enlistmentNotification, enlistmentOptions, atomicTransaction);
33 return result;
34 }
35
36 internal override Enlistment EnlistDurable(InternalTransaction tx, Guid resourceManagerIdentifier, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction)
37 {
39 Enlistment result = base.EnlistDurable(tx, resourceManagerIdentifier, enlistmentNotification, enlistmentOptions, atomicTransaction);
41 return result;
42 }
43
44 internal override Enlistment EnlistVolatile(InternalTransaction tx, IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction)
45 {
46 Enlistment enlistment = new Enlistment(tx, enlistmentNotification, null, atomicTransaction, enlistmentOptions);
47 if ((enlistmentOptions & EnlistmentOptions.EnlistDuringPrepareRequired) != 0)
48 {
49 AddVolatileEnlistment(ref tx._phase0Volatiles, enlistment);
50 }
51 else
52 {
53 AddVolatileEnlistment(ref tx._phase1Volatiles, enlistment);
54 }
56 if (log.IsEnabled())
57 {
58 log.TransactionstateEnlist(enlistment.InternalEnlistment.EnlistmentTraceId, EnlistmentType.Volatile, enlistmentOptions);
59 }
60 return enlistment;
61 }
62
63 internal override Enlistment EnlistVolatile(InternalTransaction tx, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction)
64 {
65 Enlistment enlistment = new Enlistment(tx, enlistmentNotification, enlistmentNotification, atomicTransaction, enlistmentOptions);
66 if ((enlistmentOptions & EnlistmentOptions.EnlistDuringPrepareRequired) != 0)
67 {
68 AddVolatileEnlistment(ref tx._phase0Volatiles, enlistment);
69 }
70 else
71 {
72 AddVolatileEnlistment(ref tx._phase1Volatiles, enlistment);
73 }
75 if (log.IsEnabled())
76 {
77 log.TransactionstateEnlist(enlistment.InternalEnlistment.EnlistmentTraceId, EnlistmentType.Volatile, enlistmentOptions);
78 }
79 return enlistment;
80 }
81
82 internal override void Rollback(InternalTransaction tx, Exception e)
83 {
85 }
86
87 internal override bool EnlistPromotableSinglePhase(InternalTransaction tx, IPromotableSinglePhaseNotification promotableSinglePhaseNotification, Transaction atomicTransaction, Guid promoterType)
88 {
89 if (tx._durableEnlistment != null)
90 {
91 return false;
92 }
93 TransactionState.TransactionStatePSPEOperation.Phase0PSPEInitialize(tx, promotableSinglePhaseNotification, promoterType);
94 Enlistment enlistment = new Enlistment(tx, promotableSinglePhaseNotification, atomicTransaction);
95 tx._durableEnlistment = enlistment.InternalEnlistment;
97 if (log.IsEnabled())
98 {
100 }
101 tx._promoter = promotableSinglePhaseNotification;
103 {
105 }
106 else
107 {
109 }
111 return true;
112 }
113
115 {
116 int volatileEnlistmentCount = tx._phase0Volatiles._volatileEnlistmentCount;
117 int dependentClones = tx._phase0Volatiles._dependentClones;
118 tx._phase0VolatileWaveCount = volatileEnlistmentCount;
119 if (tx._phase0Volatiles._preparedVolatileEnlistments < volatileEnlistmentCount + dependentClones)
120 {
121 for (int i = 0; i < volatileEnlistmentCount; i++)
122 {
125 {
126 break;
127 }
128 }
129 }
130 else
131 {
133 }
134 }
135
137 {
138 }
139
141 {
142 }
143
144 internal override bool ContinuePhase0Prepares()
145 {
146 return true;
147 }
148
149 internal override void Promote(InternalTransaction tx)
150 {
154 }
155
157 {
158 if (tx._innerException == null)
159 {
160 tx._innerException = e;
161 }
163 }
164}
static DurableEnlistmentActive DurableEnlistmentActive
virtual void ChangeStatePreparing(InternalEnlistment enlistment)
InternalEnlistment InternalEnlistment
Definition Enlistment.cs:7
EnlistmentTraceIdentifier EnlistmentTraceId
override void Promote(InternalTransaction tx)
override void Phase0VolatilePrepareDone(InternalTransaction tx)
override Enlistment EnlistVolatile(InternalTransaction tx, IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction)
override Enlistment EnlistDurable(InternalTransaction tx, Guid resourceManagerIdentifier, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction)
override void RestartCommitIfNeeded(InternalTransaction tx)
override bool EnlistPromotableSinglePhase(InternalTransaction tx, IPromotableSinglePhaseNotification promotableSinglePhaseNotification, Transaction atomicTransaction, Guid promoterType)
override void Phase1VolatilePrepareDone(InternalTransaction tx)
override void ChangeStateTransactionAborted(InternalTransaction tx, Exception e)
override void EnterState(InternalTransaction tx)
override Enlistment EnlistDurable(InternalTransaction tx, Guid resourceManagerIdentifier, IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction)
override void Rollback(InternalTransaction tx, Exception e)
override Enlistment EnlistVolatile(InternalTransaction tx, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction)
static TransactionStateAborted TransactionStateAborted
static TransactionStateDelegated TransactionStateDelegated
virtual void CheckForFinishedTransaction(InternalTransaction tx)
static TransactionStatePSPEOperation TransactionStatePSPEOperation
void AddVolatileEnlistment(ref VolatileEnlistmentSet enlistments, Enlistment enlistment)
static TransactionStateVolatilePhase1 TransactionStateVolatilePhase1
void EnterState(InternalTransaction tx)
void CommonEnterState(InternalTransaction tx)
virtual void RestartCommitIfNeeded(InternalTransaction tx)
static TransactionStateDelegatedNonMSDTC TransactionStateDelegatedNonMSDTC
void TransactionstateEnlist(EnlistmentTraceIdentifier enlistmentID, EnlistmentType enlistmentType, EnlistmentOptions enlistmentOption)
static readonly TransactionsEtwProvider Log