Show More
@@ -221,6 +221,11 b' class Block(dict):' | |||||
221 |
|
221 | |||
222 | contains up to 16 entry indexed from 0 to 15""" |
|
222 | contains up to 16 entry indexed from 0 to 15""" | |
223 |
|
223 | |||
|
224 | def __init__(self): | |||
|
225 | super(Block, self).__init__() | |||
|
226 | # If this block exist on disk, here is its ID | |||
|
227 | self.ondisk_id = None | |||
|
228 | ||||
224 | def __iter__(self): |
|
229 | def __iter__(self): | |
225 | return iter(self.get(i) for i in range(16)) |
|
230 | return iter(self.get(i) for i in range(16)) | |
226 |
|
231 | |||
@@ -323,8 +328,8 b' def parse_data(data):' | |||||
323 | new_blocks = [] |
|
328 | new_blocks = [] | |
324 | for i in range(0, len(data), S_BLOCK.size): |
|
329 | for i in range(0, len(data), S_BLOCK.size): | |
325 | block = Block() |
|
330 | block = Block() | |
326 | ondisk_id = len(block_map) |
|
331 | block.ondisk_id = len(block_map) | |
327 | block_map[ondisk_id] = block |
|
332 | block_map[block.ondisk_id] = block | |
328 | block_data = data[i : i + S_BLOCK.size] |
|
333 | block_data = data[i : i + S_BLOCK.size] | |
329 | values = S_BLOCK.unpack(block_data) |
|
334 | values = S_BLOCK.unpack(block_data) | |
330 | new_blocks.append((block, values)) |
|
335 | new_blocks.append((block, values)) |
General Comments 0
You need to be logged in to leave comments.
Login now