]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
MDMF: s/Writable/Writeable/g, for consistency with existing SDMF code
authorBrian Warner <warner@lothar.com>
Sat, 27 Aug 2011 18:33:57 +0000 (11:33 -0700)
committerBrian Warner <warner@lothar.com>
Sat, 27 Aug 2011 18:33:57 +0000 (11:33 -0700)
src/allmydata/interfaces.py
src/allmydata/mutable/filenode.py
src/allmydata/nodemaker.py
src/allmydata/test/common.py
src/allmydata/test/test_mutable.py
src/allmydata/test/test_uri.py
src/allmydata/uri.py

index 69ca62390614d5e55cca8a29b8a01f4468a823a8..3081e94e2fdf7fe65d8911798072bea6eeccc2c1 100644 (file)
@@ -641,7 +641,7 @@ class IReadable(Interface):
         """
 
 
-class IWritable(Interface):
+class IWriteable(Interface):
     """
     I define methods that callers can use to update SDMF and MDMF
     mutable files on a Tahoe-LAFS grid.
index e798a58970b42ac7b633d92f1ca566b417f98bfe..9f70e2106d05c2b69ec0489c29ba5f6c23cf5a60 100644 (file)
@@ -6,11 +6,11 @@ from twisted.internet import defer, reactor
 from foolscap.api import eventually
 from allmydata.interfaces import IMutableFileNode, ICheckable, ICheckResults, \
      NotEnoughSharesError, MDMF_VERSION, SDMF_VERSION, IMutableUploadable, \
-     IMutableFileVersion, IWritable
+     IMutableFileVersion, IWriteable
 from allmydata.util import hashutil, log, consumer, deferredutil, mathutil
 from allmydata.util.assertutil import precondition
 from allmydata.uri import WriteableSSKFileURI, ReadonlySSKFileURI, \
-                          WritableMDMFFileURI, ReadonlyMDMFFileURI
+                          WriteableMDMFFileURI, ReadonlyMDMFFileURI
 from allmydata.monitor import Monitor
 from pycryptopp.cipher.aes import AES
 
@@ -96,7 +96,7 @@ class MutableFileNode:
         # verification key, nor things like 'k' or 'N'. If and when someone
         # wants to get our contents, we'll pull from shares and fill those
         # in.
-        if isinstance(filecap, (WritableMDMFFileURI, ReadonlyMDMFFileURI)):
+        if isinstance(filecap, (WriteableMDMFFileURI, ReadonlyMDMFFileURI)):
             self._protocol_version = MDMF_VERSION
         elif isinstance(filecap, (ReadonlySSKFileURI, WriteableSSKFileURI)):
             self._protocol_version = SDMF_VERSION
@@ -146,7 +146,7 @@ class MutableFileNode:
         self._encprivkey = self._encrypt_privkey(self._writekey, privkey_s)
         self._fingerprint = hashutil.ssk_pubkey_fingerprint_hash(pubkey_s)
         if version == MDMF_VERSION:
-            self._uri = WritableMDMFFileURI(self._writekey, self._fingerprint)
+            self._uri = WriteableMDMFFileURI(self._writekey, self._fingerprint)
             self._protocol_version = version
         elif version == SDMF_VERSION:
             self._uri = WriteableSSKFileURI(self._writekey, self._fingerprint)
