mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-19 03:06:33 +00:00
helper: return full uri-extension data to the client, so it can compare encoding parameters
This commit is contained in:
parent
6cd32c2f5c
commit
a2cace9cfb
@ -669,3 +669,6 @@ class Encoder(object):
|
||||
def get_times(self):
|
||||
# return a dictionary of encode+push timings
|
||||
return self._times
|
||||
|
||||
def get_uri_extension_data(self):
|
||||
return self.uri_extension_data
|
||||
|
@ -194,6 +194,7 @@ class CHKUploadHelper(Referenceable, upload.CHKUploader):
|
||||
(uri_extension_hash, needed_shares, total_shares, size) = res
|
||||
r = self._results
|
||||
r.uri_extension_hash = uri_extension_hash
|
||||
r.uri_extension_data = self._encoder.get_uri_extension_data()
|
||||
f_times = self._fetcher.get_times()
|
||||
r.timings["cumulative_fetch"] = f_times["cumulative_fetch"]
|
||||
r.ciphertext_fetched = self._fetcher.get_ciphertext_fetched()
|
||||
@ -529,6 +530,12 @@ class Helper(Referenceable, service.MultiService):
|
||||
(sharemap, ueb_data, ueb_hash) = res
|
||||
self.log("found file in grid", level=log.NOISY, parent=lp)
|
||||
results.uri_extension_hash = ueb_hash
|
||||
results.sharemap = {}
|
||||
for shnum, peerids in sharemap.items():
|
||||
peers_s = ",".join(["[%s]" % idlib.shortnodeid_b2a(peerid)
|
||||
for peerid in peerids])
|
||||
results.sharemap[shnum] = "Found on " + peers_s
|
||||
results.uri_extension_data = ueb_data
|
||||
return True
|
||||
return False
|
||||
d.addCallback(_checked)
|
||||
|
@ -842,6 +842,7 @@ class AssistedUploader:
|
||||
# stash these for URI generation later
|
||||
self._needed_shares = k
|
||||
self._total_shares = n
|
||||
self._segment_size = segment_size
|
||||
|
||||
def _got_encryption_key(self, key):
|
||||
self._key = key
|
||||
@ -896,6 +897,10 @@ class AssistedUploader:
|
||||
def _build_readcap(self, upload_results):
|
||||
self.log("upload finished, building readcap")
|
||||
r = upload_results
|
||||
assert r.uri_extension_data["needed_shares"] == self._needed_shares
|
||||
assert r.uri_extension_data["total_shares"] == self._total_shares
|
||||
assert r.uri_extension_data["segment_size"] == self._segment_size
|
||||
assert r.uri_extension_data["size"] == self._size
|
||||
u = uri.CHKFileURI(key=self._key,
|
||||
uri_extension_hash=r.uri_extension_hash,
|
||||
needed_shares=self._needed_shares,
|
||||
|
Loading…
Reference in New Issue
Block a user