##// END OF EJS Templates
transaction: make map a private attribute...
Gregory Szorc -
r39720:1a68c9b1 default
parent child Browse files
Show More
@@ -130,7 +130,7 b' class transaction(util.transactional):'
130 130 self._vfsmap = vfsmap
131 131 self._after = after
132 132 self.entries = []
133 self.map = {}
133 self._map = {}
134 134 self._journal = journalname
135 135 self._undoname = undoname
136 136 self._queue = []
@@ -218,7 +218,7 b' class transaction(util.transactional):'
218 218 @active
219 219 def add(self, file, offset, data=None):
220 220 """record the state of an append-only file before update"""
221 if file in self.map or file in self._backupmap:
221 if file in self._map or file in self._backupmap:
222 222 return
223 223 if self._queue:
224 224 self._queue[-1].append((file, offset, data))
@@ -228,10 +228,10 b' class transaction(util.transactional):'
228 228
229 229 def _addentry(self, file, offset, data):
230 230 """add a append-only entry to memory and on-disk state"""
231 if file in self.map or file in self._backupmap:
231 if file in self._map or file in self._backupmap:
232 232 return
233 233 self.entries.append((file, offset, data))
234 self.map[file] = len(self.entries) - 1
234 self._map[file] = len(self.entries) - 1
235 235 # add enough data to the journal to do the truncate
236 236 self._file.write("%s\0%d\n" % (file, offset))
237 237 self._file.flush()
@@ -251,7 +251,7 b' class transaction(util.transactional):'
251 251 msg = 'cannot use transaction.addbackup inside "group"'
252 252 raise error.ProgrammingError(msg)
253 253
254 if file in self.map or file in self._backupmap:
254 if file in self._map or file in self._backupmap:
255 255 return
256 256 vfs = self._vfsmap[location]
257 257 dirname, filename = vfs.split(file)
@@ -351,8 +351,8 b' class transaction(util.transactional):'
351 351
352 352 @active
353 353 def find(self, file):
354 if file in self.map:
355 return self.entries[self.map[file]]
354 if file in self._map:
355 return self.entries[self._map[file]]
356 356 if file in self._backupmap:
357 357 return self._backupentries[self._backupmap[file]]
358 358 return None
@@ -364,9 +364,9 b' class transaction(util.transactional):'
364 364 that are not pending in the queue
365 365 '''
366 366
367 if file not in self.map:
367 if file not in self._map:
368 368 raise KeyError(file)
369 index = self.map[file]
369 index = self._map[file]
370 370 self.entries[index] = (file, offset, data)
371 371 self._file.write("%s\0%d\n" % (file, offset))
372 372 self._file.flush()
General Comments 0
You need to be logged in to leave comments. Login now