Skip to content

Commit

Permalink
Merge pull request #18 from NextThought/issue17
Browse files Browse the repository at this point in the history
Use the right name for the ZEO storage part.
  • Loading branch information
jamadden committed Nov 18, 2019
2 parents 0854705 + fa6ecf2 commit 8a7cf5d
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 48 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
1.0.0a3 (unreleased)
====================

- Nothing changed yet.
- ZEO: Fix a mismatch in case and storage names for the client ZCML in
zodb_conf.xml. See `issue 17 <https://github.com/NextThought/nti.recipes.zodb/issues/17>`_.


1.0.0a2 (2019-11-15)
Expand Down
65 changes: 35 additions & 30 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ the server location and account credentials.
them encrypted instead.

By default, the name of the database is the same as the storage name.
The storage name's case is preserved (this matters for cross-database
references.)

>>> write(sample_buildout, 'buildout.cfg',
... """
Expand All @@ -227,7 +229,7 @@ By default, the name of the database is the same as the storage name.
...
... [relstorage]
... recipe = nti.recipes.zodb:relstorage
... storages = users sessions
... storages = Users Sessions
... compress = none
... """)

Expand All @@ -241,52 +243,55 @@ By default, the name of the database is the same as the storage name.
- zodb_conf.xml
>>> cat(sample_buildout, 'etc', 'zodb_conf.xml')
%import relstorage
<zodb users>
<zodb Users>
cache-size 100000
database-name users
database-name Users
pool-size 60
<relstorage users>
<relstorage Users>
<mysql>
# This comment preserves whitespace
db users
db Users
host the_server
passwd the_passwd
user the_user
</mysql>
blob-dir /sample-buildout/data/users.blobs
cache-local-dir /sample-buildout/var/caches/data_cache/users.cache
blob-dir /sample-buildout/data/Users.blobs
cache-local-dir /sample-buildout/var/caches/data_cache/Users.cache
cache-local-mb 300
cache-prefix users
cache-prefix Users
commit-lock-timeout 60
keep-history false
name users
name Users
pack-gc false
shared-blob-dir false
</relstorage>
</zodb>
<zodb sessions>
<zodb Sessions>
cache-size 100000
database-name sessions
database-name Sessions
pool-size 60
<relstorage sessions>
<relstorage Sessions>
<mysql>
# This comment preserves whitespace
db sessions
db Sessions
host the_server
passwd the_passwd
user the_user
</mysql>
blob-dir /sample-buildout/data/sessions.blobs
cache-local-dir /sample-buildout/var/caches/data_cache/sessions.cache
blob-dir /sample-buildout/data/Sessions.blobs
cache-local-dir /sample-buildout/var/caches/data_cache/Sessions.cache
cache-local-mb 300
cache-prefix sessions
cache-prefix Sessions
commit-lock-timeout 60
keep-history false
name sessions
name Sessions
pack-gc false
shared-blob-dir false
</relstorage>
</zodb>
>>> cat(sample_buildout, 'etc', 'zeo_uris.ini')
[ZODB]
uris = /sample-buildout/etc/zodb_conf.xml#users /sample-buildout/etc/zodb_conf.xml#sessions

Much can be configured at both the recipe level and in a section named
for the storage (prefixed with the name of the recipe, unlike in the
Expand Down Expand Up @@ -540,7 +545,7 @@ pack-gc
...
... [zeo]
... recipe = nti.recipes.zodb:zeo
... storages = users sessions
... storages = Users Sessions
... compress = none
... pack-gc = true
...
Expand Down Expand Up @@ -572,25 +577,25 @@ The ``zodb_conf.xml`` and ``zeo_uris.ini`` are created as for RelStorage (the ``
prefixes are missing from the URIs because of a quirk in testing):

>>> cat(sample_buildout, 'etc', 'zodb_conf.xml')
<zodb users_client>
<zodb Users>
cache-size 100000
database-name users_client
database-name Users
pool-size 25
<zeoclient>
blob-dir /sample-buildout/data/users_client.blobs
name users_client
blob-dir /sample-buildout/data/Users.blobs
name Users
server /sample-buildout/var/zeosocket
shared-blob-dir true
storage 1
</zeoclient>
</zodb>
<zodb sessions_client>
<zodb Sessions>
cache-size 42
database-name sessions_client
database-name Sessions
pool-size 60
<zeoclient>
blob-dir /sample-buildout/data/sessions_client.blobs
name sessions_client
blob-dir /sample-buildout/data/Sessions.blobs
name Sessions
server /sample-buildout/var/zeosocket
shared-blob-dir true
storage 2
Expand Down Expand Up @@ -632,15 +637,15 @@ This is the actual ZEO server configuration, again prefixed with the part name.
</zeo>
<BLANKLINE>
<filestorage 1>
blob-dir /sample-buildout/data/users.blobs
blob-dir /sample-buildout/data/Users.blobs
pack-gc true
path /sample-buildout/data/users.fs
path /sample-buildout/data/Users.fs
</filestorage>
<BLANKLINE>
<filestorage 2>
blob-dir /sample-buildout/data/sessions.blobs
blob-dir /sample-buildout/data/Sessions.blobs
pack-gc true
path /sample-buildout/data/sessions.fs
path /sample-buildout/data/Sessions.fs
</filestorage>
<BLANKLINE>
<eventlog>
Expand Down
32 changes: 16 additions & 16 deletions src/nti/recipes/zodb/tests/test_zeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ def test_parse(self):
'pack-gc': 'true'})

expected = """\
<zodb users_1_client>
<zodb Users_1>
cache-size 100000
database-name users_1_client
database-name Users_1
pool-size 60
<zlibstorage>
<zeoclient>
blob-dir /data/users_1_client.blobs
name users_1_client
blob-dir /data/Users_1.blobs
name Users_1
server /var/zeosocket
shared-blob-dir true
storage 2
Expand Down Expand Up @@ -96,13 +96,13 @@ def test_parse_no_compress(self):
'compress': 'none',
})
expected = """\
<zodb users_1_client>
<zodb Users_1>
cache-size 100000
database-name users_1_client
database-name Users_1
pool-size 60
<zeoclient>
blob-dir /data/users_1_client.blobs
name users_1_client
blob-dir /data/Users_1.blobs
name Users_1
server /var/zeosocket
shared-blob-dir true
storage 2
Expand Down Expand Up @@ -158,13 +158,13 @@ def test_parse_override_defaults_in_opts(self):
})

expected = """\
<zodb users_1_client>
<zodb Users_1>
cache-size 100000
database-name users_1_client
database-name Users_1
pool-size 2
<zeoclient>
blob-dir /data/users_1_client.blobs
name users_1_client
blob-dir /data/Users_1.blobs
name Users_1
server /var/zeosocket
shared-blob-dir true
storage 1
Expand All @@ -186,13 +186,13 @@ def test_parse_override_defaults_in_recipe(self):
})

expected = """\
<zodb users_1_client>
<zodb Users_1>
cache-size 100000
database-name users_1_client
database-name Users_1
pool-size 2
<zeoclient>
blob-dir /data/users_1_client.blobs
name users_1_client
blob-dir /data/Users_1.blobs
name Users_1
server /var/zeosocket
shared-blob-dir true
storage 1
Expand Down
2 changes: 1 addition & 1 deletion src/nti/recipes/zodb/zeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def __init__(self, buildout, name, options):
client_part = Part(
client_part_name,
extends=client_part_extends,
name=client_part_name,
name=storage,
storage_num=i,
)
client_parts.append(client_part)
Expand Down

0 comments on commit 8a7cf5d

Please sign in to comment.