mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-20 05:28:04 +00:00
storageserver.ReadBucketProxy: break out _parse_offsets, for debug tools
This commit is contained in:
parent
7589a8ee82
commit
35117d77a0
@ -302,8 +302,12 @@ class ReadBucketProxy:
|
||||
def start(self):
|
||||
# TODO: for small shares, read the whole bucket in start()
|
||||
d = self._read(0, 8*4)
|
||||
d.addCallback(self._parse_offsets)
|
||||
return d
|
||||
|
||||
def _parse_offsets(self, data):
|
||||
precondition(len(data) == 8*4)
|
||||
self._offsets = {}
|
||||
def _got_offsets(data):
|
||||
self._segment_size = struct.unpack(">L", data[0:4])[0]
|
||||
self._data_size = struct.unpack(">L", data[4:8])[0]
|
||||
x = 0x08
|
||||
@ -317,8 +321,7 @@ class ReadBucketProxy:
|
||||
offset = struct.unpack(">L", data[x:x+4])[0]
|
||||
x += 4
|
||||
self._offsets[field] = offset
|
||||
d.addCallback(_got_offsets)
|
||||
return d
|
||||
return self._offsets
|
||||
|
||||
def get_block(self, blocknum):
|
||||
num_segments = mathutil.div_ceil(self._data_size, self._segment_size)
|
||||
|
Loading…
Reference in New Issue
Block a user