class MagicFolder(service.MultiService):
name = 'magic-folder'
- def __init__(self, client, upload_dircap, collective_dircap, local_path_u, dbfile, inotify=None,
+ def __init__(self, client, upload_dircap, collective_dircap, local_path_u, dbfile,
pending_delay=1.0):
precondition_abspath(local_path_u)
self.is_ready = False
- self.uploader = Uploader(client, local_path_u, db, upload_dircap, inotify, pending_delay)
+ self.uploader = Uploader(client, local_path_u, db, upload_dircap, pending_delay)
self.downloader = Downloader(client, local_path_u, db, collective_dircap)
def startService(self):
class Uploader(QueueMixin):
- def __init__(self, client, local_path_u, db, upload_dircap, inotify, pending_delay):
+ def __init__(self, client, local_path_u, db, upload_dircap, pending_delay):
QueueMixin.__init__(self, client, local_path_u, db, 'uploader')
print "Magic-Folder: Uploader: __init__"
if self._upload_dirnode.is_unknown() or self._upload_dirnode.is_readonly():
raise AssertionError("The URI in 'private/magic_folder_dircap' is not a writecap to a directory.")
- self._inotify = inotify or get_inotify_module()
+ self._inotify = get_inotify_module()
self._notifier = self._inotify.INotify()
if hasattr(self._notifier, 'set_pending_delay'):
def init_magicfolder(self, client_num, upload_dircap, collective_dircap, local_magic_dir):
dbfile = abspath_expanduser_unicode(u"magicfolderdb.sqlite", base=self.get_clientdir(i=client_num))
magicfolder = MagicFolder(self.get_client(client_num), upload_dircap, collective_dircap, local_magic_dir,
- dbfile, inotify=self.inotify, pending_delay=0.2)
+ dbfile, pending_delay=0.2)
magicfolder.setServiceParent(self.get_client(client_num))
magicfolder.ready()
return magicfolder
dbfile = abspath_expanduser_unicode(u"private/magicfolderdb.sqlite", base=self.get_clientdir(i=client_num))
self.collective_dircap, self.upload_dircap = self.get_caps_from_files(client_num)
self.magicfolder = MagicFolder(self.get_client(client_num), self.upload_dircap, self.collective_dircap, self.local_dir,
- dbfile, inotify=self.inotify, pending_delay=0.2)
+ dbfile, pending_delay=0.2)
self.magicfolder.setServiceParent(self.get_client(client_num))
return self.magicfolder.ready()
dbfile = abspath_expanduser_unicode(u"magicfolderdb.sqlite", base=self.basedir)
print "<>--< dbfile %s" % (dbfile,)
self.magicfolder = MagicFolder(self.get_client(), self.upload_dircap, self.collective_dircap, self.local_dir,
- dbfile, inotify=self.inotify, pending_delay=0.2)
+ dbfile, pending_delay=0.2)
self.magicfolder.setServiceParent(self.get_client())
self.magicfolder.ready()
readonly_dircap = n.get_readonly_uri()
self.shouldFail(AssertionError, 'nonexistent local.directory', 'there is no directory',
- MagicFolder, client, upload_dircap, '', doesnotexist, magicfolderdb, inotify=fake_inotify)
+ MagicFolder, client, upload_dircap, '', doesnotexist, magicfolderdb)
self.shouldFail(AssertionError, 'non-directory local.directory', 'is not a directory',
- MagicFolder, client, upload_dircap, '', not_a_dir, magicfolderdb, inotify=fake_inotify)
+ MagicFolder, client, upload_dircap, '', not_a_dir, magicfolderdb)
self.shouldFail(AssertionError, 'bad upload.dircap', 'does not refer to a directory',
- MagicFolder, client, 'bad', '', errors_dir, magicfolderdb, inotify=fake_inotify)
+ MagicFolder, client, 'bad', '', errors_dir, magicfolderdb)
self.shouldFail(AssertionError, 'non-directory upload.dircap', 'does not refer to a directory',
- MagicFolder, client, 'URI:LIT:foo', '', errors_dir, magicfolderdb, inotify=fake_inotify)
+ MagicFolder, client, 'URI:LIT:foo', '', errors_dir, magicfolderdb)
self.shouldFail(AssertionError, 'readonly upload.dircap', 'is not a writecap to a directory',
- MagicFolder, client, readonly_dircap, '', errors_dir, magicfolderdb, inotify=fake_inotify)
+ MagicFolder, client, readonly_dircap, '', errors_dir, magicfolderdb,)
self.shouldFail(AssertionError, 'collective dircap',
"The URI in 'private/collective_dircap' is not a readonly cap to a directory.",
- MagicFolder, client, upload_dircap, upload_dircap, errors_dir, magicfolderdb, inotify=fake_inotify)
+ MagicFolder, client, upload_dircap, upload_dircap, errors_dir, magicfolderdb)
def _not_implemented():
raise NotImplementedError("blah")