1 patch for repository zooko@dev.allmydata.org:/home/darcs/tahoe-lafs/trunk:

Mon Aug  2 00:20:04 MDT 2010  zooko@zooko.com
  * immutable: tidy-up some code by using a set instead of list to hold homeless_shares

New patches:

[immutable: tidy-up some code by using a set instead of list to hold homeless_shares
zooko@zooko.com**20100802062004
 Ignore-this: a70bda3cf6c48ab0f0688756b015cf8d
] {
hunk ./src/allmydata/immutable/upload.py 190
         self.servers_of_happiness = servers_of_happiness
         self.needed_shares = needed_shares
 
-        self.homeless_shares = range(total_shares)
+        self.homeless_shares = set(range(total_shares))
         self.contacted_peers = [] # peers worth asking again
         self.contacted_peers2 = [] # peers that we have asked again
         self._started_second_pass = False
hunk ./src/allmydata/immutable/upload.py 300
                     level=log.NOISY, parent=self._log_parent)
             for bucket in buckets:
                 self.preexisting_shares.setdefault(bucket, set()).add(peer)
-                if self.homeless_shares and bucket in self.homeless_shares:
-                    self.homeless_shares.remove(bucket)
+                self.homeless_shares.discard(bucket)
             self.full_count += 1
             self.bad_query_count += 1
 
hunk ./src/allmydata/immutable/upload.py 361
                         server, sharelist = items.pop()
                         if len(sharelist) > 1:
                             share = sharelist.pop()
-                            self.homeless_shares.append(share)
+                            self.homeless_shares.add(share)
                             self.preexisting_shares[share].remove(server)
                             if not self.preexisting_shares[share]:
                                 del self.preexisting_shares[share]
hunk ./src/allmydata/immutable/upload.py 385
             # TODO: don't pre-convert all peerids to PeerTrackers
             assert isinstance(peer, PeerTracker)
 
-            shares_to_ask = set([self.homeless_shares.pop(0)])
+            shares_to_ask = set(sorted(self.homeless_shares)[:1])
+            self.homeless_shares -= shares_to_ask
             self.query_count += 1
             self.num_peers_contacted += 1
             if self._status:
hunk ./src/allmydata/immutable/upload.py 407
             num_shares = mathutil.div_ceil(len(self.homeless_shares),
                                            len(self.contacted_peers))
             peer = self.contacted_peers.pop(0)
-            shares_to_ask = set(self.homeless_shares[:num_shares])
-            self.homeless_shares[:num_shares] = []
+            shares_to_ask = set(sorted(self.homeless_shares)[:num_shares])
+            self.homeless_shares -= shares_to_ask
             self.query_count += 1
             if self._status:
                 self._status.set_status("Contacting Peers [%s] (second query),"
hunk ./src/allmydata/immutable/upload.py 455
                     level=log.UNUSUAL, parent=self._log_parent)
             self.error_count += 1
             self.bad_query_count += 1
-            self.homeless_shares = list(shares_to_ask) + self.homeless_shares
+            self.homeless_shares |= shares_to_ask
             if (self.uncontacted_peers
                 or self.contacted_peers
                 or self.contacted_peers2):
hunk ./src/allmydata/immutable/upload.py 516
 
                 # some shares are still homeless, keep trying to find them a
                 # home. The ones that were rejected get first priority.
-                self.homeless_shares = (list(still_homeless)
-                                        + self.homeless_shares)
+                self.homeless_shares |= still_homeless
                 # Since they were unable to accept all of our requests, so it
                 # is safe to assume that asking them again won't help.
             else:
}

Context:

[docs: add Jacob Lyles to CREDITS
zooko@zooko.com**20100730230500
 Ignore-this: 9dbbd6a591b4b1a5a8dcb69b7b757792
] 
[web: don't use %d formatting on a potentially large negative float -- there is a bug in Python 2.5 in that case
jacob.lyles@gmail.com**20100730220550
 Ignore-this: 7080eb4bddbcce29cba5447f8f4872ee
 fixes #1055
] 
[docs: fix licensing typo that was earlier fixed in [20090921164651-92b7f-7f97b58101d93dc588445c52a9aaa56a2c7ae336]
zooko@zooko.com**20100729052923
 Ignore-this: a975d79115911688e5469d4d869e1664
 I wish we didn't copies of this licensing text in several different files so that changes can be accidentally omitted from some of them.
] 
[misc/build_helpers/run-with-pythonpath.py: fix stale comment, and remove 'trial' example that is not the right way to run trial.
david-sarah@jacaranda.org**20100726225729
 Ignore-this: a61f55557ad69a1633bfb2b8172cce97
] 
[docs/specifications/dirnodes.txt: 'mesh'->'grid'.
david-sarah@jacaranda.org**20100723061616
 Ignore-this: 887bcf921ef00afba8e05e9239035bca
] 
[docs/specifications/dirnodes.txt: bring layer terminology up-to-date with architecture.txt, and a few other updates (e.g. note that the MAC is no longer verified, and that URIs can be unknown). Also 'Tahoe'->'Tahoe-LAFS'.
david-sarah@jacaranda.org**20100723054703
 Ignore-this: f3b98183e7d0a0f391225b8b93ac6c37
] 
[__init__.py: silence DeprecationWarning about BaseException.message globally. fixes #1129
david-sarah@jacaranda.org**20100720011939
 Ignore-this: 38808986ba79cb2786b010504a22f89
] 
[test_runner: test that 'tahoe --version' outputs no noise (e.g. DeprecationWarnings).
david-sarah@jacaranda.org**20100720011345
 Ignore-this: dd358b7b2e5d57282cbe133e8069702e
] 
[docs: use current cap to Zooko's wiki page in example text
zooko@zooko.com**20100721010543
 Ignore-this: 4f36f36758f9fdbaf9eb73eac23b6652
 fixes #1134
] 
[TAG allmydata-tahoe-1.7.1
zooko@zooko.com**20100719131352
 Ignore-this: 6942056548433dc653a746703819ad8c
] 
Patch bundle hash:
f56a05301bf0f3319810c21e786303c5d54bac16
