From: Brian Warner Date: Thu, 7 Feb 2008 00:30:58 +0000 (-0700) Subject: helper: return full uri-extension data to the client, so it can compare encoding... X-Git-Tag: allmydata-tahoe-0.8.0~118 X-Git-Url: https://git.rkrishnan.org/specifications/banana.xhtml?a=commitdiff_plain;h=a2cace9cfbba258d1dac089e2351e71d5da943df;p=tahoe-lafs%2Ftahoe-lafs.git helper: return full uri-extension data to the client, so it can compare encoding parameters --- diff --git a/src/allmydata/encode.py b/src/allmydata/encode.py index 1e41ef12..d662e173 100644 --- a/src/allmydata/encode.py +++ b/src/allmydata/encode.py @@ -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 diff --git a/src/allmydata/offloaded.py b/src/allmydata/offloaded.py index 9561920a..2e2c4877 100644 --- a/src/allmydata/offloaded.py +++ b/src/allmydata/offloaded.py @@ -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) diff --git a/src/allmydata/upload.py b/src/allmydata/upload.py index becf5b03..2662f6a2 100644 --- a/src/allmydata/upload.py +++ b/src/allmydata/upload.py @@ -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,