[Zodb-checkins] CVS: ZODB3/ZODB - component.xml:1.2 config.py:1.8
Fred L. Drake, Jr.
fred@zope.com
Mon, 13 Jan 2003 11:28:33 -0500
Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv29867
Modified Files:
component.xml config.py
Log Message:
Use opener objects for the database type as well as storage objects.
This opens the door for separate database implementations to work nicely
with the ZConfig "ZODB" component.
=== ZODB3/ZODB/component.xml 1.1 => 1.2 ===
--- ZODB3/ZODB/component.xml:1.1 Fri Jan 10 01:44:50 2003
+++ ZODB3/ZODB/component.xml Mon Jan 13 11:28:29 2003
@@ -72,7 +72,7 @@
</sectiontype>
- <sectiontype name="zodb"
+ <sectiontype name="zodb" datatype=".ZODBDatabase"
implements="database">
<section type="storage" name="*" attribute="storage"/>
<key name="cache-size" datatype="integer" default="5000"/>
=== ZODB3/ZODB/config.py 1.7 => 1.8 ===
--- ZODB3/ZODB/config.py:1.7 Fri Jan 10 01:44:50 2003
+++ ZODB3/ZODB/config.py Mon Jan 13 11:28:29 2003
@@ -43,19 +43,15 @@
return databaseFromConfig(config.database)
def databaseFromConfig(section):
- return ZODB.DB(section.storage.open(),
- pool_size=section.pool_size,
- cache_size=section.cache_size,
- version_pool_size=section.version_pool_size,
- version_cache_size=section.version_cache_size)
+ return section.open()
-class StorageConfig:
- """Object representing a configured storage.
+class BaseConfig:
+ """Object representing a configured storage or database.
Methods:
- open() -- open and return the storage object
+ open() -- open and return the configured object
Attributes:
@@ -71,13 +67,23 @@
"""Open and return the storage object."""
raise NotImplementedError
-class MappingStorage(StorageConfig):
+class ZODBDatabase(BaseConfig):
+
+ def open(self):
+ section = self.config
+ return ZODB.DB(section.storage.open(),
+ pool_size=section.pool_size,
+ cache_size=section.cache_size,
+ version_pool_size=section.version_pool_size,
+ version_cache_size=section.version_cache_size)
+
+class MappingStorage(BaseConfig):
def open(self):
from ZODB.MappingStorage import MappingStorage
return MappingStorage(self.config.name)
-class DemoStorage(StorageConfig):
+class DemoStorage(BaseConfig):
def open(self):
from ZODB.DemoStorage import DemoStorage
@@ -89,7 +95,7 @@
base=base,
quota=self.config.quota)
-class FileStorage(StorageConfig):
+class FileStorage(BaseConfig):
def open(self):
from ZODB.FileStorage import FileStorage
@@ -99,7 +105,7 @@
stop=self.config.stop,
quota=self.config.quota)
-class ZEOClient(StorageConfig):
+class ZEOClient(BaseConfig):
def open(self):
from ZEO.ClientStorage import ClientStorage
@@ -119,7 +125,7 @@
read_only=self.config.read_only,
read_only_fallback=self.config.read_only_fallback)
-class BDBStorage(StorageConfig):
+class BDBStorage(BaseConfig):
def open(self):
from BDBStorage.BerkeleyBase import BerkeleyConfig