r.uri_extension_hash = uri_extension_hash
f_times = self._fetcher.get_times()
r.timings["cumulative_fetch"] = f_times["cumulative_fetch"]
+ r.ciphertext_fetched = self._fetcher.get_ciphertext_fetched()
r.timings["total_fetch"] = f_times["total"]
self._reader.close()
os.unlink(self._encoding_file)
"cumulative_fetch": 0.0,
"total": 0.0,
}
+ self._ciphertext_fetched = 0
def log(self, *args, **kwargs):
if "facility" not in kwargs:
for data in ciphertext_v:
self._f.write(data)
self._have += len(data)
+ self._ciphertext_fetched += len(data)
return False # not done
d.addCallback(_got_data)
return d
def get_times(self):
return self._times
+ def get_ciphertext_fetched(self):
+ return self._ciphertext_fetched
+
class LocalCiphertextReader(AskUntilSuccessMixin):
implements(interfaces.IEncryptedUploadable)
<ul>
<li>Storage Index: <span n:render="time" n:data="time_storage_index" />
(<span n:render="rate" n:data="rate_storage_index" />)</li>
+ <li>[Contacting Helper]: <span n:render="time" n:data="time_contacting_helper" /></li>
+ <li>[Upload Ciphertext To Helper]: <span n:render="time" n:data="time_cumulative_fetch" />
+ (<span n:render="rate" n:data="rate_ciphertext_fetch" />)</li>
+ <li>[Helper Total]: <span n:render="time" n:data="time_helper_total" /></li>
+
<li>Peer Selection: <span n:render="time" n:data="time_peer_selection" /></li>
<li>Encode And Push: <span n:render="time" n:data="time_total_encode_and_push" /></li>
<ul>
def data_time_storage_index(self, ctx, data):
return self._get_time("storage_index")
+ def data_time_contacting_helper(self, ctx, data):
+ return self._get_time("contacting_helper")
+
+ def data_time_cumulative_fetch(self, ctx, data):
+ return self._get_time("cumulative_fetch")
+
+ def data_time_helper_total(self, ctx, data):
+ return self._get_time("helper_total")
+
def data_time_peer_selection(self, ctx, data):
return self._get_time("peer_selection")
def data_rate_push(self, ctx, data):
return self._get_rate("cumulative_sending")
+ def data_rate_ciphertext_fetch(self, ctx, data):
+ d = self.upload_results()
+ def _convert(r):
+ fetch_size = r.ciphertext_fetched
+ if fetch_size is None:
+ return None
+ time = r.timings.get("cumulative_fetch")
+ if time is None:
+ return None
+ try:
+ return 1.0 * fetch_size / time
+ except ZeroDivisionError:
+ return None
+ d.addCallback(_convert)
+ return d
class UnlinkedPOSTSSKUploader(rend.Page):
def renderHTTP(self, ctx):