]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
uri: add abbrev_si() method, which returns the abbreviated storage index
authorBrian Warner <warner@allmydata.com>
Sat, 31 Jan 2009 02:31:10 +0000 (19:31 -0700)
committerBrian Warner <warner@allmydata.com>
Sat, 31 Jan 2009 02:31:10 +0000 (19:31 -0700)
src/allmydata/uri.py

index 3228ae816a85145be72f59c372526b7f4a185a17..776a7b74e0b4398affb052bc72f85c2528891456 100644 (file)
@@ -232,6 +232,8 @@ class WriteableSSKFileURI(_BaseURI):
 
     def abbrev(self):
         return base32.b2a(self.writekey[:5])
+    def abbrev_si(self):
+        return base32.b2a(self.storage_index)[:5]
 
     def is_readonly(self):
         return False
@@ -278,6 +280,8 @@ class ReadonlySSKFileURI(_BaseURI):
 
     def abbrev(self):
         return base32.b2a(self.readkey[:5])
+    def abbrev_si(self):
+        return base32.b2a(self.storage_index)[:5]
 
     def is_readonly(self):
         return True
@@ -355,6 +359,8 @@ class _NewDirectoryBaseURI(_BaseURI):
 
     def abbrev(self):
         return self._filenode_uri.to_string().split(':')[2][:5]
+    def abbrev_si(self):
+        return base32.b2a(self._filenode_uri.storage_index)[:5]
 
     def get_filenode_uri(self):
         return self._filenode_uri