From 7d15928faaa8d29f2b1c1b87a75f19cd036395e8 Mon Sep 17 00:00:00 2001 From: Zooko O'Whielacronx <zooko@zooko.com> Date: Thu, 8 Jan 2009 10:41:39 -0700 Subject: [PATCH] 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). --- src/allmydata/immutable/download.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 -- 2.45.2