]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Add db util function for retrieving all downloaded files
authorDavid Stainton <dstainton415@gmail.com>
Mon, 31 Aug 2015 21:38:31 +0000 (23:38 +0200)
committerDaira Hopwood <daira@jacaranda.org>
Tue, 15 Sep 2015 17:42:59 +0000 (18:42 +0100)
src/allmydata/backupdb.py

index 7ec3881c5f63b54cf43ebc3b70c153b256c02a57..3f43eee0ca54cec8046eb485760b0090b44320f4 100644 (file)
@@ -368,6 +368,17 @@ class BackupDB:
 class MagicFolderDB(BackupDB):
     VERSION = 3
 
+    def get_all_files(self):
+        """Retreive a list of all files that have had an entry in magic-folder db
+        (files that have been downloaded at least once).
+        """
+        self.cursor.execute("SELECT path FROM local_files")
+        rows = self.cursor.fetchall()
+        if not rows:
+            return None
+        else:
+            return rows
+
     def get_local_file_version(self, path):
         """I will tell you the version of a local file tracked by our magic folder db.
         If no db entry found then I'll return None.