~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transactions.py

  • Committer: John Arbash Meinel
  • Author(s): Mark Hammond
  • Date: 2008-09-09 17:02:21 UTC
  • mto: This revision was merged to the branch mainline in revision 3697.
  • Revision ID: john@arbash-meinel.com-20080909170221-svim3jw2mrz0amp3
An updated transparent icon for bzr.

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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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
 
 
41
39
import sys
42
40
 
43
41
import bzrlib.errors as errors
65
63
 
66
64
    def register_clean(self, an_object, precious=False):
67
65
        """Register an_object as being clean.
68
 
 
 
66
        
69
67
        If the precious hint is True, the object will not
70
68
        be ejected from the object identity map ever.
71
69
        """
141
139
 
142
140
    def register_dirty(self, an_object):
143
141
        """Register an_object as being dirty.
144
 
 
 
142
        
145
143
        Dirty objects are not ejected from the identity map
146
144
        until the transaction finishes and get informed
147
145
        when the transaction finishes.
156
154
        """Write transactions allow writes."""
157
155
        return True
158
156
 
159
 
 
 
157
        
160
158
class PassThroughTransaction(object):
161
159
    """A pass through transaction
162
 
 
 
160
    
163
161
    - nothing is cached.
164
162
    - nothing ever gets into the identity map.
165
163
    """
178
176
 
179
177
    def register_clean(self, an_object, precious=False):
180
178
        """Register an_object as being clean.
181
 
 
 
179
        
182
180
        Note that precious is only a hint, and PassThroughTransaction
183
181
        ignores it.
184
182
        """
185
183
 
186
184
    def register_dirty(self, an_object):
187
185
        """Register an_object as being dirty.
188
 
 
 
186
        
189
187
        Dirty objects get informed
190
188
        when the transaction finishes.
191
189
        """