From: meejah Date: Fri, 23 Oct 2015 23:49:43 +0000 (-0600) Subject: WIP fix for delete X-Git-Url: https://git.rkrishnan.org/CLI.txt?a=commitdiff_plain;h=68c0852ad10556cbd7e78de41e487c305c6952b9;p=tahoe-lafs%2Ftahoe-lafs.git WIP fix for delete --- diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py index 4362add2..8816ccb5 100644 --- a/src/allmydata/frontends/magic_folder.py +++ b/src/allmydata/frontends/magic_folder.py @@ -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,)) diff --git a/src/allmydata/test/test_magic_folder.py b/src/allmydata/test/test_magic_folder.py index 0410c7a8..f9f62cb4 100644 --- a/src/allmydata/test/test_magic_folder.py +++ b/src/allmydata/test/test_magic_folder.py @@ -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)