]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
helper: return full uri-extension data to the client, so it can compare encoding...
authorBrian Warner <warner@allmydata.com>
Thu, 7 Feb 2008 00:30:58 +0000 (17:30 -0700)
committerBrian Warner <warner@allmydata.com>
Thu, 7 Feb 2008 00:30:58 +0000 (17:30 -0700)
src/allmydata/encode.py
src/allmydata/offloaded.py
src/allmydata/upload.py

index 1e41ef1202719ad46afced24661a4ccc8a075b4f..d662e173156d5a06b3a595a852160111b9017663 100644 (file)
@@ -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
index 9561920a125491f1c44600d702ee19ddca41f494..2e2c4877807ec3903c4a7f00c2b420624b5f8e08 100644 (file)
@@ -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)
index becf5b03493c936fa93ed90320e032d1c0f73802..2662f6a296101d0e13723e58e2861fa395baad80 100644 (file)
@@ -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,