From 6c060be82d28194839e6bbdfa07703c768d6736c Mon Sep 17 00:00:00 2001 From: David Stainton <dstainton415@gmail.com> Date: Tue, 30 Jun 2015 17:33:37 -0700 Subject: [PATCH] Add magic-folder download callback --- src/allmydata/frontends/magic_folder.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py index 8131cad7..9ad4f44a 100644 --- a/src/allmydata/frontends/magic_folder.py +++ b/src/allmydata/frontends/magic_folder.py @@ -85,7 +85,9 @@ class MagicFolder(service.MultiService): raise AssertionError("The URI in 'private/magic_folder_dircap' is not a writecap to a directory.") self._processed_callback = lambda ign: None + self._download_callback = lambda ign: None self._ignore_count = 0 + self._download_ignore_count = 0 self._notifier = inotify.INotify() if hasattr(self._notifier, 'set_pending_delay'): @@ -283,10 +285,19 @@ class MagicFolder(service.MultiService): self._ignore_count -= 1 return None # intentionally suppress failures, which have already been logged + def set_download_callback(self, callback, ignore_count=0): + """ + set_download_callback sets a function that will be called after a + remote filesystem notification has been processed (successfully or unsuccessfully). + """ + self._download_callback = callback + self._download_ignore_count = ignore_count + + def set_processed_callback(self, callback, ignore_count=0): """ - This sets a function that will be called after a notification has been processed - (successfully or unsuccessfully). + set_processed_callback sets a function that will be called after a + local filesystem notification has been processed (successfully or unsuccessfully). """ self._processed_callback = callback self._ignore_count = ignore_count -- 2.45.2