From 2e762f39f69b29962df71a52c6ebc99e0fc2fc1a Mon Sep 17 00:00:00 2001
From: Zooko O'Whielacronx <zooko@zooko.com>
Date: Wed, 7 Jan 2009 12:24:51 -0700
Subject: [PATCH] immutable: define a new interface IImmutableFileURI and
 declare that CHKFileURI and LiteralFileURI provide it

---
 src/allmydata/interfaces.py | 3 +++
 src/allmydata/uri.py        | 8 ++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/allmydata/interfaces.py b/src/allmydata/interfaces.py
index 178a9e94..5a03142c 100644
--- a/src/allmydata/interfaces.py
+++ b/src/allmydata/interfaces.py
@@ -392,6 +392,9 @@ class IFileURI(Interface):
     def get_size():
         """Return the length (in bytes) of the file that I represent."""
 
+class IImmutableFileURI(IFileURI):
+    pass
+
 class IMutableFileURI(Interface):
     """I am a URI which represents a mutable filenode."""
 class INewDirectoryURI(Interface):
diff --git a/src/allmydata/uri.py b/src/allmydata/uri.py
index 6b0e0666..3228ae81 100644
--- a/src/allmydata/uri.py
+++ b/src/allmydata/uri.py
@@ -4,8 +4,8 @@ from zope.interface import implements
 from twisted.python.components import registerAdapter
 from allmydata import storage
 from allmydata.util import base32, hashutil
-from allmydata.interfaces import IURI, IDirnodeURI, IFileURI, IVerifierURI, \
-     IMutableFileURI, INewDirectoryURI, IReadonlyNewDirectoryURI
+from allmydata.interfaces import IURI, IDirnodeURI, IFileURI, IImmutableFileURI, \
+    IVerifierURI, IMutableFileURI, INewDirectoryURI, IReadonlyNewDirectoryURI
 
 # the URI shall be an ascii representation of the file. It shall contain
 # enough information to retrieve and validate the contents. It shall be
@@ -43,7 +43,7 @@ class _BaseURI:
         return self.storage_index
 
 class CHKFileURI(_BaseURI):
-    implements(IURI, IFileURI)
+    implements(IURI, IImmutableFileURI)
 
     STRING_RE=re.compile('^URI:CHK:'+BASE32STR_128bits+':'+
                          BASE32STR_256bits+':'+NUMBER+':'+NUMBER+':'+NUMBER+
@@ -153,7 +153,7 @@ class CHKFileVerifierURI(_BaseURI):
 
 
 class LiteralFileURI(_BaseURI):
-    implements(IURI, IFileURI)
+    implements(IURI, IImmutableFileURI)
 
     STRING_RE=re.compile('^URI:LIT:'+base32.BASE32STR_anybytes+'$')
     HUMAN_RE=re.compile('^'+OPTIONALHTTPLEAD+'URI'+SEP+'LIT'+SEP+base32.BASE32STR_anybytes+'$')
-- 
2.45.2