Performance: pipeline-sends.diff

File pipeline-sends.diff, 1.5 KB (added by warner, at 2007-09-09T00:10:23Z)

patch to pipeline the hash-sends during upload

  • src/allmydata/encode.py

    old new  
    240240
    241241        d.addCallback(lambda res: self.finish_hashing())
    242242
    243         d.addCallback(lambda res:
    244                       self.send_plaintext_hash_tree_to_all_shareholders())
    245         d.addCallback(lambda res:
    246                       self.send_crypttext_hash_tree_to_all_shareholders())
    247         d.addCallback(lambda res: self.send_all_subshare_hash_trees())
    248         d.addCallback(lambda res: self.send_all_share_hash_trees())
    249         d.addCallback(lambda res: self.send_uri_extension_to_all_shareholders())
     243        d.addCallback(lambda res: self.send_hashes_and_close())
    250244
    251         d.addCallback(lambda res: self.close_all_shareholders())
    252245        d.addCallbacks(lambda res: self.done(), self.err)
    253246        return d
    254247
     
    451444        d.addCallback(_got_hashtree_nodes)
    452445        return d
    453446
     447    def send_hashes_and_close(self):
     448        dl = []
     449        dl.append(self.send_plaintext_hash_tree_to_all_shareholders())
     450        dl.append(self.send_crypttext_hash_tree_to_all_shareholders())
     451        dl.append(self.send_all_subshare_hash_trees())
     452        dl.append(self.send_all_share_hash_trees())
     453        dl.append(self.send_uri_extension_to_all_shareholders())
     454        dl.append(self.close_all_shareholders())
     455        return self._gather_responses(dl)
     456
    454457    def send_plaintext_hash_tree_to_all_shareholders(self):
    455458        log.msg("%s sending plaintext hash tree" % self)
    456459        dl = []