diff -rN -u old-config-parse/docs/configuration.rst new-config-parse/docs/configuration.rst --- old-config-parse/docs/configuration.rst 2011-09-21 15:10:25.669487229 -0600 +++ new-config-parse/docs/configuration.rst 2011-09-21 15:10:25.929486420 -0600 @@ -417,14 +417,20 @@ ``backend = disk`` - The default is to store shares on the local filesystem (in + The storage server stores shares on the local filesystem (in BASEDIR/storage/shares/). For configuration details (including how to reserve a minimum amount of free space), see ``_. -``backend = S3`` +``backend = s3`` - The storage server can store all shares to an Amazon Simple Storage - Service (S3) bucket. For configuration details, see ``_. + The storage server stores all shares to an Amazon Simple Storage Service + (S3) bucket. For configuration details, see ``_. + +``backend = debug_discard`` + + The storage server stores all shares in /dev/null. This is actually used, + for testing. It is not recommended for storage of data that you might + want to retrieve in the future. Running A Helper diff -rN -u old-config-parse/src/allmydata/client.py new-config-parse/src/allmydata/client.py --- old-config-parse/src/allmydata/client.py 2011-09-21 15:10:25.756487132 -0600 +++ new-config-parse/src/allmydata/client.py 2011-09-21 15:10:25.945486664 -0600 @@ -205,24 +205,49 @@ self._secret_holder = SecretHolder(lease_secret, self.convergence) def init_storage(self): - # should we run a storage server (and publish it for others to use)? + # Should we run a storage server (and publish it for others to use)? if not self.get_config("storage", "enabled", True, boolean=True): return readonly = self.get_config("storage", "readonly", False, boolean=True) - storedir = FilePath(self.basedir).child(self.STOREDIR) + # What sort of backend? + backendtype = self.get_config("storage", "backend", "disk"): - data = self.get_config("storage", "reserved_space", None) - reserved = None - try: - reserved = parse_abbreviated_size(data) - except ValueError: - log.msg("[storage]reserved_space= contains unparseable value %s" - % data) - if reserved is None: - reserved = 0 - discard = self.get_config("storage", "debug_discard", False, - boolean=True) + def config_disk_backend(): + storedir = FilePath(self.basedir).child(self.STOREDIR) + + data = self.get_config("storage", "reserved_space", None) + reserved = None + try: + reserved = parse_abbreviated_size(data) + except ValueError: + raise InvalidValueError("[storage]reserved_space= contains unparseable value %s" + % data) + + return DiskBackend(storedir, readonly, reserved) + + def config_s3_backend(): + k + + + backend = S3Backend(xxx ) + + def config_null_backend(): + return NullBackend() + + backend_configgers = { + 'disk': config_disk_backend, + 's3': config_s3_backend, + 'debug_discard': config_null_backend, + } + + if backendtype not in backend_configgers: + raise InvalidValueError("[storage]backend= is required to be one of %s, but was \"%s\"" % (backend_configgers.keys(), quote_output(backendtype),)) + + + if backendtype == "disk": + elif backendtype == "s3": + elif backendtype == "debug_discard": expire = self.get_config("storage", "expire.enabled", False, boolean=True) if expire: diff -rN -u old-config-parse/src/allmydata/node.py new-config-parse/src/allmydata/node.py --- old-config-parse/src/allmydata/node.py 2011-09-21 15:10:25.789736662 -0600 +++ new-config-parse/src/allmydata/node.py 2011-09-21 15:10:25.947486905 -0600 @@ -40,6 +40,9 @@ class _None: # used as a marker in get_config() pass +class InvalidValueError(Exception): + """ The configured value was not valid. """ + class MissingConfigEntry(Exception): """ A required config entry was not found. """ diff -rN -u old-config-parse/src/allmydata/storage/backends/disk/disk_backend.py new-config-parse/src/allmydata/storage/backends/disk/disk_backend.py --- old-config-parse/src/allmydata/storage/backends/disk/disk_backend.py 2011-09-21 15:10:25.802736466 -0600 +++ new-config-parse/src/allmydata/storage/backends/disk/disk_backend.py 2011-09-21 15:10:25.954486466 -0600 @@ -48,7 +48,7 @@ class DiskBackend(Backend): implements(IStorageBackend) - def __init__(self, storedir, readonly=False, reserved_space=0, discard_storage=False): + def __init__(self, storedir, readonly=False, reserved_space=0): Backend.__init__(self) self._setup_storage(storedir, readonly, reserved_space, discard_storage) self._setup_corruption_advisory() diff -rN -u old-config-parse/src/allmydata/test/test_backends.py new-config-parse/src/allmydata/test/test_backends.py --- old-config-parse/src/allmydata/test/test_backends.py 2011-09-21 15:10:25.813736428 -0600 +++ new-config-parse/src/allmydata/test/test_backends.py 2011-09-21 15:10:25.955486266 -0600 @@ -374,3 +374,8 @@ self.failUnlessReallyEqual(b.remote_read(0, datalen+20), client_data) # If you start reading past the end of the file you get the empty string. self.failUnlessReallyEqual(b.remote_read(datalen+1, 3), '') + + +class TestConfigureBackends(ReallyEqualMixin): + def test_configure_disk_backend(self): + xyz diff -rN -u old-config-parse/src/allmydata/uri.py new-config-parse/src/allmydata/uri.py --- old-config-parse/src/allmydata/uri.py 2011-09-21 15:10:25.857736680 -0600 +++ new-config-parse/src/allmydata/uri.py 2011-09-21 15:10:25.948486665 -0600 @@ -1078,4 +1078,3 @@ if 'hash' in k: unpacked[k] = base32.b2a(unpacked[k]) return unpacked -