self.history = History(self.stats_provider)
self.terminator = Terminator()
self.terminator.setServiceParent(self)
- self.add_service(Uploader(helper_furl, self.stats_provider))
+ self.add_service(Uploader(helper_furl, self.stats_provider,
+ self.history))
self.init_stub_client()
self.init_blacklist()
self.init_nodemaker()
def upload(self, uploadable):
uploader = self.getServiceNamed("uploader")
- return uploader.upload(uploadable, history=self.get_history())
+ return uploader.upload(uploadable)
name = "uploader"
URI_LIT_SIZE_THRESHOLD = 55
- def __init__(self, helper_furl=None, stats_provider=None):
+ def __init__(self, helper_furl=None, stats_provider=None, history=None):
self._helper_furl = helper_furl
self.stats_provider = stats_provider
+ self._history = history
self._helper = None
self._all_uploads = weakref.WeakKeyDictionary() # for debugging
log.PrefixingLogMixin.__init__(self, facility="tahoe.immutable.upload")
return (self._helper_furl, bool(self._helper))
- def upload(self, uploadable, history=None):
+ def upload(self, uploadable):
"""
Returns a Deferred that will fire with the UploadResults instance.
"""
d2.addCallback(lambda x: uploader.start(eu))
self._all_uploads[uploader] = None
- if history:
- history.add_upload(uploader.get_upload_status())
+ if self._history:
+ self._history.add_upload(uploader.get_upload_status())
def turn_verifycap_into_read_cap(uploadresults):
# Generate the uri from the verifycap plus the key.
d3 = uploadable.get_encryption_key()
convergence = self.secret_holder.get_convergence_secret()
packed = pack_children(children, None, deep_immutable=True)
uploadable = Data(packed, convergence)
- d = self.uploader.upload(uploadable, history=self.history)
+ d = self.uploader.upload(uploadable)
d.addCallback(lambda results: self.create_from_cap(None, results.uri))
d.addCallback(self._create_dirnode)
return d
class FakeUploader(service.Service):
name = "uploader"
- def upload(self, uploadable, history=None):
+ def upload(self, uploadable):
d = uploadable.get_size()
d.addCallback(lambda size: uploadable.read(size))
def _got_data(datav):