]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Simplify and document the type of MagicFolder._download_scan_batch.
authorDaira Hopwood <daira@jacaranda.org>
Thu, 23 Jul 2015 22:15:24 +0000 (23:15 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Wed, 30 Sep 2015 15:45:24 +0000 (16:45 +0100)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/frontends/magic_folder.py

index 995b652abd760e72cb187d218fb69212ed6ca343..7532f2b19314cd04b817169023d0722c396a77df 100644 (file)
@@ -51,7 +51,7 @@ class MagicFolder(service.MultiService):
         self._local_dir = local_dir
         self._upload_lazy_tail = defer.succeed(None)
         self._upload_pending = set()
-        self._download_scan_batch = {}
+        self._download_scan_batch = {} # path -> [(filenode, metadata)]
         self._download_lazy_tail = defer.succeed(None)
         self._download_pending = set()
         self._collective_dirnode = None
@@ -168,9 +168,9 @@ class MagicFolder(service.MultiService):
             for name in listing_map.keys():
                 file_node, metadata = listing_map[name]
                 if self._download_scan_batch.has_key(name):
-                    self._download_scan_batch[name] += [(name, file_node, metadata)]
+                    self._download_scan_batch[name] += [(file_node, metadata)]
                 else:
-                    self._download_scan_batch[name] = [(name, file_node, metadata)]
+                    self._download_scan_batch[name] = [(file_node, metadata)]
         listing_d.addCallback(scan_listing)
         return listing_d
 
@@ -200,11 +200,11 @@ class MagicFolder(service.MultiService):
         self._download_pending.update(map(lambda x: x[0], result))
 
     def _filter_scan_batch(self, result):
-        extension = []
+        extension = [] # consider whether this should be a dict
         for name in self._download_scan_batch.keys():
             if name in self._download_pending:
                 continue
-            name, file_node, metadata = max(self._download_scan_batch[name], key=lambda x: x[2]['version'])
+            file_node, metadata = max(self._download_scan_batch[name], key=lambda x: x[1]['version'])
             if self._should_download(name, metadata['version']):
                 extension += [(name, file_node, metadata)]
         return extension