From: Brian Warner Date: Tue, 1 Dec 2009 22:54:38 +0000 (-0500) Subject: remove MutableFileNode.download(), prefer download_best_version() instead X-Git-Url: https://git.rkrishnan.org/vdrive/%22news.html/...?a=commitdiff_plain;h=a980ea337bcd74dca34938246c5b29292cdc2a68;p=tahoe-lafs%2Ftahoe-lafs.git remove MutableFileNode.download(), prefer download_best_version() instead --- diff --git a/src/allmydata/mutable/filenode.py b/src/allmydata/mutable/filenode.py index 4e531b96..f8e12b5f 100644 --- a/src/allmydata/mutable/filenode.py +++ b/src/allmydata/mutable/filenode.py @@ -278,21 +278,6 @@ class MutableFileNode: ################################# # IMutableFileNode - # allow the use of IDownloadTarget - def download(self, target): - # fake it. TODO: make this cleaner. - d = self.download_best_version() - def _done(data): - target.open(len(data)) - target.write(data) - target.close() - return target.finish() - d.addCallback(_done) - return d - - - # new API - def download_best_version(self): return self._do_serialized(self._download_best_version) def _download_best_version(self): diff --git a/src/allmydata/test/common.py b/src/allmydata/test/common.py index 7113cceb..ef2f6795 100644 --- a/src/allmydata/test/common.py +++ b/src/allmydata/test/common.py @@ -270,6 +270,8 @@ class FakeMutableFileNode: return d def download_best_version(self): + if self.storage_index not in self.all_contents: + return defer.fail(NotEnoughSharesError(None, 0, 3)) return defer.succeed(self.all_contents[self.storage_index]) def overwrite(self, new_contents): if len(new_contents) > self.MUTABLE_SIZELIMIT: @@ -288,22 +290,6 @@ class FakeMutableFileNode: self.all_contents[self.storage_index] = modifier(old_contents, None, True) return None - def download(self, target): - if self.storage_index not in self.all_contents: - f = failure.Failure(NotEnoughSharesError(None, 0, 3)) - target.fail(f) - return defer.fail(f) - data = self.all_contents[self.storage_index] - target.open(len(data)) - target.write(data) - target.close() - return defer.maybeDeferred(target.finish) - def download_to_data(self): - if self.storage_index not in self.all_contents: - return defer.fail(NotEnoughSharesError(None, 0, 3)) - data = self.all_contents[self.storage_index] - return defer.succeed(data) - def make_mutable_file_cap(): return uri.WriteableSSKFileURI(writekey=os.urandom(16), fingerprint=os.urandom(32))