~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transactions.py

(vila) Fix test failures blocking package builds. (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#
14
14
# You should have received a copy of the GNU General Public License
15
15
# along with this program; if not, write to the Free Software
16
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
"""This module provides a transactional facility.
19
19
 
30
30
write ordering approach we use for consistency 'dirty' is a misleading term.
31
31
A dirty object is one we have modified.
32
32
 
33
 
Both read and write transactions *may* flush unchanged objects out of 
34
 
memory, unless they are marked as 'precious' which indicates that 
 
33
Both read and write transactions *may* flush unchanged objects out of
 
34
memory, unless they are marked as 'precious' which indicates that
35
35
repeated reads cannot be obtained if the object is ejected, or that
36
36
the object is an expensive one for obtaining.
37
37
"""
38
38
 
 
39
from __future__ import absolute_import
 
40
 
39
41
import sys
40
42
 
41
43
import bzrlib.errors as errors
63
65
 
64
66
    def register_clean(self, an_object, precious=False):
65
67
        """Register an_object as being clean.
66
 
        
 
68
 
67
69
        If the precious hint is True, the object will not
68
70
        be ejected from the object identity map ever.
69
71
        """
139
141
 
140
142
    def register_dirty(self, an_object):
141
143
        """Register an_object as being dirty.
142
 
        
 
144
 
143
145
        Dirty objects are not ejected from the identity map
144
146
        until the transaction finishes and get informed
145
147
        when the transaction finishes.
154
156
        """Write transactions allow writes."""
155
157
        return True
156
158
 
157
 
        
 
159
 
158
160
class PassThroughTransaction(object):
159
161
    """A pass through transaction
160
 
    
 
162
 
161
163
    - nothing is cached.
162
164
    - nothing ever gets into the identity map.
163
165
    """
176
178
 
177
179
    def register_clean(self, an_object, precious=False):
178
180
        """Register an_object as being clean.
179
 
        
 
181
 
180
182
        Note that precious is only a hint, and PassThroughTransaction
181
183
        ignores it.
182
184
        """
183
185
 
184
186
    def register_dirty(self, an_object):
185
187
        """Register an_object as being dirty.
186
 
        
 
188
 
187
189
        Dirty objects get informed
188
190
        when the transaction finishes.
189
191
        """