From: Zooko O'Whielacronx Date: Mon, 8 Dec 2008 19:44:11 +0000 (-0700) Subject: rename "get_verifier()" to "get_verify_cap()" X-Git-Url: https://git.rkrishnan.org/vdrive/index.php?a=commitdiff_plain;h=c456ff85910aaff531211b9958a092412be910e0;p=tahoe-lafs%2Ftahoe-lafs.git rename "get_verifier()" to "get_verify_cap()" --- diff --git a/src/allmydata/dirnode.py b/src/allmydata/dirnode.py index 7417a07e..38a31136 100644 --- a/src/allmydata/dirnode.py +++ b/src/allmydata/dirnode.py @@ -222,8 +222,8 @@ class NewDirectoryNode: def get_readonly_uri(self): return self._uri.get_readonly().to_string() - def get_verifier(self): - return self._uri.get_verifier() + def get_verify_cap(self): + return self._uri.get_verify_cap() def get_storage_index(self): return self._uri._filenode_uri.storage_index @@ -479,7 +479,7 @@ class NewDirectoryNode: monitor = Monitor() walker.set_monitor(monitor) - found = set([self.get_verifier()]) + found = set([self.get_verify_cap()]) limiter = ConcurrencyLimiter(10) d = self._deep_traverse_dirnode(self, [], walker, monitor, found, limiter) @@ -504,7 +504,7 @@ class NewDirectoryNode: monitor.raise_if_cancelled() dl = [limiter.add(walker.enter_directory, parent, children)] for name, (child, metadata) in children.iteritems(): - verifier = child.get_verifier() + verifier = child.get_verify_cap() # allow LIT files (for which verifier==None) to be processed if (verifier is not None) and (verifier in found): continue @@ -651,7 +651,7 @@ class ManifestWalker(DeepStats): si = node.get_storage_index() if si: self.storage_index_strings.add(base32.b2a(si)) - v = node.get_verifier() + v = node.get_verify_cap() if v: self.verifycaps.add(v.to_string()) return DeepStats.add_node(self, node, path) diff --git a/src/allmydata/immutable/download.py b/src/allmydata/immutable/download.py index a5a05f00..c8d7d215 100644 --- a/src/allmydata/immutable/download.py +++ b/src/allmydata/immutable/download.py @@ -830,7 +830,7 @@ class FileDownloader: vups = [] for sharenum, bucket in self._share_buckets: - vups.append(ValidatedExtendedURIProxy(bucket, self._uri.get_verifier(), self._fetch_failures)) + vups.append(ValidatedExtendedURIProxy(bucket, self._uri.get_verify_cap(), self._fetch_failures)) vto = ValidatedThingObtainer(vups, debugname="vups", log_id=self._log_number) d = vto.start() diff --git a/src/allmydata/immutable/filenode.py b/src/allmydata/immutable/filenode.py index 5fbeb791..fdf94748 100644 --- a/src/allmydata/immutable/filenode.py +++ b/src/allmydata/immutable/filenode.py @@ -181,8 +181,8 @@ class FileNode(_ImmutableFileNodeBase): def get_size(self): return self.u.get_size() - def get_verifier(self): - return self.u.get_verifier() + def get_verify_cap(self): + return self.u.get_verify_cap() def get_storage_index(self): return self.u.storage_index @@ -265,7 +265,7 @@ class LiteralFileNode(_ImmutableFileNodeBase): def get_size(self): return len(self.u.data) - def get_verifier(self): + def get_verify_cap(self): return None def get_storage_index(self): diff --git a/src/allmydata/interfaces.py b/src/allmydata/interfaces.py index d0ccffa5..5067123c 100644 --- a/src/allmydata/interfaces.py +++ b/src/allmydata/interfaces.py @@ -365,7 +365,7 @@ class IURI(Interface): """Return another IURI instance, which represents a read-only form of this one. If is_readonly() is True, this returns self.""" - def get_verifier(): + def get_verify_cap(): """Return an instance that provides IVerifierURI, which can be used to check on the availability of the file or directory, without providing enough capabilities to actually read or modify the @@ -426,7 +426,7 @@ class IFilesystemNode(Interface): get_readonly_uri() will return the same thing as get_uri(). """ - def get_verifier(): + def get_verify_cap(): """Return an IVerifierURI instance that represents the 'verifiy/refresh capability' for this node. The holder of this capability will be able to renew the lease for this node, protecting diff --git a/src/allmydata/mutable/filenode.py b/src/allmydata/mutable/filenode.py index 882831b7..8caa1454 100644 --- a/src/allmydata/mutable/filenode.py +++ b/src/allmydata/mutable/filenode.py @@ -218,8 +218,8 @@ class MutableFileNode: return cmp(self.__class__, them.__class__) return cmp(self._uri, them._uri) - def get_verifier(self): - return IMutableFileURI(self._uri).get_verifier() + def get_verify_cap(self): + return IMutableFileURI(self._uri).get_verify_cap() def _do_serialized(self, cb, *args, **kwargs): # note: to avoid deadlock, this callable is *not* allowed to invoke diff --git a/src/allmydata/test/common.py b/src/allmydata/test/common.py index f9272a9d..1d09f897 100644 --- a/src/allmydata/test/common.py +++ b/src/allmydata/test/common.py @@ -44,8 +44,8 @@ class FakeCHKFileNode: return self.my_uri def get_readonly_uri(self): return self.my_uri - def get_verifier(self): - return IURI(self.my_uri).get_verifier() + def get_verify_cap(self): + return IURI(self.my_uri).get_verify_cap() def get_storage_index(self): return self.storage_index diff --git a/src/allmydata/test/test_cli.py b/src/allmydata/test/test_cli.py index fdd6f05d..9b0308d9 100644 --- a/src/allmydata/test/test_cli.py +++ b/src/allmydata/test/test_cli.py @@ -100,7 +100,7 @@ class CLI(unittest.TestCase): u.to_string()) self.failUnless("client renewal secret: znxmki5zdibb5qlt46xbdvk2t55j7hibejq3i5ijyurkr6m6jkhq" in output, output) - output = self._dump_cap(u.get_verifier().to_string()) + output = self._dump_cap(u.get_verify_cap().to_string()) self.failIf("key: " in output, output) self.failUnless("UEB hash: nf3nimquen7aeqm36ekgxomalstenpkvsdmf6fplj7swdatbv5oa" in output, output) self.failUnless("size: 1234" in output, output) @@ -169,7 +169,7 @@ class CLI(unittest.TestCase): self.failUnless("storage index: nt4fwemuw7flestsezvo2eveke" in output, output) self.failUnless("fingerprint: 737p57x6737p57x6737p57x6737p57x6737p57x6737p57x6737a" in output, output) - u = u.get_verifier() + u = u.get_verify_cap() output = self._dump_cap(u.to_string()) self.failUnless("SSK Verifier URI:" in output, output) self.failUnless("storage index: nt4fwemuw7flestsezvo2eveke" in output, output) @@ -213,7 +213,7 @@ class CLI(unittest.TestCase): self.failUnless("storage index: nt4fwemuw7flestsezvo2eveke" in output, output) self.failUnless("fingerprint: 737p57x6737p57x6737p57x6737p57x6737p57x6737p57x6737a" in output, output) - u = u.get_verifier() + u = u.get_verify_cap() output = self._dump_cap(u.to_string()) self.failUnless("Directory Verifier URI:" in output, output) self.failUnless("storage index: nt4fwemuw7flestsezvo2eveke" in output, output) diff --git a/src/allmydata/test/test_dirnode.py b/src/allmydata/test/test_dirnode.py index 142b5da5..d29e5da9 100644 --- a/src/allmydata/test/test_dirnode.py +++ b/src/allmydata/test/test_dirnode.py @@ -36,7 +36,7 @@ class Marker: return self.nodeuri def get_readonly_uri(self): return self.nodeuri - def get_verifier(self): + def get_verify_cap(self): return self.verifieruri def get_storage_index(self): return self.storage_index @@ -295,7 +295,7 @@ class Dirnode(unittest.TestCase, self.failUnless(u.startswith("URI:DIR2:"), u) u_ro = n.get_readonly_uri() self.failUnless(u_ro.startswith("URI:DIR2-RO:"), u_ro) - u_v = n.get_verifier().to_string() + u_v = n.get_verify_cap().to_string() self.failUnless(u_v.startswith("URI:DIR2-Verifier:"), u_v) self.expected_manifest.append( ((), u) ) self.expected_verifycaps.add(u_v) @@ -311,7 +311,7 @@ class Dirnode(unittest.TestCase, fake_file_uri = make_mutable_file_uri() other_file_uri = make_mutable_file_uri() m = Marker(fake_file_uri) - ffu_v = m.get_verifier().to_string() + ffu_v = m.get_verify_cap().to_string() self.expected_manifest.append( ((u"child",) , m.get_uri()) ) self.expected_verifycaps.add(ffu_v) self.expected_storage_indexes.add(base32.b2a(m.get_storage_index())) @@ -332,7 +332,7 @@ class Dirnode(unittest.TestCase, def _created(subdir): self.failUnless(isinstance(subdir, FakeDirectoryNode)) self.subdir = subdir - new_v = subdir.get_verifier().to_string() + new_v = subdir.get_verify_cap().to_string() assert isinstance(new_v, str) self.expected_manifest.append( ((u"subdir",), subdir.get_uri()) ) self.expected_verifycaps.add(new_v) diff --git a/src/allmydata/test/test_filenode.py b/src/allmydata/test/test_filenode.py index 46db7fcd..0fdc0513 100644 --- a/src/allmydata/test/test_filenode.py +++ b/src/allmydata/test/test_filenode.py @@ -40,7 +40,7 @@ class Node(unittest.TestCase): self.failUnlessEqual(fn1.get_storage_index(), u.storage_index) d = {} d[fn1] = 1 # exercise __hash__ - v = fn1.get_verifier() + v = fn1.get_verify_cap() self.failUnless(isinstance(v, uri.CHKFileVerifierURI)) @@ -62,7 +62,7 @@ class Node(unittest.TestCase): d = {} d[fn1] = 1 # exercise __hash__ - v = fn1.get_verifier() + v = fn1.get_verify_cap() self.failUnlessEqual(v, None) d = fn1.download(download.Data()) @@ -125,7 +125,7 @@ class Node(unittest.TestCase): self.failUnlessEqual(nro.is_mutable(), True) self.failUnlessEqual(nro.is_readonly(), True) - v = n.get_verifier() + v = n.get_verify_cap() self.failUnless(isinstance(v, uri.SSKVerifierURI)) class LiteralChecker(unittest.TestCase): diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index 9740f327..7d78f14a 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -2470,9 +2470,9 @@ class DeepCheckWebGood(DeepCheckBase, unittest.TestCase): base32.b2a(self.root.get_storage_index())) verifycaps = data["verifycaps"] self.failUnlessEqual(len(verifycaps), 3) - self.failUnless(self.root.get_verifier().to_string() in verifycaps) - self.failUnless(self.mutable.get_verifier().to_string() in verifycaps) - self.failUnless(self.large.get_verifier().to_string() in verifycaps) + self.failUnless(self.root.get_verify_cap().to_string() in verifycaps) + self.failUnless(self.mutable.get_verify_cap().to_string() in verifycaps) + self.failUnless(self.large.get_verify_cap().to_string() in verifycaps) d.addCallback(_check2r) d.addCallback(lambda res: diff --git a/src/allmydata/test/test_uri.py b/src/allmydata/test/test_uri.py index 858009f0..e81d466d 100644 --- a/src/allmydata/test/test_uri.py +++ b/src/allmydata/test/test_uri.py @@ -27,7 +27,7 @@ class Literal(unittest.TestCase): u3 = u.get_readonly() self.failUnlessIdentical(u, u3) - self.failUnlessEqual(u.get_verifier(), None) + self.failUnlessEqual(u.get_verify_cap(), None) he = u.to_human_encoding() u_h = uri.LiteralFileURI.init_from_human_encoding(he) @@ -114,7 +114,7 @@ class CHKFile(unittest.TestCase): self.failUnless(u2.is_readonly()) self.failIf(u2.is_mutable()) - v = u.get_verifier() + v = u.get_verify_cap() self.failUnless(isinstance(v.to_string(), str)) v2 = uri.from_string(v.to_string()) self.failUnlessEqual(v, v2) @@ -249,13 +249,13 @@ class Mutable(unittest.TestCase): self.failUnless("ReadonlySSKFileURI" in str(u4a)) self.failUnlessIdentical(u4a.get_readonly(), u4a) - u5 = u4.get_verifier() + u5 = u4.get_verify_cap() self.failUnless(IVerifierURI.providedBy(u5)) self.failUnlessEqual(u5.storage_index, u.storage_index) u6 = IVerifierURI(u5.to_string()) self.failUnless(IVerifierURI.providedBy(u6)) self.failUnlessEqual(u6.storage_index, u.storage_index) - u7 = u.get_verifier() + u7 = u.get_verify_cap() self.failUnless(IVerifierURI.providedBy(u7)) self.failUnlessEqual(u7.storage_index, u.storage_index) @@ -315,17 +315,17 @@ class NewDirnode(unittest.TestCase): self.failIf(IFileURI.providedBy(u4)) self.failUnless(IDirnodeURI.providedBy(u4)) - u4_verifier = u4.get_verifier() + u4_verifier = u4.get_verify_cap() u4_verifier_filenode = u4_verifier.get_filenode_uri() self.failUnless(isinstance(u4_verifier_filenode, uri.SSKVerifierURI)) - verifiers = [u1.get_verifier(), u2.get_verifier(), - u3.get_verifier(), u4.get_verifier(), - IVerifierURI(u1.get_verifier().to_string()), - uri.NewDirectoryURIVerifier(n.get_verifier()), - uri.NewDirectoryURIVerifier(n.get_verifier().to_string()), + verifiers = [u1.get_verify_cap(), u2.get_verify_cap(), + u3.get_verify_cap(), u4.get_verify_cap(), + IVerifierURI(u1.get_verify_cap().to_string()), + uri.NewDirectoryURIVerifier(n.get_verify_cap()), + uri.NewDirectoryURIVerifier(n.get_verify_cap().to_string()), ] for v in verifiers: self.failUnless(IVerifierURI.providedBy(v)) self.failUnlessEqual(v._filenode_uri, - u1.get_verifier()._filenode_uri) + u1.get_verify_cap()._filenode_uri) diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index 64e6a59e..4a91e361 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -657,7 +657,7 @@ class Web(WebMixin, testutil.StallMixin, unittest.TestCase): def test_GET_unhandled_URI_named(self): contents, n, newuri = self.makefile(12) - verifier_cap = n.get_verifier().to_string() + verifier_cap = n.get_verify_cap().to_string() base = "/file/%s" % urllib.quote(verifier_cap) # client.create_node_from_uri() can't handle verify-caps d = self.shouldFail2(error.Error, "GET_unhandled_URI_named", @@ -668,7 +668,7 @@ class Web(WebMixin, testutil.StallMixin, unittest.TestCase): def test_GET_unhandled_URI(self): contents, n, newuri = self.makefile(12) - verifier_cap = n.get_verifier().to_string() + verifier_cap = n.get_verify_cap().to_string() base = "/uri/%s" % urllib.quote(verifier_cap) # client.create_node_from_uri() can't handle verify-caps d = self.shouldFail2(error.Error, "test_GET_unhandled_URI", diff --git a/src/allmydata/uri.py b/src/allmydata/uri.py index 0a67f448..8994cce7 100644 --- a/src/allmydata/uri.py +++ b/src/allmydata/uri.py @@ -99,7 +99,7 @@ class CHKFileURI(_BaseURI): def get_size(self): return self.size - def get_verifier(self): + def get_verify_cap(self): return CHKFileVerifierURI(storage_index=self.storage_index, uri_extension_hash=self.uri_extension_hash, needed_shares=self.needed_shares, @@ -185,7 +185,7 @@ class LiteralFileURI(_BaseURI): def get_storage_index(self): return None - def get_verifier(self): + def get_verify_cap(self): # LIT files need no verification, all the data is present in the URI return None @@ -238,7 +238,7 @@ class WriteableSSKFileURI(_BaseURI): return True def get_readonly(self): return ReadonlySSKFileURI(self.readkey, self.fingerprint) - def get_verifier(self): + def get_verify_cap(self): return SSKVerifierURI(self.storage_index, self.fingerprint) class ReadonlySSKFileURI(_BaseURI): @@ -284,7 +284,7 @@ class ReadonlySSKFileURI(_BaseURI): return True def get_readonly(self): return self - def get_verifier(self): + def get_verify_cap(self): return SSKVerifierURI(self.storage_index, self.fingerprint) class SSKVerifierURI(_BaseURI): @@ -361,8 +361,8 @@ class _NewDirectoryBaseURI(_BaseURI): def is_mutable(self): return True - def get_verifier(self): - return NewDirectoryURIVerifier(self._filenode_uri.get_verifier()) + def get_verify_cap(self): + return NewDirectoryURIVerifier(self._filenode_uri.get_verify_cap()) def get_storage_index(self): return self._filenode_uri.get_storage_index() diff --git a/src/allmydata/web/info.py b/src/allmydata/web/info.py index b15bc2be..0d1b2703 100644 --- a/src/allmydata/web/info.py +++ b/src/allmydata/web/info.py @@ -85,7 +85,7 @@ class MoreInfo(rend.Page): node = self.original if not IDirectoryNode.providedBy(node): return "" - return ctx.tag[node.get_verifier().to_string()] + return ctx.tag[node.get_verify_cap().to_string()] def render_file_writecap(self, ctx, data): @@ -106,9 +106,9 @@ class MoreInfo(rend.Page): node = self.original if IDirectoryNode.providedBy(node): node = node._node - verifier = node.get_verifier() + verifier = node.get_verify_cap() if verifier: - return ctx.tag[node.get_verifier().to_string()] + return ctx.tag[node.get_verify_cap().to_string()] return "" def get_root(self, ctx):