Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zodb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Joshua
zodb
Commits
6f70d777
Commit
6f70d777
authored
Dec 16, 2008
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added blob-dir configuration option.
parent
c49527eb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
4 deletions
+37
-4
src/ZODB/FileStorage/zconfig.txt
src/ZODB/FileStorage/zconfig.txt
+26
-3
src/ZODB/component.xml
src/ZODB/component.xml
+10
-1
src/ZODB/config.py
src/ZODB/config.py
+1
-0
No files found.
src/ZODB/FileStorage/zconfig.txt
View file @
6f70d777
...
...
@@ -2,8 +2,8 @@ Defining FileStorages using ZConfig
===================================
ZODB provides support for defining many storages, including
FileStorages, using ZConfig. To d
o this, you use a filestorage
section, and define a path:
FileStorages, using ZConfig. To d
efine 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:
...
...
src/ZODB/component.xml
View file @
6f70d777
...
...
@@ -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
...
...
src/ZODB/config.py
View file @
6f70d777
...
...
@@ -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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment