From: Brian Warner Date: Thu, 14 Dec 2006 11:17:01 +0000 (-0700) Subject: make initial simple encode_new test pass X-Git-Tag: tahoe_v0.1.0-0-UNSTABLE~425 X-Git-Url: https://git.rkrishnan.org/components/%22news.html/frontends/FTP-and-SFTP.txt?a=commitdiff_plain;h=3e5e2ee9fe750c462db7352c6c910b5145e31047;p=tahoe-lafs%2Ftahoe-lafs.git make initial simple encode_new test pass --- diff --git a/src/allmydata/chunk.py b/src/allmydata/chunk.py index ec904191..59495b43 100644 --- a/src/allmydata/chunk.py +++ b/src/allmydata/chunk.py @@ -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. """ diff --git a/src/allmydata/encode_new.py b/src/allmydata/encode_new.py index f2ff0ad1..c7396c7e 100644 --- a/src/allmydata/encode_new.py +++ b/src/allmydata/encode_new.py @@ -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): diff --git a/src/allmydata/test/test_encode.py b/src/allmydata/test/test_encode.py index 9e8b42c3..f37cc68b 100644 --- a/src/allmydata/test/test_encode.py +++ b/src/allmydata/test/test_encode.py @@ -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)