From: Brian Warner <warner@lothar.com>
Date: Wed, 4 Aug 2010 07:28:14 +0000 (-0700)
Subject: fetcher.py: improve comments
X-Git-Tag: allmydata-tahoe-1.8.0b2~13
X-Git-Url: https://git.rkrishnan.org/components/CLI.txt?a=commitdiff_plain;h=fa34e4dd16813923e800573f32933a1bde8fb3e7;p=tahoe-lafs%2Ftahoe-lafs.git

fetcher.py: improve comments
---

diff --git a/src/allmydata/immutable/downloader/fetcher.py b/src/allmydata/immutable/downloader/fetcher.py
index 3918f659..e30ced85 100644
--- a/src/allmydata/immutable/downloader/fetcher.py
+++ b/src/allmydata/immutable/downloader/fetcher.py
@@ -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: