141 def __exit__(self, exctype, exc, traceback): |
141 def __exit__(self, exctype, exc, traceback): |
142 self.session.reset_security(self.oldread, self.oldwrite) |
142 self.session.reset_security(self.oldread, self.oldwrite) |
143 |
143 |
144 |
144 |
145 class Transaction(object): |
145 class Transaction(object): |
146 """Small object hold core Transaction data""" |
146 """Repository Transaction |
|
147 |
|
148 Holds all transaction related data |
|
149 |
|
150 Database connections resource: |
|
151 |
|
152 :attr:`cnxset`, the connections set to use to execute queries on sources. |
|
153 If the transaction is read only, the connection set may be freed between |
|
154 actual query. This allows multiple transaction with a reasonable low |
|
155 connection set pool size. control mechanism is detailed below |
|
156 |
|
157 :attr:`mode`, string telling the connections set handling mode, may be one |
|
158 of 'read' (connections set may be freed), 'write' (some write was done in |
|
159 the connections set, it can't be freed before end of the transaction), |
|
160 'transaction' (we want to keep the connections set during all the |
|
161 transaction, with or without writing) |
|
162 """ |
|
163 |
147 def __init__(self, txid): |
164 def __init__(self, txid): |
148 #: transaction unique id |
165 #: transaction unique id |
149 self.transactionid = txid |
166 self.transactionid = txid |
150 #: reentrance handling |
167 #: reentrance handling |
151 self.ctx_count = 0 |
168 self.ctx_count = 0 |
152 |
169 |
|
170 #: connection handling mode |
|
171 self.mode = None |
|
172 #: connection set used to execute queries on sources |
|
173 self.cnxset = None |
153 |
174 |
154 class Session(RequestSessionBase): |
175 class Session(RequestSessionBase): |
155 """Repository user session |
176 """Repository user session |
156 |
177 |
157 This tie all together: |
178 This tie all together: |