Show More
@@ -130,15 +130,8 b' class transaction(object):' | |||||
130 | This is used by strip to delay vision of strip offset. The transaction |
|
130 | This is used by strip to delay vision of strip offset. The transaction | |
131 | sees either none or all of the strip actions to be done.""" |
|
131 | sees either none or all of the strip actions to be done.""" | |
132 | q = self._queue.pop() |
|
132 | q = self._queue.pop() | |
133 | self.entries.extend(q) |
|
133 | for f, o, data in q: | |
134 |
|
134 | self._addentry(f, o, data) | ||
135 | offsets = [] |
|
|||
136 | for f, o, _data in q: |
|
|||
137 | offsets.append((f, o)) |
|
|||
138 |
|
||||
139 | d = ''.join(['%s\0%d\n' % (f, o) for f, o in offsets]) |
|
|||
140 | self.file.write(d) |
|
|||
141 | self.file.flush() |
|
|||
142 |
|
135 | |||
143 | @active |
|
136 | @active | |
144 | def add(self, file, offset, data=None): |
|
137 | def add(self, file, offset, data=None): | |
@@ -149,6 +142,12 b' class transaction(object):' | |||||
149 | self._queue[-1].append((file, offset, data)) |
|
142 | self._queue[-1].append((file, offset, data)) | |
150 | return |
|
143 | return | |
151 |
|
144 | |||
|
145 | self._addentry(file, offset, data) | |||
|
146 | ||||
|
147 | def _addentry(self, file, offset, data): | |||
|
148 | """add a append-only entry to memory and on-disk state""" | |||
|
149 | if file in self.map or file in self._backupmap: | |||
|
150 | return | |||
152 | self.entries.append((file, offset, data)) |
|
151 | self.entries.append((file, offset, data)) | |
153 | self.map[file] = len(self.entries) - 1 |
|
152 | self.map[file] = len(self.entries) - 1 | |
154 | # add enough data to the journal to do the truncate |
|
153 | # add enough data to the journal to do the truncate |
General Comments 0
You need to be logged in to leave comments.
Login now