mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-31 16:36:20 +00:00
storage: move si_b2a/si_a2b/storage_index_to_dir out of server.py and into common.py
This commit is contained in:
parent
73e05bf967
commit
d14f00c537
@ -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)
|
||||
|
@ -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):
|
||||
|
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user