def startService(self): """ Start the database service. """ # start processing logfd messages self._logfd = LogFD() self._logfd.startReading() # open the db environment self._env = Env(self._dbdir, self._options) logger.debug("[%s] opened database environment in %s" % (self.name,self._dbdir)) Plugin.startService(self)
class StoreOutputPlugin(Plugin): implements(IPlugin) components = [(StoreOutput, IOutput, 'store')] def __init__(self): Plugin.__init__(self) self._env = None self._outputs = {} def configure(self, section): """ Configure the store plugin. """ self._dbdir = os.path.abspath(section.getPath('data directory', '/var/lib/terane/db/')) self._options = {} self._options['cache size'] = long(section.getInt('cache size', 64 * 1024 * 1024)) self._options['max lockers'] = long(section.getInt('max lockers', 65536)) self._options['max locks'] = long(section.getInt('max locks', 65536)) self._options['max objects'] = long(section.getInt('max objects', 65536)) self._options['max transactions'] = long(section.getInt('max transactions', 0)) def startService(self): """ Start the database service. """ # start processing logfd messages self._logfd = LogFD() self._logfd.startReading() # open the db environment self._env = Env(self._dbdir, self._options) logger.debug("[%s] opened database environment in %s" % (self.name,self._dbdir)) Plugin.startService(self) def stopService(self): """ Stop the database service, closing all open indices. """ Plugin.stopService(self) # close the DB environment self._env.close() self._logfd.stopReading() self._logfd = None logger.debug("[%s] closed database environment" % self.name)