]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
encode: clean up some weirdness that was there to make unit tests easier to write
authorBrian Warner <warner@lothar.com>
Fri, 6 Apr 2007 05:36:18 +0000 (22:36 -0700)
committerBrian Warner <warner@lothar.com>
Fri, 6 Apr 2007 05:36:18 +0000 (22:36 -0700)
src/allmydata/encode.py
src/allmydata/test/test_encode.py

index a0e929229812ae522f6739e926b0c7452e0859a4..7d958b378960fad3810417e5557ee3d7b48579d3 100644 (file)
@@ -229,11 +229,8 @@ class Encoder(object):
         return dl
 
     def send_subshare(self, shareid, segment_num, subshare):
-        return self.send(shareid, "put_block", segment_num, subshare)
-
-    def send(self, shareid, methname, *args, **kwargs):
-        ll = self.landlords[shareid]
-        return ll.callRemote(methname, *args, **kwargs)
+        sh = self.landlords[shareid]
+        return sh.callRemote("put_block", segment_num, subshare)
 
     def send_all_subshare_hash_trees(self):
         dl = []
@@ -250,7 +247,8 @@ 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[shareid] = t[0]
-        return self.send(shareid, "put_block_hashes", all_hashes)
+        sh = self.landlords[shareid]
+        return sh.callRemote("put_block_hashes", all_hashes)
 
     def send_all_share_hash_trees(self):
         dl = []
@@ -272,12 +270,13 @@ class Encoder(object):
         return defer.DeferredList(dl)
 
     def send_one_share_hash_tree(self, shareid, needed_hashes):
-        return self.send(shareid, "put_share_hashes", needed_hashes)
+        sh = self.landlords[shareid]
+        return sh.callRemote("put_share_hashes", needed_hashes)
 
     def close_all_shareholders(self):
         dl = []
         for shareid in range(self.num_shares):
-            dl.append(self.send(shareid, "close"))
+            dl.append(self.landlords[shareid].callRemote("close"))
         return defer.DeferredList(dl)
 
     def done(self):
index 71a91d7e34fe9af0ae5cb8391d17dffb367b6e5c..6372af89885155221b8a68f1ec36aa2a2690aa97 100644 (file)
@@ -7,14 +7,6 @@ from allmydata import encode, download
 from allmydata.uri import pack_uri
 from cStringIO import StringIO
 
-class MyEncoder(encode.Encoder):
-    def send(self, share_num, methname, *args, **kwargs):
-        if False and share_num < 10:
-            print "send[%d].%s()" % (share_num, methname)
-            if methname == "put_share_hashes":
-                print " ", [i for i,h in args[0]]
-        return defer.succeed(None)
-
 class FakePeer:
     def __init__(self, mode="good"):
         self.ss = FakeStorageServer(mode)