Commit 5da2e04f authored by Fred Drake's avatar Fred Drake

Modify the BDB storage types in the ZConfig schema component so there is less

repitition and no magical guessing of type names in the datatypes.
parent 1e0ce827
......@@ -19,7 +19,10 @@
<key name="name" default="Mapping Storage"/>
</sectiontype>
<sectiontype name="fullstorage" datatype=".BDBStorage"
<!-- The BDB storages probably need to be revised somewhat still.
The extension relationship seems a little odd.
-->
<sectiontype name="fullstorage" datatype=".BDBFullStorage"
implements="storage">
<key name="name" required="yes" />
<key name="interval" datatype="time-interval" default="2m" />
......@@ -33,21 +36,8 @@
<key name="read-only" datatype="boolean" default="off"/>
</sectiontype>
<!-- XXX Fred promises to make it so minimal storage is just an
extension of fullstorage -->
<sectiontype name="minimalstorage" datatype=".BDBStorage"
implements="storage">
<key name="name" required="yes" />
<key name="interval" datatype="time-interval" default="2m" />
<key name="kbyte" datatype="integer" default="0" />
<key name="min" datatype="integer" default="0" />
<key name="logdir" />
<key name="cachesize" datatype="byte-size" default="128MB" />
<key name="frequency" datatype="time-interval" default="0" />
<key name="packtime" datatype="time-interval" default="4h" />
<key name="classicpack" datatype="integer" default="0" />
<key name="read-only" datatype="boolean" default="off"/>
</sectiontype>
<sectiontype name="minimalstorage" datatype=".BDBMinimalStorage"
implements="storage" extends="fullstorage"/>
<sectiontype name="zeoclient" datatype=".ZEOClient"
implements="storage">
......
......@@ -13,7 +13,7 @@
##############################################################################
"""Open database and storage from a configuration.
$Id: config.py,v 1.8 2003/01/13 16:28:29 fdrake Exp $"""
$Id: config.py,v 1.9 2003/01/16 17:50:36 fdrake Exp $"""
import os
import StringIO
......@@ -129,16 +129,22 @@ class BDBStorage(BaseConfig):
def open(self):
from BDBStorage.BerkeleyBase import BerkeleyConfig
from BDBStorage.BDBFullStorage import BDBFullStorage
from BDBStorage.BDBMinimalStorage import BDBMinimalStorage
# Figure out which class we want
sectiontype = self.config.getSectionType()
storageclass = {'fullstorage': BDBFullStorage,
'minimalstorage': BDBMinimalStorage,
}[sectiontype]
storageclass = self.get_storageclass()
bconf = BerkeleyConfig()
for name in dir(BerkeleyConfig):
if name.startswith('_'):
continue
setattr(bconf, name, getattr(self.config, name))
return storageclass(self.config.name, config=bconf)
class BDBMinimalStorage(BDBStorage):
def get_storageclass(self):
import BDBStorage.BDBMinimalStorage
return BDBStorage.BDBMinimalStorage.BDBMinimalStorage
class BDBFullStorage(BDBStorage):
def get_storageclass(self):
import BDBStorage.BDBFullStorage
return BDBStorage.BDBFullStorage.BDBFullStorage
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment