mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-08 19:34:18 +00:00
immutable: ValidatedExtendedURIProxy computes and stores block_size and share_size for the convenience of its users
This commit is contained in:
parent
f1feb08f6a
commit
0ee027c180
@ -189,6 +189,8 @@ class ValidatedExtendedURIProxy:
|
||||
self.share_root_hash = None
|
||||
|
||||
# computed
|
||||
self.block_size = None
|
||||
self.share_size = None
|
||||
self.num_segments = None
|
||||
self.tail_segment_size = None
|
||||
|
||||
@ -210,6 +212,8 @@ class ValidatedExtendedURIProxy:
|
||||
return data
|
||||
|
||||
def _parse_and_validate(self, data):
|
||||
self.share_size = mathutil.div_ceil(self._verifycap.size, self._verifycap.needed_shares)
|
||||
|
||||
d = uri.unpack_extension(data)
|
||||
|
||||
# There are several kinds of things that can be found in a UEB. First, things that we
|
||||
@ -227,6 +231,7 @@ class ValidatedExtendedURIProxy:
|
||||
# crypttext_root_hash, and share_root_hash.
|
||||
self.segment_size = d['segment_size']
|
||||
|
||||
self.block_size = mathutil.div_ceil(self.segment_size, self._verifycap.needed_shares)
|
||||
self.num_segments = mathutil.div_ceil(self._verifycap.size, self.segment_size)
|
||||
|
||||
tail_data_size = self._verifycap.size % self.segment_size
|
||||
|
Loading…
x
Reference in New Issue
Block a user