]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blobdiff - src/allmydata/magicfolderdb.py
Add last uploaded timestamp comparison for remote conflict detection
[tahoe-lafs/tahoe-lafs.git] / src / allmydata / magicfolderdb.py
index 0c76a7b012a6cbc3ffd38c32d93032010599bf4b..e3649d4edea3e6db91df162400a454467acc0f95 100644 (file)
@@ -91,6 +91,22 @@ class MagicFolderDB(object):
         else:
             return row[0]
 
+    def get_last_uploaded_uri(self, relpath_u):
+        """
+        Return the last downloaded uri recorded in the magic folder db.
+        If none are found then return None.
+        """
+        c = self.cursor
+        c.execute("SELECT last_uploaded_uri"
+                  " FROM local_files"
+                  " WHERE path=?",
+                  (relpath_u,))
+        row = self.cursor.fetchone()
+        if not row:
+            return None
+        else:
+            return row[0]
+
     def get_local_file_version(self, relpath_u):
         """
         Return the version of a local file tracked by our magic folder db.