]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
storage: move si_b2a/si_a2b/storage_index_to_dir out of server.py and into common.py
authorBrian Warner <warner@lothar.com>
Sat, 21 Feb 2009 04:03:09 +0000 (21:03 -0700)
committerBrian Warner <warner@lothar.com>
Sat, 21 Feb 2009 04:03:09 +0000 (21:03 -0700)
src/allmydata/storage/common.py
src/allmydata/storage/crawler.py
src/allmydata/storage/server.py

index 695c044e0ca252d22ce23547122e193d08cfaf69..a442dbf4ae654170ecc1089a8d2d2c5ffba1474a 100644 (file)
@@ -1,4 +1,17 @@
 
+import os.path
+from allmydata.util import base32
+
 class DataTooLargeError(Exception):
     pass
 
+
+def si_b2a(storageindex):
+    return base32.b2a(storageindex)
+
+def si_a2b(ascii_storageindex):
+    return base32.a2b(ascii_storageindex)
+
+def storage_index_to_dir(storageindex):
+    sia = si_b2a(storageindex)
+    return os.path.join(sia[:2], sia)
index abdb0db437ddff36526697b5b07a57cce785edc0..435bd2faa4ac799a7ffe15ce7b9e7d23dcedbdc5 100644 (file)
@@ -3,7 +3,7 @@ import os, time, struct
 import cPickle as pickle
 from twisted.internet import reactor
 from twisted.application import service
-from allmydata.storage.server import si_b2a
+from allmydata.storage.common import si_b2a
 from allmydata.util import fileutil
 
 class TimeSliceExceeded(Exception):
index 4840cc53f3af199d1115f1964dfa7ceb34c26a94..96e5b6ab6956625ab6527c56ab28bf46a69f53dc 100644 (file)
@@ -8,6 +8,8 @@ from allmydata.interfaces import RIStorageServer, IStatsProducer
 from allmydata.util import base32, fileutil, log, time_format
 import allmydata # for __full_version__
 
+from allmydata.storage.common import si_b2a, si_a2b, storage_index_to_dir
+_pyflakes_hush = [si_b2a, si_a2b, storage_index_to_dir] # re-exported
 from allmydata.storage.lease import LeaseInfo
 from allmydata.storage.mutable import MutableShareFile, EmptyShare, \
      create_mutable_sharefile
@@ -26,16 +28,6 @@ from allmydata.storage.immutable import ShareFile, BucketWriter, BucketReader
 # $SHARENUM matches this regex:
 NUM_RE=re.compile("^[0-9]+$")
 
-def si_b2a(storageindex):
-    return base32.b2a(storageindex)
-
-def si_a2b(ascii_storageindex):
-    return base32.a2b(ascii_storageindex)
-
-def storage_index_to_dir(storageindex):
-    sia = si_b2a(storageindex)
-    return os.path.join(sia[:2], sia)
-
 
 
 class StorageServer(service.MultiService, Referenceable):