]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
fetcher.py: improve comments
authorBrian Warner <warner@lothar.com>
Wed, 4 Aug 2010 07:28:14 +0000 (00:28 -0700)
committerBrian Warner <warner@lothar.com>
Wed, 4 Aug 2010 07:28:14 +0000 (00:28 -0700)
src/allmydata/immutable/downloader/fetcher.py

index 3918f659b401726e3edfa37d354cf0565453986e..e30ced851dd38f0d212e721677d5fa468865b1a2 100644 (file)
@@ -161,13 +161,17 @@ class SegmentFetcher:
             # that will trigger the ShareFinder to keep looking
 
     def _find_one(self, shares, state):
-        # TODO could choose fastest
+        # TODO could choose fastest, or avoid servers already in use
         for s in shares:
             if self._shares[s] == state:
                 return s
         # can never get here, caller has assert in case of code bug
 
     def _send_new_request(self):
+        # TODO: this is probably O(k^2), and we're called from a range(k)
+        # loop, so O(k^3)
+
+        # this first loop prefers sh0, then sh1, sh2, etc
         for shnum,shares in sorted(self._shnums.iteritems()):
             states = [self._shares[s] for s in shares]
             if COMPLETE in states or PENDING in states: