From: Zooko O'Whielacronx <zooko@zooko.com>
Date: Fri, 2 Jan 2009 18:43:17 +0000 (-0700)
Subject: immutable: ValidatedExtendedURIProxy computes and stores block_size and share_size... 
X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/file//%22%22?a=commitdiff_plain;h=0ee027c180717334ad3c1fb5efbc5a87006c5bdf;p=tahoe-lafs%2Ftahoe-lafs.git

immutable: ValidatedExtendedURIProxy computes and stores block_size and share_size for the convenience of its users
---

diff --git a/src/allmydata/immutable/download.py b/src/allmydata/immutable/download.py
index 54b37a2a..ce40ba92 100644
--- a/src/allmydata/immutable/download.py
+++ b/src/allmydata/immutable/download.py
@@ -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