From fa6ecf270192d4d6b77d9d253ef02d71224cd7aa Mon Sep 17 00:00:00 2001 From: Jason Madden Date: Mon, 18 Nov 2019 12:24:49 -0600 Subject: [PATCH] Use the right name for the ZEO storage part. Fixes #17 --- CHANGES.rst | 3 +- README.rst | 65 ++++++++++++++------------ src/nti/recipes/zodb/tests/test_zeo.py | 32 ++++++------- src/nti/recipes/zodb/zeo.py | 2 +- 4 files changed, 54 insertions(+), 48 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 429e8f1..d339a17 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -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 `_. 1.0.0a2 (2019-11-15) diff --git a/README.rst b/README.rst index 8bf725f..5fd6ca3 100644 --- a/README.rst +++ b/README.rst @@ -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', ... """ @@ -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 ... """) @@ -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 - + cache-size 100000 - database-name users + database-name Users pool-size 60 - + # This comment preserves whitespace - db users + db Users host the_server passwd the_passwd user the_user - 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 - + cache-size 100000 - database-name sessions + database-name Sessions pool-size 60 - + # This comment preserves whitespace - db sessions + db Sessions host the_server passwd the_passwd user the_user - 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 + >>> 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 @@ -540,7 +545,7 @@ pack-gc ... ... [zeo] ... recipe = nti.recipes.zodb:zeo - ... storages = users sessions + ... storages = Users Sessions ... compress = none ... pack-gc = true ... @@ -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') - + cache-size 100000 - database-name users_client + database-name Users pool-size 25 - 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 - + cache-size 42 - database-name sessions_client + database-name Sessions pool-size 60 - 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 @@ -632,15 +637,15 @@ This is the actual ZEO server configuration, again prefixed with the part name. - 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 - 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 diff --git a/src/nti/recipes/zodb/tests/test_zeo.py b/src/nti/recipes/zodb/tests/test_zeo.py index 093fb38..82739df 100644 --- a/src/nti/recipes/zodb/tests/test_zeo.py +++ b/src/nti/recipes/zodb/tests/test_zeo.py @@ -26,14 +26,14 @@ def test_parse(self): 'pack-gc': 'true'}) expected = """\ - + cache-size 100000 - database-name users_1_client + database-name Users_1 pool-size 60 - 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 @@ -96,13 +96,13 @@ def test_parse_no_compress(self): 'compress': 'none', }) expected = """\ - + cache-size 100000 - database-name users_1_client + database-name Users_1 pool-size 60 - 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 @@ -158,13 +158,13 @@ def test_parse_override_defaults_in_opts(self): }) expected = """\ - + cache-size 100000 - database-name users_1_client + database-name Users_1 pool-size 2 - 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 @@ -186,13 +186,13 @@ def test_parse_override_defaults_in_recipe(self): }) expected = """\ - + cache-size 100000 - database-name users_1_client + database-name Users_1 pool-size 2 - 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 diff --git a/src/nti/recipes/zodb/zeo.py b/src/nti/recipes/zodb/zeo.py index 12ef59a..5a313c6 100644 --- a/src/nti/recipes/zodb/zeo.py +++ b/src/nti/recipes/zodb/zeo.py @@ -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)