]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blobdiff - src/allmydata/mutable/filenode.py
MDMF: remove extension fields from caps, tolerate arbitrary ones. Fixes #1526
[tahoe-lafs/tahoe-lafs.git] / src / allmydata / mutable / filenode.py
index e798a58970b42ac7b633d92f1ca566b417f98bfe..cafe20fe90060f6c8e24204c0d67090d2518f12f 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
@@ -118,17 +118,6 @@ class MutableFileNode:
         self._privkey = None
         self._encprivkey = None
 
-        # Starting with MDMF caps, we allowed arbitrary extensions in
-        # caps. If we were initialized with a cap that had extensions,
-        # we want to remember them so we can tell MutableFileVersions
-        # about them.
-        extensions = self._uri.get_extension_params()
-        if extensions:
-            extensions = map(int, extensions)
-            suspected_k, suspected_segsize = extensions
-            self._downloader_hints['k'] = suspected_k
-            self._downloader_hints['segsize'] = suspected_segsize
-
         return self
 
     def create_with_keys(self, (pubkey, privkey), contents,
@@ -146,7 +135,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)
@@ -478,7 +467,7 @@ class MutableFileNode:
         I return a Deferred that fires with a MutableFileVersion
         representing the best readable version of the file that I
         represent. I am like get_best_readable_version, except that I
-        will try to make a writable version if I can.
+        will try to make a writeable version if I can.
         """
         return self.get_mutable_version(servermap=servermap)
 
@@ -701,9 +690,6 @@ class MutableFileNode:
 
     def set_downloader_hints(self, hints):
         self._downloader_hints = hints
-        extensions = hints.values()
-        self._uri.set_extension_params(extensions)
-
 
     def _did_upload(self, res, size):
         self._most_recent_size = size
@@ -723,7 +709,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,