From: Brian Warner Date: Fri, 23 Jan 2009 04:44:49 +0000 (-0700) Subject: dirnode: add get_repair_cap() X-Git-Tag: allmydata-tahoe-1.3.0~157 X-Git-Url: https://git.rkrishnan.org/vdrive/index.php?a=commitdiff_plain;h=72adeccf2dc407f5788c2aebe8fd1e16b8ec3708;p=tahoe-lafs%2Ftahoe-lafs.git dirnode: add get_repair_cap() --- diff --git a/src/allmydata/dirnode.py b/src/allmydata/dirnode.py index 3dde57a8..92e45bbe 100644 --- a/src/allmydata/dirnode.py +++ b/src/allmydata/dirnode.py @@ -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 diff --git a/src/allmydata/test/test_dirnode.py b/src/allmydata/test/test_dirnode.py index f0e51009..17fa9fee 100644 --- a/src/allmydata/test/test_dirnode.py +++ b/src/allmydata/test/test_dirnode.py @@ -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()