mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-03-03 21:00:48 +00:00
immutable: define a new interface IImmutableFileURI and declare that CHKFileURI and LiteralFileURI provide it
This commit is contained in:
parent
c01cfc0035
commit
2e762f39f6
src/allmydata
@ -392,6 +392,9 @@ class IFileURI(Interface):
|
|||||||
def get_size():
|
def get_size():
|
||||||
"""Return the length (in bytes) of the file that I represent."""
|
"""Return the length (in bytes) of the file that I represent."""
|
||||||
|
|
||||||
|
class IImmutableFileURI(IFileURI):
|
||||||
|
pass
|
||||||
|
|
||||||
class IMutableFileURI(Interface):
|
class IMutableFileURI(Interface):
|
||||||
"""I am a URI which represents a mutable filenode."""
|
"""I am a URI which represents a mutable filenode."""
|
||||||
class INewDirectoryURI(Interface):
|
class INewDirectoryURI(Interface):
|
||||||
|
@ -4,8 +4,8 @@ from zope.interface import implements
|
|||||||
from twisted.python.components import registerAdapter
|
from twisted.python.components import registerAdapter
|
||||||
from allmydata import storage
|
from allmydata import storage
|
||||||
from allmydata.util import base32, hashutil
|
from allmydata.util import base32, hashutil
|
||||||
from allmydata.interfaces import IURI, IDirnodeURI, IFileURI, IVerifierURI, \
|
from allmydata.interfaces import IURI, IDirnodeURI, IFileURI, IImmutableFileURI, \
|
||||||
IMutableFileURI, INewDirectoryURI, IReadonlyNewDirectoryURI
|
IVerifierURI, IMutableFileURI, INewDirectoryURI, IReadonlyNewDirectoryURI
|
||||||
|
|
||||||
# the URI shall be an ascii representation of the file. It shall contain
|
# the URI shall be an ascii representation of the file. It shall contain
|
||||||
# enough information to retrieve and validate the contents. It shall be
|
# enough information to retrieve and validate the contents. It shall be
|
||||||
@ -43,7 +43,7 @@ class _BaseURI:
|
|||||||
return self.storage_index
|
return self.storage_index
|
||||||
|
|
||||||
class CHKFileURI(_BaseURI):
|
class CHKFileURI(_BaseURI):
|
||||||
implements(IURI, IFileURI)
|
implements(IURI, IImmutableFileURI)
|
||||||
|
|
||||||
STRING_RE=re.compile('^URI:CHK:'+BASE32STR_128bits+':'+
|
STRING_RE=re.compile('^URI:CHK:'+BASE32STR_128bits+':'+
|
||||||
BASE32STR_256bits+':'+NUMBER+':'+NUMBER+':'+NUMBER+
|
BASE32STR_256bits+':'+NUMBER+':'+NUMBER+':'+NUMBER+
|
||||||
@ -153,7 +153,7 @@ class CHKFileVerifierURI(_BaseURI):
|
|||||||
|
|
||||||
|
|
||||||
class LiteralFileURI(_BaseURI):
|
class LiteralFileURI(_BaseURI):
|
||||||
implements(IURI, IFileURI)
|
implements(IURI, IImmutableFileURI)
|
||||||
|
|
||||||
STRING_RE=re.compile('^URI:LIT:'+base32.BASE32STR_anybytes+'$')
|
STRING_RE=re.compile('^URI:LIT:'+base32.BASE32STR_anybytes+'$')
|
||||||
HUMAN_RE=re.compile('^'+OPTIONALHTTPLEAD+'URI'+SEP+'LIT'+SEP+base32.BASE32STR_anybytes+'$')
|
HUMAN_RE=re.compile('^'+OPTIONALHTTPLEAD+'URI'+SEP+'LIT'+SEP+base32.BASE32STR_anybytes+'$')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user