]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
WIP fix for delete
authormeejah <meejah@meejah.ca>
Fri, 23 Oct 2015 23:49:43 +0000 (17:49 -0600)
committermeejah <meejah@meejah.ca>
Mon, 26 Oct 2015 14:10:28 +0000 (08:10 -0600)
src/allmydata/frontends/magic_folder.py
src/allmydata/test/test_magic_folder.py

index 4362add20f3bd8bff5cb4e6a7baaeb121ce3d113..8816ccb53a6e98231599d42a111754c077be9621 100644 (file)
@@ -64,6 +64,8 @@ class MagicFolder(service.MultiService):
 
         self.uploader = Uploader(client, local_path_u, db, upload_dircap, pending_delay, clock)
         self.downloader = Downloader(client, local_path_u, db, collective_dircap, clock)
+        # FIXME FIXME FIXME horrible, just trying it out
+        self.downloader._deleted_files = self.uploader._deleted_files
 
     def startService(self):
         # TODO: why is this being called more than once?
@@ -205,6 +207,14 @@ class Uploader(QueueMixin):
         self._notifier.watch(self._local_filepath, mask=self.mask, callbacks=[self._notify],
                              recursive=True)
 
+        # we keep a list of files we've "recently" deleted, as we'll
+        # get inotify events for these, but we want to ignore
+        # them. (e.g. if we just decided we need to delete a file
+        # locally, we don't want to immediately upload a new "deleted"
+        # version of it)
+        self._deleted_files = []
+
+
     def start_monitoring(self):
         self._log("start_monitoring")
         d = defer.succeed(None)
@@ -678,6 +688,7 @@ class Downloader(QueueMixin, WriteFileMixin):
     def _unlink_deleted_file(self, abspath_u, result):
         try:
             self._log('unlinking: %s' % (abspath_u,))
+            self._deleted_files.append(abspath_u)
             shutil.move(abspath_u, abspath_u + '.tmp')
         except IOError:
             self._log("Already gone: '%s'" % (abspath_u,))
index 0410c7a873534514bd24a74a6836ac8a306d117b..f9f62cb489cdb2fb4ab41a053f1d956a68659178 100644 (file)
@@ -416,7 +416,7 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
             yield d1
 
     @defer.inlineCallbacks
-    def test_alice_create_bob_update():
+    def test_alice_create_bob_update(self):
         alice_clock = task.Clock()
         bob_clock = task.Clock()
         caps = yield self.setup_alice_and_bob(alice_clock, bob_clock)