immutable: ValidatedExtendedURIProxy computes and stores block_size and share_size...
authorZooko O'Whielacronx <zooko@zooko.com>
Fri, 2 Jan 2009 18:43:17 +0000 (11:43 -0700)
committerZooko O'Whielacronx <zooko@zooko.com>
Fri, 2 Jan 2009 18:43:17 +0000 (11:43 -0700)
src/allmydata/immutable/download.py

index 54b37a2a709d6ba268dfb259db6d73f5122daa05..ce40ba929e8dbee04bbb2f9804da5ddd3cae7a39 100644 (file)
@@ -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