Progress API

- IProgress interface + PercentProgress implementation
 - progress= args to many upload/download APIs
 - ultimately for magic-folder
This commit is contained in:
meejah
2015-11-12 16:16:28 -07:00
committed by Brian Warner
parent bb7184163e
commit db517e8edd
15 changed files with 171 additions and 43 deletions

View File

@ -588,7 +588,7 @@ class DirectoryNode:
return d
def add_file(self, namex, uploadable, metadata=None, overwrite=True):
def add_file(self, namex, uploadable, metadata=None, overwrite=True, progress=None):
"""I upload a file (using the given IUploadable), then attach the
resulting FileNode to the directory at the given name. I return a
Deferred that fires (with the IFileNode of the uploaded file) when
@ -596,7 +596,7 @@ class DirectoryNode:
name = normalize(namex)
if self.is_readonly():
return defer.fail(NotWriteableError())
d = self._uploader.upload(uploadable)
d = self._uploader.upload(uploadable, progress=progress)
d.addCallback(lambda results:
self._create_and_validate_node(results.get_uri(), None,
name))