mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-07 19:04:21 +00:00
make initial simple encode_new test pass
This commit is contained in:
parent
8a858f745d
commit
3e5e2ee9fe
@ -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.
|
||||
"""
|
||||
|
@ -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):
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user