Commit 6f70d777 authored by Jim Fulton's avatar Jim Fulton

Added blob-dir configuration option.

parent c49527eb
......@@ -2,8 +2,8 @@ Defining FileStorages using ZConfig
===================================
ZODB provides support for defining many storages, including
FileStorages, using ZConfig. To do this, you use a filestorage
section, and define a path:
FileStorages, using ZConfig. To define a FileStorage, you use a
filestorage section, and define a path:
>>> import ZODB.config
>>> fs = ZODB.config.storageFromString("""
......@@ -15,16 +15,39 @@ section, and define a path:
>>> fs._file.name
'my.fs'
>>> fs.close()
There are a number of options we can provide:
blob-dir
If supplied, the file storage will provide blob support and this
is the name of a directory to hold blob data. The directory will
be created if it doeesn't exist. If no value (or an empty value)
is provided, then no blob support will be provided. (You can still
use a BlobStorage to provide blob support.)
>>> fs = ZODB.config.storageFromString("""
... <filestorage>
... path my.fs
... blob-dir blobs
... </filestorage>
... """)
>>> fs._file.name
'my.fs'
>>> import os
>>> os.path.basename(fs.blob_dir)
'blobs'
>>> fs.close()
create
Flag that indicates whether the storage should be truncated if
it already exists.
To demonstrate this, we'll first write some dataL
>>> db = ZODB.DB(fs) # writes object 0
>>> db = ZODB.DB('my.fs') # writes object 0
>>> db.close()
Then reopen with the create option:
......
......@@ -7,13 +7,22 @@
<sectiontype name="filestorage" datatype=".FileStorage"
implements="ZODB.storage">
<key name="path" required="yes">
<key name="path" required="yes" datatype="existing-dirpath">
<description>
Path name to the main storage file. The names for
supplemental files, including index and lock files, will be
computed from this.
</description>
</key>
<key name="blob-dir" required="no" datatype="existing-dirpath">
<description>
If supplied, the file storage will provide blob support and this
is the name of a directory to hold blob data. The directory will
be created if it doeesn't exist. If no value (or an empty value)
is provided, then no blob support will be provided. (You can still
use a BlobStorage to provide blob support.)
</description>
</key>
<key name="create" datatype="boolean" default="false">
<description>
Flag that indicates whether the storage should be truncated if
......
......@@ -147,6 +147,7 @@ class FileStorage(BaseConfig):
read_only=self.config.read_only,
quota=self.config.quota,
pack_gc=self.config.pack_gc,
blob_dir=self.config.blob_dir,
**options)
class BlobStorage(BaseConfig):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment