def get_verify_cap(self):
return self.u.get_verify_cap()
+ def get_repair_cap(self):
+ # CHK files can be repaired with just the verifycap
+ return self.u.get_verify_cap()
+
def get_storage_index(self):
return self.u.storage_index
def get_verify_cap(self):
return None
+ def get_repair_cap(self):
+ return None
+
def get_storage_index(self):
return None
get_readonly_uri() will return the same thing as get_uri().
"""
+ def get_repair_cap():
+ """Return an IURI instance that can be used to repair the file, or
+ None if this node cannot be repaired (either because it is not
+ distributed, like a LIT file, or because the node does not represent
+ sufficient authority to create a repair-cap, like a read-only RSA
+ mutable file node [which cannot create the correct write-enablers]).
+ """
+
def get_verify_cap():
"""Return an IVerifierURI instance that represents the
'verifiy/refresh capability' for this node. The holder of this
def get_verify_cap(self):
return IMutableFileURI(self._uri).get_verify_cap()
+ def get_repair_cap(self):
+ if self._uri.is_readonly():
+ return None
+ return self._uri
+
def _do_serialized(self, cb, *args, **kwargs):
# note: to avoid deadlock, this callable is *not* allowed to invoke
# other serialized methods within this (or any other)
d[fn1] = 1 # exercise __hash__
v = fn1.get_verify_cap()
self.failUnless(isinstance(v, uri.CHKFileVerifierURI))
+ self.failUnlessEqual(fn1.get_repair_cap(), v)
def test_literal_filenode(self):
v = fn1.get_verify_cap()
self.failUnlessEqual(v, None)
+ self.failUnlessEqual(fn1.get_repair_cap(), None)
d = fn1.download(download.Data())
def _check(res):
self.failUnlessEqual(nro_u, u.get_readonly().to_string())
self.failUnlessEqual(nro.is_mutable(), True)
self.failUnlessEqual(nro.is_readonly(), True)
+ self.failUnlessEqual(nro.get_repair_cap(), None) # RSAmut needs writecap
v = n.get_verify_cap()
self.failUnless(isinstance(v, uri.SSKVerifierURI))
+ self.failUnlessEqual(n.get_repair_cap(), n._uri) # TODO: n.get_uri()
class LiteralChecker(unittest.TestCase):
def test_literal_filenode(self):