]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
immutable: refactor ReadBucketProxy a little
authorZooko O'Whielacronx <zooko@zooko.com>
Wed, 17 Dec 2008 00:53:25 +0000 (17:53 -0700)
committerZooko O'Whielacronx <zooko@zooko.com>
Wed, 17 Dec 2008 00:53:25 +0000 (17:53 -0700)
src/allmydata/immutable/download.py
src/allmydata/immutable/layout.py

index c8d7d215537822d70d31966634dc4b5840c29b97..e0cb9ac8465e9083c66e1e8c96ed868f3612f65f 100644 (file)
@@ -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:
index 2da722bebe302a8419ef135c9e26d9b256e6e2b5..89153cf7361bfd635611ded9eaa4082c2fab9724 100644 (file)
@@ -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 = "<ReadBucketProxy to peer [%s] SI %s>" % (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 "<ReadBucketProxy to peer [%s] SI %s>" % (peerid_s,
-                                                         self._si_s)
+        return self._reprstr
 
     def startIfNecessary(self):
         if self._started: