From: Zooko O'Whielacronx Date: Wed, 17 Dec 2008 00:53:25 +0000 (-0700) Subject: immutable: refactor ReadBucketProxy a little X-Git-Url: https://git.rkrishnan.org/?a=commitdiff_plain;h=d5119411367515976d9f0ccd6d6ceb55d7f2ceb2;p=tahoe-lafs%2Ftahoe-lafs.git immutable: refactor ReadBucketProxy a little --- diff --git a/src/allmydata/immutable/download.py b/src/allmydata/immutable/download.py index c8d7d215..e0cb9ac8 100644 --- a/src/allmydata/immutable/download.py +++ b/src/allmydata/immutable/download.py @@ -772,7 +772,7 @@ class FileDownloader: (self._responses_received, self._queries_sent)) for sharenum, bucket in buckets.iteritems(): - b = layout.ReadBucketProxy(bucket, peerid, self._si_s) + b = layout.ReadBucketProxy(bucket, peerid, self._storage_index) self.add_share_bucket(sharenum, b) if self._results: diff --git a/src/allmydata/immutable/layout.py b/src/allmydata/immutable/layout.py index 2da722be..89153cf7 100644 --- a/src/allmydata/immutable/layout.py +++ b/src/allmydata/immutable/layout.py @@ -6,6 +6,7 @@ from allmydata.interfaces import IStorageBucketWriter, IStorageBucketReader, \ FileTooLargeError, HASH_SIZE from allmydata.util import mathutil, idlib from allmydata.util.assertutil import _assert, precondition +from allmydata import storage """ @@ -248,19 +249,19 @@ class WriteBucketProxy_v2(WriteBucketProxy): class ReadBucketProxy: implements(IStorageBucketReader) - def __init__(self, rref, peerid=None, storage_index_s=None): + def __init__(self, rref, peerid, storage_index): self._rref = rref self._peerid = peerid - self._si_s = storage_index_s + peer_id_s = idlib.shortnodeid_b2a(peerid) + storage_index_s = storage.si_b2a(storage_index) + self._reprstr = "" % (peer_id_s, storage_index_s) self._started = False def get_peerid(self): return self._peerid def __repr__(self): - peerid_s = idlib.shortnodeid_b2a(self._peerid) - return "" % (peerid_s, - self._si_s) + return self._reprstr def startIfNecessary(self): if self._started: