]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
dirnode: add get_repair_cap()
authorBrian Warner <warner@allmydata.com>
Fri, 23 Jan 2009 04:44:49 +0000 (21:44 -0700)
committerBrian Warner <warner@allmydata.com>
Fri, 23 Jan 2009 04:44:49 +0000 (21:44 -0700)
src/allmydata/dirnode.py
src/allmydata/test/test_dirnode.py

index 3dde57a8f2a5da6f0504d12cab8886b5b711d99e..92e45bbe558b644effb3f4f3224af9cf73815691 100644 (file)
@@ -226,6 +226,11 @@ class NewDirectoryNode:
     def get_verify_cap(self):
         return self._uri.get_verify_cap()
 
+    def get_repair_cap(self):
+        if self._node.is_readonly():
+            return None
+        return self._uri
+
     def get_storage_index(self):
         return self._uri._filenode_uri.storage_index
 
index f0e51009ec9cd7807aa5857066a97c4ead494e5c..17fa9fee6d57b7839e22a35f85c29ee39588274a 100644 (file)
@@ -297,6 +297,8 @@ class Dirnode(unittest.TestCase,
             self.failUnless(u_ro.startswith("URI:DIR2-RO:"), u_ro)
             u_v = n.get_verify_cap().to_string()
             self.failUnless(u_v.startswith("URI:DIR2-Verifier:"), u_v)
+            u_r = n.get_repair_cap().to_string()
+            self.failUnlessEqual(u_r, u)
             self.expected_manifest.append( ((), u) )
             self.expected_verifycaps.add(u_v)
             si = n.get_storage_index()