from allmydata import uri
from twisted.internet.interfaces import IConsumer
from allmydata.interfaces import IImmutableFileNode, IUploadResults
-from allmydata.util import consumer
+from allmydata.util import consumer, progress
from allmydata.check_results import CheckResults, CheckAndRepairResults
from allmydata.util.dictutil import DictOfSets
from allmydata.util.happinessutil import servers_of_happiness
# we keep it here, we should also put this on CiphertextFileNode
def __hash__(self):
return self.u.__hash__()
+
def __eq__(self, other):
if isinstance(other, ImmutableFileNode):
return self.u.__eq__(other.u)
else:
return False
+
def __ne__(self, other):
if isinstance(other, ImmutableFileNode):
return self.u.__eq__(other.u)
def get_uri(self):
return self.u.to_string()
+
def get_cap(self):
return self.u
+
def get_readcap(self):
return self.u.get_readonly()
+
def get_verify_cap(self):
return self.u.get_verify_cap()
+
def get_repair_cap(self):
# CHK files can be repaired with just the verifycap
return self.u.get_verify_cap()
def get_size(self):
return self.u.get_size()
+
def get_current_size(self):
return defer.succeed(self.get_size())
def check_and_repair(self, monitor, verify=False, add_lease=False):
return self._cnode.check_and_repair(monitor, verify, add_lease)
+
def check(self, monitor, verify=False, add_lease=False):
return self._cnode.check(monitor, verify, add_lease)
"""
return defer.succeed(self)
-
- def download_best_version(self):
+ def download_best_version(self, progress=None):
"""
Download the best version of this file, returning its contents
as a bytestring. Since there is only one version of an immutable
file, we download and return the contents of this file.
"""
- d = consumer.download_to_data(self)
+ d = consumer.download_to_data(self, progress=progress)
return d
# for an immutable file, download_to_data (specified in IReadable)