]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
storage: remove update_write_enabler method, it won't serve the desired purpose,...
authorBrian Warner <warner@lothar.com>
Tue, 22 Jul 2008 00:28:28 +0000 (17:28 -0700)
committerBrian Warner <warner@lothar.com>
Tue, 22 Jul 2008 00:28:28 +0000 (17:28 -0700)
src/allmydata/interfaces.py
src/allmydata/storage.py
src/allmydata/test/test_storage.py

index deb20c383eb41d24e3d0b7ee4263f76cf24214a4..6a8a8e0afc6b342dc977e8dbb0f8a3c3507a7ee6 100644 (file)
@@ -226,24 +226,6 @@ class RIStorageServer(RemoteInterface):
         """
         return TupleOf(bool, DictOf(int, ReadData))
 
-    def update_write_enabler(storage_index=StorageIndex,
-                             old_write_enabler=WriteEnablerSecret,
-                             new_write_enabler=WriteEnablerSecret):
-        """
-        Replace the write-enabler on a given bucket. This is used when a
-        share has been moved from one server to another, causing the secret
-        (which is scoped to a given server's nodeid) to become invalid. The
-        client discovers this when it gets a BadWriteEnablerError, and the
-        string body of the exception will contain a message that includes the
-        nodeid that was used for the old secret.
-
-        The client should compute the old write-enabler secret, and send it
-        in conjunction with the new one. The server will then update the
-        share to record the new write-enabler instead of the old one. The
-        client can then retry its writev call.
-        """
-        return None
-
 class IStorageBucketWriter(Interface):
     def put_block(segmentnum=int, data=ShareData):
         """@param data: For most segments, this data will be 'blocksize'
index 4029d966a740981fee8526f13ea9fc333d0f233d..eb512c3a542e9cb704eb20d654368cd5c357e6ab 100644 (file)
@@ -700,16 +700,6 @@ class MutableShareFile:
                   (idlib.nodeid_b2a(write_enabler_nodeid),)
             raise BadWriteEnablerError(msg)
 
-    def update_write_enabler(self, old_write_enabler, new_write_enabler,
-                             my_nodeid, si_s):
-        self.check_write_enabler(old_write_enabler, si_s)
-        f = open(self.home, 'rb+')
-        f.seek(0)
-        header = struct.pack(">32s20s32s",
-                             self.MAGIC, my_nodeid, new_write_enabler)
-        f.write(header)
-        f.close()
-
     def check_testv(self, testv):
         test_good = True
         f = open(self.home, 'rb+')
@@ -1199,15 +1189,6 @@ class StorageServer(service.MultiService, Referenceable):
         self.add_latency("readv", time.time() - start)
         return datavs
 
-    def remote_update_write_enabler(self, storage_index,
-                                    old_write_enabler, new_write_enabler):
-        si_s = si_b2a(storage_index)
-        for sf in self._iter_share_files(storage_index):
-            if not isinstance(sf, MutableShareFile):
-                continue
-            sf.update_write_enabler(old_write_enabler, new_write_enabler,
-                                    self.my_nodeid, si_s)
-
 
 # the code before here runs on the storage server, not the client
 # the code beyond here runs on the client, not the storage server
index 59004439f9f0de37d4c79cddce42a969a5b5e7c9..71626252169d935b04e6395990b6e3065feff903 100644 (file)
@@ -1077,43 +1077,6 @@ class MutableServer(unittest.TestCase):
         self.failUnlessRaises(IndexError,
                               ss.remote_cancel_lease, "si2", "nonsecret")
 
-    def test_update_write_enabler(self):
-        ss = self.create("test_update_write_enabler", sizelimit=1000*1000)
-        secrets = ( self.write_enabler("we1"),
-                    self.renew_secret("we1-0"),
-                    self.cancel_secret("we1-0") )
-        old_write_enabler = secrets[0]
-        new_write_enabler = self.write_enabler("we2")
-        new_secrets = (new_write_enabler, secrets[1], secrets[2])
-
-        data = "".join([ ("%d" % i) * 10 for i in range(10) ])
-        write = ss.remote_slot_testv_and_readv_and_writev
-        read = ss.remote_slot_readv
-        update_write_enabler = ss.remote_update_write_enabler
-
-        rc = write("si1", secrets, {0: ([], [(0,data)], None)}, [])
-        self.failUnlessEqual(rc, (True, {}))
-
-        rc = write("si1", secrets, {0: ([], [(1,data)], None)}, [])
-        self.failUnlessEqual(rc[0], True)
-
-        f = self.failUnlessRaises(BadWriteEnablerError,
-                                  write, "si1", new_secrets,
-                                  {}, [])
-        self.failUnless("The write enabler was recorded by nodeid 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'." in f, f)
-        ss.setNodeID("\xff" * 20)
-
-        rc = update_write_enabler("si1", old_write_enabler, new_write_enabler)
-        self.failUnlessEqual(rc, None)
-
-        f = self.failUnlessRaises(BadWriteEnablerError,
-                                  write, "si1", secrets,
-                                  {}, [])
-        self.failUnless("The write enabler was recorded by nodeid '77777777777777777777777777777777'." in f, f)
-
-        rc = write("si1", new_secrets, {0: ([], [(2,data)], None)}, [])
-        self.failUnlessEqual(rc[0], True)
-
 
 class Stats(unittest.TestCase):