Added some configuration for cdb.

This commit is contained in:
Jeremy Fincher 2004-09-30 04:15:12 +00:00
parent 75ef036569
commit 45f99cd1ee

View File

@ -37,6 +37,7 @@ import time
import socket
import string
import supybot.cdb as cdb
import supybot.utils as utils
import supybot.registry as registry
import supybot.ircutils as ircutils
@ -752,6 +753,22 @@ registerChannelValue(supybot.databases.plugins, 'channelSpecific',
can be channel-specific will be so. This can be overridden by individual
channels."""))
class CDB(registry.Boolean):
def connect(self, filename):
journalName = supybot.directories.data.tmp.dirize(filename+'.journal')
return cdb.open(filename, 'c',
journalName=journalName,
maxmods=self.maximumModifications())
registerGroup(supybot.databases, 'types')
registerGlobalValue(supybot.databases.types, 'cdb', CDB(True, """Determines
whether CDB databases will be allowed as a database implementation."""))
registerGlobalValue(supybot.databases.types.cdb, 'maximumModifications',
registry.Float(0.5, """Determines how often CDB databases will have their
modifications flushed to disk. When the number of modified records is
greater than this part of the number of unmodified records, the database
will be entirely flushed to disk."""))
# XXX Configuration variables for dbi, sqlite, flat, mysql, etc.
###