]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
make initial simple encode_new test pass
authorBrian Warner <warner@lothar.com>
Thu, 14 Dec 2006 11:17:01 +0000 (04:17 -0700)
committerBrian Warner <warner@lothar.com>
Thu, 14 Dec 2006 11:17:01 +0000 (04:17 -0700)
src/allmydata/chunk.py
src/allmydata/encode_new.py
src/allmydata/test/test_encode.py

index ec904191335da4351ab466decd37b329a339e2eb..59495b43ec6c42caf17c7d5d3ab34a78106e3b55 100644 (file)
@@ -133,7 +133,7 @@ class CompleteBinaryTreeMixin:
     else:
       return self.lchild(parent)
 
-  def needed(self, i):
+  def needed_for(self, i):
     """
     Return a list of nodes that are necessary for the hash chain.
     """
index f2ff0ad1f8f2a3271be6e6a5e319f878b6123300..c7396c7e648657ccfd4f775d503f5ece0dff5129 100644 (file)
@@ -145,11 +145,10 @@ class Encoder(object):
         # all_hashes[1] is the left child, == hash(ah[3]+ah[4])
         # all_hashes[n] == hash(all_hashes[2*n+1] + all_hashes[2*n+2])
         self.share_root_hashes[share_num] = t[0]
-        ll = self.landlords[share_num]
         if False:
             block = "".join(all_hashes)
-            return ll.callRemote("write", block, offset=0)
-        return ll.callRemote("put_subshare_hashes", all_hashes)
+            return self.send(share_num, "write", block, offset=0)
+        return self.send(share_num, "put_subshare_hashes", all_hashes)
 
     def send_all_share_hash_trees(self):
         dl = []
@@ -166,13 +165,12 @@ class Encoder(object):
         return defer.DeferredList(dl)
 
     def send_one_share_hash_tree(self, share_num, needed_hashes):
-        ll = self.landlords[share_num]
-        return ll.callRemote("put_share_hashes", needed_hashes)
+        return self.send(share_num, "put_share_hashes", needed_hashes)
 
     def close_all_shareholders(self):
         dl = []
-        for ll in self.landlords:
-            dl.append(ll.callRemote("close"))
+        for share_num in range(self.num_shares):
+            dl.append(self.send(share_num, "close"))
         return defer.DeferredList(dl)
 
     def done(self):
index 9e8b42c382c155c4c32087beb227fd6d838873b1..f37cc68bf97f5a279cc98126455514af8d452b13 100644 (file)
@@ -10,7 +10,7 @@ class MyEncoder(encode_new.Encoder):
         return defer.succeed(None)
 
 class Encode(unittest.TestCase):
-    def OFFtest_1(self):
+    def test_1(self):
         e = MyEncoder()
         data = StringIO("some data to encode\n")
         e.setup(data)