From: Brian Warner Date: Tue, 12 Feb 2008 22:39:45 +0000 (-0700) Subject: make current upload/download status objects available from the client X-Git-Tag: allmydata-tahoe-0.8.0~89 X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/class-simplejson.JSONDecoder-index.html?a=commitdiff_plain;h=e6af3b845c7a76767c3b4362344b00df2a3bf61f;p=tahoe-lafs%2Ftahoe-lafs.git make current upload/download status objects available from the client --- diff --git a/src/allmydata/client.py b/src/allmydata/client.py index f485a4d5..7314cb6f 100644 --- a/src/allmydata/client.py +++ b/src/allmydata/client.py @@ -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() diff --git a/src/allmydata/download.py b/src/allmydata/download.py index eb5cd539..4d382771 100644 --- a/src/allmydata/download.py +++ b/src/allmydata/download.py @@ -871,3 +871,5 @@ class Downloader(service.MultiService): return self.download(uri, FileHandle(filehandle)) + def list_downloads(self): + return self._all_downloads.keys() diff --git a/src/allmydata/interfaces.py b/src/allmydata/interfaces.py index f76c674d..986ed4db 100644 --- a/src/allmydata/interfaces.py +++ b/src/allmydata/interfaces.py @@ -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 diff --git a/src/allmydata/upload.py b/src/allmydata/upload.py index 3ea412bc..af51cd11 100644 --- a/src/allmydata/upload.py +++ b/src/allmydata/upload.py @@ -1167,3 +1167,6 @@ class Uploader(service.MultiService): return res d.addBoth(_done) return d + + def list_uploads(self): + return self._all_uploads.keys()