From 4c706218ca31b5a7ee7eef3612f74e006642bf06 Mon Sep 17 00:00:00 2001 From: Benjamin Saller Date: Wed, 18 Jul 2007 19:39:34 +0000 Subject: chunk documents a bit more on read to reduce memory strain read mimetypes from gnomevfs on usb mounts changed converters guess code to gnomevfs as well --- diff --git a/bin/datastore b/bin/datastore deleted file mode 100755 index dad3df9..0000000 --- a/bin/datastore +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env python -from ore.main import Application -from olpc.datastore import DataStore -from olpc.datastore.indexer import INDEX_SERVICE, INDEX_OBJECT_PATH -import os, signal, sys -import dbus -import dbus.mainloop.glib - -profile = os.environ.get('SUGAR_PROFILE', 'default') -base_dir = os.path.join(os.path.expanduser('~'), '.sugar', profile) -repo_dir = os.path.join(base_dir, 'datastore') -db_dir = "sqlite:///%s/datastore.db" % repo_dir - -import logging - -def handle_shutdown(signum, frame): - dsa.stop() - raise SystemExit("Shutting down on signal %s" % signum) - -# check for old lockfiles, the rules here are that we can't be -# connected to a tty. If we are not then in all likelyhood the process -# was started automatically, which hopefully implies a single instance -if not sys.stdin.isatty(): - lf = os.path.join(repo_dir, 'fulltext', 'flintlock') - if os.path.exists(lf): - logging.warning("Old lock file found -- removing.") - os.unlink(lf) - - -class DataStoreApplication(Application): - def manage_options(self): - self.parser.add_option("--olpc.repo", dest="repo_dir", - action="store", default=repo_dir, - help="""Location of the Repository""") - - self.parser.add_option("--olpc.metadata", dest="md_db", - action="store", default=db_dir, - help="""Location of the Repository""") - - self.parser.add_option("--olpc.debug.db", dest="debug_db", - action="store_true", default=False, - help="""Dump database work""") - - self.parser.add_option("--olpc.fulltext.sync", dest="querymanager_sync_index", - action="store_true", default=False, - help="""Force the indexer in-process in - synchronous mode.""") - - self.parser.add_option("--olpc.fulltext.debug_indexer", - dest="start_indexer", - action="store_false", default=True, - help="""Don't make an attempt to start the indexer (use existing -- for debug)""") - - - def main(self): - # operate from the repo directory - if not os.path.exists(repo_dir): - os.makedirs(repo_dir) - os.chdir(repo_dir) - - self.ds = DataStore(self.options.repo_dir, - self.options.md_db, - querymanager_sync_index=self.options.querymanager_sync_index) - - if self.options.sync_index is False and self.options.start_indexer: - # trigger the index service - bus = dbus.SessionBus() - indexer = bus.get_object(INDEX_SERVICE, INDEX_OBJECT_PATH) - - if self.options.debug_db: - logging.getLogger('sqlalchemy.orm.unitofwork').setLevel(logging.DEBUG) - self.ds.querymanager.db.echo = True - - # register the signal handler - signal.signal(signal.SIGHUP, handle_shutdown) - signal.signal(signal.SIGTERM, handle_shutdown) - - try: - self.eventloop.run() - except: self.ds.stop() - -dsa = DataStoreApplication("datastore") -dsa.plugins.append('ore.main.profile_support.ProfileSupport') -dsa() - - - -- cgit v0.9.1