make current upload/download status objects available from the client

This commit is contained in:
Brian Warner 2008-02-12 15:39:45 -07:00
parent 94097affc3
commit e6af3b845c
4 changed files with 20 additions and 0 deletions

View File

@ -280,3 +280,10 @@ class Client(node.Node, testutil.PollMixin):
uploader = self.getServiceNamed("uploader")
return uploader.upload(uploadable)
def list_uploads(self):
uploader = self.getServiceNamed("uploader")
return uploader.list_uploads()
def list_downloads(self):
downloader = self.getServiceNamed("downloader")
return downloader.list_downloads()

View File

@ -871,3 +871,5 @@ class Downloader(service.MultiService):
return self.download(uri, FileHandle(filehandle))
def list_downloads(self):
return self._all_downloads.keys()

View File

@ -1374,6 +1374,14 @@ class IClient(Interface):
IDirectoryNode-providing instances, like NewDirectoryNode.
"""
class IClientStatus(Interface):
def list_uploads():
"""Return a list of IUploadStatus objects, one for each
upload which is currently running."""
def list_downloads():
"""Return a list of IDownloadStatus objects, one for each
download which is currently running."""
class IUploadStatus(Interface):
def get_storage_index():
"""Return a string with the (binary) storage index in use on this

View File

@ -1167,3 +1167,6 @@ class Uploader(service.MultiService):
return res
d.addBoth(_done)
return d
def list_uploads(self):
return self._all_uploads.keys()