From: Zooko O'Whielacronx Date: Thu, 8 Jan 2009 17:41:39 +0000 (-0700) Subject: immutable: ValidatedExtendedURIProxy computes and stores the tail data size as a... X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/using.html?a=commitdiff_plain;h=7d15928faaa8d29f2b1c1b87a75f19cd036395e8;p=tahoe-lafs%2Ftahoe-lafs.git immutable: ValidatedExtendedURIProxy computes and stores the tail data size as a convenience to its caller. The "tail data size" is how many of the bytes of the tail segment are data (as opposed to padding). --- diff --git a/src/allmydata/immutable/download.py b/src/allmydata/immutable/download.py index 0f5a0f81..25b3adb6 100644 --- a/src/allmydata/immutable/download.py +++ b/src/allmydata/immutable/download.py @@ -204,6 +204,7 @@ class ValidatedExtendedURIProxy: self.block_size = None self.share_size = None self.num_segments = None + self.tail_data_size = None self.tail_segment_size = None # optional @@ -246,11 +247,11 @@ class ValidatedExtendedURIProxy: 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 - if not tail_data_size: - tail_data_size = self.segment_size + self.tail_data_size = self._verifycap.size % self.segment_size + if not self.tail_data_size: + self.tail_data_size = self.segment_size # padding for erasure code - self.tail_segment_size = mathutil.next_multiple(tail_data_size, self._verifycap.needed_shares) + self.tail_segment_size = mathutil.next_multiple(self.tail_data_size, self._verifycap.needed_shares) # Ciphertext hash tree root is mandatory, so that there is at most one ciphertext that # matches this read-cap or verify-cap. The integrity check on the shares is not