From d9d55ad006146ae4e5b08b05729d6526e2faebd6 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Sat, 26 Feb 2011 19:11:42 -0700 Subject: [PATCH] immutable/offloaded.py: reduce use of get_serverid() a bit more --- src/allmydata/immutable/offloaded.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/allmydata/immutable/offloaded.py b/src/allmydata/immutable/offloaded.py index 26be7860..1f2cce99 100644 --- a/src/allmydata/immutable/offloaded.py +++ b/src/allmydata/immutable/offloaded.py @@ -9,7 +9,7 @@ from allmydata.storage.server import si_b2a from allmydata.immutable import upload from allmydata.immutable.layout import ReadBucketProxy from allmydata.util.assertutil import precondition -from allmydata.util import idlib, log, observer, fileutil, hashutil, dictutil +from allmydata.util import log, observer, fileutil, hashutil, dictutil class NotEnoughWritersError(Exception): @@ -56,20 +56,20 @@ class CHKCheckerAndUEBFetcher: for s in self._peer_getter(storage_index): d = s.get_rref().callRemote("get_buckets", storage_index) d.addCallbacks(self._got_response, self._got_error, - callbackArgs=(s.get_serverid(),)) + callbackArgs=(s,)) dl.append(d) return defer.DeferredList(dl) - def _got_response(self, buckets, peerid): + def _got_response(self, buckets, server): # buckets is a dict: maps shum to an rref of the server who holds it shnums_s = ",".join([str(shnum) for shnum in buckets]) self.log("got_response: [%s] has %d shares (%s)" % - (idlib.shortnodeid_b2a(peerid), len(buckets), shnums_s), + (server.name(), len(buckets), shnums_s), level=log.NOISY) self._found_shares.update(buckets.keys()) for k in buckets: - self._sharemap.add(k, peerid) - self._readers.update( [ (bucket, peerid) + self._sharemap.add(k, server.get_serverid()) + self._readers.update( [ (bucket, server) for bucket in buckets.values() ] ) def _got_error(self, f): @@ -84,8 +84,8 @@ class CHKCheckerAndUEBFetcher: if not self._readers: self.log("no readers, so no UEB", level=log.NOISY) return - b,peerid = self._readers.pop() - rbp = ReadBucketProxy(b, peerid, si_b2a(self._storage_index)) + b,server = self._readers.pop() + rbp = ReadBucketProxy(b, server.get_serverid(), si_b2a(self._storage_index)) d = rbp.get_uri_extension() d.addCallback(self._got_uri_extension) d.addErrback(self._ueb_error) -- 2.45.2