From 245f36cd111a88a9125143c6764f4571b46b9979 Mon Sep 17 00:00:00 2001 From: David Stainton <dstainton415@gmail.com> Date: Mon, 31 Aug 2015 23:38:31 +0200 Subject: [PATCH] Add db util function for retrieving all downloaded files --- src/allmydata/backupdb.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/allmydata/backupdb.py b/src/allmydata/backupdb.py index 7ec3881c..3f43eee0 100644 --- a/src/allmydata/backupdb.py +++ b/src/allmydata/backupdb.py @@ -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. -- 2.45.2