Recipe for setting up a blobstorage
===================================
This recipe can be used to define a blobstorage. It creates a ZConfig
file-storage database specification supporting blobs via zope.file that
can be used by other recipes to generate ZConfig configuration files.
This recipe takes an optional combination of a path and a blob_dir option.
If one is specified, the other is mandatory. If none are given (recommended),
the recipe creates and uses a subdirectory of the buildout parts directory
with the same name as the part and a subdirectory 'blobs' therein.
Additional options, like cache-size, can be given via the
storage-options
Parameter.
The recipe was derived from Jim's zc.filestorage recipe.
Original README follows:
========================
The recipe records a zconfig option for use by other recipes.
We'll show a couple of examples, using a dictionary as a simulated buildout
object::
>>> import zc.recipe.filestorage
>>> buildout = dict(
... buildout = {
... 'directory': '/buildout',
... },
... db = {
... 'path': 'foo/Main.fs',
... },
... )
>>> recipe = zc.recipe.filestorage.Recipe(
... buildout, 'db', buildout['db'])
>>> print buildout['db']['path']
/buildout/foo/Main.fs
>>> print buildout['db']['zconfig'],
<zodb>
<filestorage>
path /buildout/foo/Main.fs
</filestorage>
</zodb>
>>> recipe.install()
()
>>> import tempfile
>>> d = tempfile.mkdtemp()
>>> buildout = dict(
... buildout = {
... 'parts-directory': d,
... },
... db = {},
... )
>>> recipe = zc.recipe.filestorage.Recipe(
... buildout, 'db', buildout['db'])
>>> print buildout['db']['path']
/tmp/tmpQo0DTB/db/Data.fs
>>> print buildout['db']['blob-dir']
/tmp/tmpQo0DTB/db/blobs
>>> print buildout['db']['zconfig'],
<zodb>
<blobstorage>
blob-dir /tmp/tmpQo0DTB/db/blobs
<filestorage>
path /tmp/tmpQo0DTB/db/Data.fs
</filestorage>
</blobstorage>
</zodb>
>>> recipe.install()
()
>>> import os
>>> os.listdir(d)
['db']
The update method doesn't do anything, as the database part's directory
already exists, but it is present, so buildout doesn't complain and doesn't
accidentally run install() again::
>>> recipe.update()
To do
-----
- Add support for various file-storage options
- Create a ZODB-configuration recipe that is meant to be a base class for
storage recipes and provides database-configuration options.
===================================
This recipe can be used to define a blobstorage. It creates a ZConfig
file-storage database specification supporting blobs via zope.file that
can be used by other recipes to generate ZConfig configuration files.
This recipe takes an optional combination of a path and a blob_dir option.
If one is specified, the other is mandatory. If none are given (recommended),
the recipe creates and uses a subdirectory of the buildout parts directory
with the same name as the part and a subdirectory 'blobs' therein.
Additional options, like cache-size, can be given via the
storage-options
Parameter.
The recipe was derived from Jim's zc.filestorage recipe.
Original README follows:
========================
The recipe records a zconfig option for use by other recipes.
We'll show a couple of examples, using a dictionary as a simulated buildout
object::
>>> import zc.recipe.filestorage
>>> buildout = dict(
... buildout = {
... 'directory': '/buildout',
... },
... db = {
... 'path': 'foo/Main.fs',
... },
... )
>>> recipe = zc.recipe.filestorage.Recipe(
... buildout, 'db', buildout['db'])
>>> print buildout['db']['path']
/buildout/foo/Main.fs
>>> print buildout['db']['zconfig'],
<zodb>
<filestorage>
path /buildout/foo/Main.fs
</filestorage>
</zodb>
>>> recipe.install()
()
>>> import tempfile
>>> d = tempfile.mkdtemp()
>>> buildout = dict(
... buildout = {
... 'parts-directory': d,
... },
... db = {},
... )
>>> recipe = zc.recipe.filestorage.Recipe(
... buildout, 'db', buildout['db'])
>>> print buildout['db']['path']
/tmp/tmpQo0DTB/db/Data.fs
>>> print buildout['db']['blob-dir']
/tmp/tmpQo0DTB/db/blobs
>>> print buildout['db']['zconfig'],
<zodb>
<blobstorage>
blob-dir /tmp/tmpQo0DTB/db/blobs
<filestorage>
path /tmp/tmpQo0DTB/db/Data.fs
</filestorage>
</blobstorage>
</zodb>
>>> recipe.install()
()
>>> import os
>>> os.listdir(d)
['db']
The update method doesn't do anything, as the database part's directory
already exists, but it is present, so buildout doesn't complain and doesn't
accidentally run install() again::
>>> recipe.update()
To do
-----
- Add support for various file-storage options
- Create a ZODB-configuration recipe that is meant to be a base class for
storage recipes and provides database-configuration options.
Release files for iwm.recipe.blobstorage 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| iwm.recipe.blobstorage-0.0.2-py2.4.egg | Legacy Egg format | - | - | Details |
Release files / iwm.recipe.blobstorage-0.0.2-py2.4.egg
| Download URL | iwm.recipe.blobstorage-0.0.2-py2.4.egg |
|---|---|
| Size | 7.5 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
60224fa30e17596fb6a7f6300357d8c26433cd38b3deea6569057f42e99e3121
|
|
BLAKE2b-256 checksum How to use checksums |
263a567fa9e3abaaa207fd8242bfd63a54a75dbb35a89006f0366fa596d43693
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |