From d5119411367515976d9f0ccd6d6ceb55d7f2ceb2 Mon Sep 17 00:00:00 2001
From: Zooko O'Whielacronx <zooko@zooko.com>
Date: Tue, 16 Dec 2008 17:53:25 -0700
Subject: [PATCH] immutable: refactor ReadBucketProxy a little

---
 src/allmydata/immutable/download.py |  2 +-
 src/allmydata/immutable/layout.py   | 11 ++++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

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 = "<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:
-- 
2.45.2