@@ -723,7 +723,7 @@ class MutableFileVersion:
     overwrite or modify the contents of the mutable file that I
     reference.
     """
-    implements(IMutableFileVersion, IWritable)
+    implements(IMutableFileVersion, IWriteable)
 
     def __init__(self,
                  node,
index fbf527c2a8c18658aa0921eec786abfdc20bd64b..b70ed601ad748e81581f51ecee28f2c57db64c79 100644 (file)
@@ -97,7 +97,7 @@ class NodeMaker:
         if isinstance(cap, uri.CHKFileVerifierURI):
             return self._create_immutable_verifier(cap)
         if isinstance(cap, (uri.ReadonlySSKFileURI, uri.WriteableSSKFileURI,
-                            uri.WritableMDMFFileURI, uri.ReadonlyMDMFFileURI)):
+                            uri.WriteableMDMFFileURI, uri.ReadonlyMDMFFileURI)):
             return self._create_mutable(cap)
         if isinstance(cap, (uri.DirectoryURI,
                             uri.ReadonlyDirectoryURI,
index 61cb1dc3075ec9c127c32539183a88272f9dc8f9..1e29f0d58054aa609e94a5af735dbedd0bc04b77 100644 (file)
@@ -223,11 +223,11 @@ class FakeMutableFileNode:
     def init_from_cap(self, filecap):
         assert isinstance(filecap, (uri.WriteableSSKFileURI,
                                     uri.ReadonlySSKFileURI,
-                                    uri.WritableMDMFFileURI,
+                                    uri.WriteableMDMFFileURI,
                                     uri.ReadonlyMDMFFileURI))
         self.my_uri = filecap
         self.storage_index = self.my_uri.get_storage_index()
-        if isinstance(filecap, (uri.WritableMDMFFileURI,
+        if isinstance(filecap, (uri.WriteableMDMFFileURI,
                                 uri.ReadonlyMDMFFileURI)):
             self.file_types[self.storage_index] = MDMF_VERSION
 
@@ -384,7 +384,7 @@ class FakeMutableFileNode:
     def get_best_mutable_version(self):
         return defer.succeed(self)
 
-    # Ditto for this, which is an implementation of IWritable.
+    # Ditto for this, which is an implementation of IWriteable.
     # XXX: Declare that the same is implemented.
     def update(self, data, offset):
         assert not self.is_readonly()
@@ -408,7 +408,7 @@ def make_mutable_file_cap():
                                    fingerprint=os.urandom(32))
 
 def make_mdmf_mutable_file_cap():
-    return uri.WritableMDMFFileURI(writekey=os.urandom(16),
+    return uri.WriteableMDMFFileURI(writekey=os.urandom(16),
                                    fingerprint=os.urandom(32))
 
 def make_mutable_file_uri(mdmf=False):
index deb4a58ceb0873e2a0d9cf21203facdc90e0f460..e6eea1eebbe9918b593911e67330003eea1efb45 100644 (file)
@@ -344,7 +344,7 @@ class Filenode(unittest.TestCase, testutil.ShouldFailMixin):
         def _created(n):
             self.failUnless(isinstance(n, MutableFileNode))
             cap = n.get_cap()
-            self.failUnless(isinstance(cap, uri.WritableMDMFFileURI))
+            self.failUnless(isinstance(cap, uri.WriteableMDMFFileURI))
             rcap = n.get_readcap()
             self.failUnless(isinstance(rcap, uri.ReadonlyMDMFFileURI))
             vcap = n.get_verify_cap()
@@ -3039,7 +3039,7 @@ class Version(GridTestMixin, unittest.TestCase, testutil.ShouldFailMixin, \
         # That's essentially what MDMF node is, so just check that.
         mdmf_uri = self.mdmf_node.get_uri()
         cap = uri.from_string(mdmf_uri)
-        self.failUnless(isinstance(cap, uri.WritableMDMFFileURI))
+        self.failUnless(isinstance(cap, uri.WriteableMDMFFileURI))
         readonly_mdmf_uri = self.mdmf_node.get_readonly_uri()
         cap = uri.from_string(readonly_mdmf_uri)
         self.failUnless(isinstance(cap, uri.ReadonlyMDMFFileURI))
index 27b98534e52d81c678736f01eb1c1e4416ffc4ce..e1bb7d7167a3d876d9f6330d6d91273289881e4a 100644 (file)
@@ -348,9 +348,9 @@ class Mutable(testutil.ReallyEqualMixin, unittest.TestCase):
 
 
     def test_writable_mdmf_cap(self):
-        u1 = uri.WritableMDMFFileURI(self.writekey, self.fingerprint)
+        u1 = uri.WriteableMDMFFileURI(self.writekey, self.fingerprint)
         cap = u1.to_string()
-        u = uri.WritableMDMFFileURI.init_from_string(cap)
+        u = uri.WriteableMDMFFileURI.init_from_string(cap)
 
         self.failUnless(IMutableFileURI.providedBy(u))
         self.failUnlessReallyEqual(u.fingerprint, self.fingerprint)
@@ -393,14 +393,14 @@ class Mutable(testutil.ReallyEqualMixin, unittest.TestCase):
         u1 = uri.ReadonlyMDMFFileURI(self.readkey, self.fingerprint)
         cap = u1.to_string()
         self.failUnlessRaises(uri.BadURIError,
-                              uri.WritableMDMFFileURI.init_from_string,
+                              uri.WriteableMDMFFileURI.init_from_string,
                               cap)
 
     def test_create_writable_mdmf_cap_from_verifycap(self):
         u1 = uri.MDMFVerifierURI(self.storage_index, self.fingerprint)
         cap = u1.to_string()
         self.failUnlessRaises(uri.BadURIError,
-                              uri.WritableMDMFFileURI.init_from_string,
+                              uri.WriteableMDMFFileURI.init_from_string,
                               cap)
 
     def test_create_readonly_mdmf_cap_from_verifycap(self):
@@ -433,7 +433,7 @@ class Mutable(testutil.ReallyEqualMixin, unittest.TestCase):
     def test_mdmf_cap_extra_information(self):
         # MDMF caps can be arbitrarily extended after the fingerprint
         # and key/storage index fields. 
-        u1 = uri.WritableMDMFFileURI(self.writekey, self.fingerprint)
+        u1 = uri.WriteableMDMFFileURI(self.writekey, self.fingerprint)
         self.failUnlessEqual([], u1.get_extension_params())
 
         cap = u1.to_string()
@@ -444,14 +444,14 @@ class Mutable(testutil.ReallyEqualMixin, unittest.TestCase):
             cap += (":%s" % e)
             expected_extensions.append(e)
 
-            u2 = uri.WritableMDMFFileURI.init_from_string(cap)
+            u2 = uri.WriteableMDMFFileURI.init_from_string(cap)
             self.failUnlessReallyEqual(self.writekey, u2.writekey)
             self.failUnlessReallyEqual(self.fingerprint, u2.fingerprint)
             self.failIf(u2.is_readonly())
             self.failUnless(u2.is_mutable())
 
             c2 = u2.to_string()
-            u2n = uri.WritableMDMFFileURI.init_from_string(c2)
+            u2n = uri.WriteableMDMFFileURI.init_from_string(c2)
             self.failUnlessReallyEqual(u2, u2n)
 
             # We should get the extra back when we ask for it.
@@ -496,11 +496,11 @@ class Mutable(testutil.ReallyEqualMixin, unittest.TestCase):
     def test_extension_character_range(self):
         # As written now, we shouldn't put things other than numbers in
         # the extension fields.
-        writecap = uri.WritableMDMFFileURI(self.writekey, self.fingerprint).to_string()
+        writecap = uri.WriteableMDMFFileURI(self.writekey, self.fingerprint).to_string()
         readcap  = uri.ReadonlyMDMFFileURI(self.readkey, self.fingerprint).to_string()
         vcap     = uri.MDMFVerifierURI(self.storage_index, self.fingerprint).to_string()
         self.failUnlessRaises(uri.BadURIError,
-                              uri.WritableMDMFFileURI.init_from_string,
+                              uri.WriteableMDMFFileURI.init_from_string,
                               ("%s:invalid" % writecap))
         self.failUnlessRaises(uri.BadURIError,
                               uri.ReadonlyMDMFFileURI.init_from_string,
@@ -516,8 +516,8 @@ class Mutable(testutil.ReallyEqualMixin, unittest.TestCase):
         # With a cap on the end. For each of the cap types, we need to
         # test that a valid cap (with and without the traditional
         # separators) is recognized and accepted by the classes.
-        w1 = uri.WritableMDMFFileURI(self.writekey, self.fingerprint)
-        w2 = uri.WritableMDMFFileURI(self.writekey, self.fingerprint,
+        w1 = uri.WriteableMDMFFileURI(self.writekey, self.fingerprint)
+        w2 = uri.WriteableMDMFFileURI(self.writekey, self.fingerprint,
                                      ['131073', '3'])
         r1 = uri.ReadonlyMDMFFileURI(self.readkey, self.fingerprint)
         r2 = uri.ReadonlyMDMFFileURI(self.readkey, self.fingerprint,
@@ -549,8 +549,8 @@ class Mutable(testutil.ReallyEqualMixin, unittest.TestCase):
         # With a cap on the end. For each of the cap types, we need to
         # test that a valid cap (with and without the traditional
         # separators) is recognized and accepted by the classes.
-        w1 = uri.WritableMDMFFileURI(self.writekey, self.fingerprint)
-        w2 = uri.WritableMDMFFileURI(self.writekey, self.fingerprint,
+        w1 = uri.WriteableMDMFFileURI(self.writekey, self.fingerprint)
+        w2 = uri.WriteableMDMFFileURI(self.writekey, self.fingerprint,
                                      ['131073', '3'])
         r1 = uri.ReadonlyMDMFFileURI(self.readkey, self.fingerprint)
         r2 = uri.ReadonlyMDMFFileURI(self.readkey, self.fingerprint,
@@ -571,8 +571,8 @@ class Mutable(testutil.ReallyEqualMixin, unittest.TestCase):
         # With a cap on the end. For each of the cap types, we need to
         # test that a valid cap (with and without the traditional
         # separators) is recognized and accepted by the classes.
-        w1 = uri.WritableMDMFFileURI(self.writekey, self.fingerprint)
-        w2 = uri.WritableMDMFFileURI(self.writekey, self.fingerprint,
+        w1 = uri.WriteableMDMFFileURI(self.writekey, self.fingerprint)
+        w2 = uri.WriteableMDMFFileURI(self.writekey, self.fingerprint,
                                      ['131073', '3'])
         r1 = uri.ReadonlyMDMFFileURI(self.readkey, self.fingerprint)
         r2 = uri.ReadonlyMDMFFileURI(self.readkey, self.fingerprint,
@@ -595,7 +595,7 @@ class Mutable(testutil.ReallyEqualMixin, unittest.TestCase):
     def test_mdmf_from_string(self):
         # Make sure that the from_string utility function works with
         # MDMF caps.
-        u1 = uri.WritableMDMFFileURI(self.writekey, self.fingerprint)
+        u1 = uri.WriteableMDMFFileURI(self.writekey, self.fingerprint)
         cap = u1.to_string()
         self.failUnless(uri.is_uri(cap))
         u2 = uri.from_string(cap)
@@ -604,7 +604,7 @@ class Mutable(testutil.ReallyEqualMixin, unittest.TestCase):
         self.failUnlessEqual(u3, u1)
 
         # XXX: We should refactor the extension field into setUp
-        u1 = uri.WritableMDMFFileURI(self.writekey, self.fingerprint,
+        u1 = uri.WriteableMDMFFileURI(self.writekey, self.fingerprint,
                                      ['131073', '3'])
         cap = u1.to_string()
         self.failUnless(uri.is_uri(cap))
@@ -795,7 +795,7 @@ class Dirnode(testutil.ReallyEqualMixin, unittest.TestCase):
     def test_mdmf(self):
         writekey = "\x01" * 16
         fingerprint = "\x02" * 32
-        uri1 = uri.WritableMDMFFileURI(writekey, fingerprint)
+        uri1 = uri.WriteableMDMFFileURI(writekey, fingerprint)
         d1 = uri.MDMFDirectoryURI(uri1)
         self.failIf(d1.is_readonly())
         self.failUnless(d1.is_mutable())
@@ -819,7 +819,7 @@ class Dirnode(testutil.ReallyEqualMixin, unittest.TestCase):
     def test_mdmf_with_extensions(self):
         writekey = "\x01" * 16
         fingerprint = "\x02" * 32
-        uri1 = uri.WritableMDMFFileURI(writekey, fingerprint)
+        uri1 = uri.WriteableMDMFFileURI(writekey, fingerprint)
         d1 = uri.MDMFDirectoryURI(uri1)
         d1_uri = d1.to_string()
         # Add some extensions, verify that the URI is interpreted
@@ -849,7 +849,7 @@ class Dirnode(testutil.ReallyEqualMixin, unittest.TestCase):
         writekey = "\x01" * 16
         fingerprint = "\x02" * 32
 
-        uri1 = uri.WritableMDMFFileURI(writekey, fingerprint)
+        uri1 = uri.WriteableMDMFFileURI(writekey, fingerprint)
         d1 = uri.MDMFDirectoryURI(uri1)
         self.failUnless(d1.is_mutable())
         self.failIf(d1.is_readonly())
@@ -889,7 +889,7 @@ class Dirnode(testutil.ReallyEqualMixin, unittest.TestCase):
         # I'm not sure what I want to write here yet.
         writekey = "\x01" * 16
         fingerprint = "\x02" * 32
-        uri1 = uri.WritableMDMFFileURI(writekey, fingerprint)
+        uri1 = uri.WriteableMDMFFileURI(writekey, fingerprint)
         d1 = uri.MDMFDirectoryURI(uri1)
         v1 = d1.get_verify_cap()
         self.failUnlessIsInstance(v1, uri.MDMFDirectoryURIVerifier)
index cd3e7dc34e521e75c1ababea4acfd77629f56df2..d9d87354f00c958c397b40d3a74d649ba7ddec15 100644 (file)
@@ -410,7 +410,7 @@ class SSKVerifierURI(_BaseURI):
     def set_extension_params(self, params):
         pass
 
-class WritableMDMFFileURI(_BaseURI):
+class WriteableMDMFFileURI(_BaseURI):
     implements(IURI, IMutableFileURI)
 
     BASE_STRING='URI:MDMF:'
@@ -753,7 +753,7 @@ class MDMFDirectoryURI(_DirectoryBaseURI):
     BASE_STRING='URI:DIR2-MDMF:'
     BASE_STRING_RE=re.compile('^'+BASE_STRING)
     BASE_HUMAN_RE=re.compile('^'+OPTIONALHTTPLEAD+'URI'+SEP+'DIR2-MDMF'+SEP)
-    INNER_URI_CLASS=WritableMDMFFileURI
+    INNER_URI_CLASS=WriteableMDMFFileURI
 
     def __init__(self, filenode_uri=None):
         if filenode_uri:
@@ -801,7 +801,7 @@ def wrap_dirnode_cap(filecap):
         return ImmutableDirectoryURI(filecap)
     if isinstance(filecap, LiteralFileURI):
         return LiteralDirectoryURI(filecap)
-    if isinstance(filecap, WritableMDMFFileURI):
+    if isinstance(filecap, WriteableMDMFFileURI):
         return MDMFDirectoryURI(filecap)
     if isinstance(filecap, ReadonlyMDMFFileURI):
         return ReadonlyMDMFDirectoryURI(filecap)
@@ -913,7 +913,7 @@ def from_string(u, deep_immutable=False, name=u"<unknown name>"):
         elif s.startswith('URI:SSK-Verifier:'):
             return SSKVerifierURI.init_from_string(s)
         elif s.startswith('URI:MDMF:'):
-            return WritableMDMFFileURI.init_from_string(s)
+            return WriteableMDMFFileURI.init_from_string(s)
         elif s.startswith('URI:MDMF-RO:'):
             return ReadonlyMDMFFileURI.init_from_string(s)
         elif s.startswith('URI:MDMF-Verifier:'):