Beispiel #1
0
    def __init__(self, config, usethreads=False, writeback=False):
        "Initialize the datastore."

        self.conndb = {}

        DatastoreBase.__init__(self, config, usethreads, writeback)

        dbhosts = config.get(C.MEMBASE, C.DBHOST)
        dbport = config.get(C.MEMBASE, C.DBPORT)

        self.membasehosts = [h + ':' + dbport for h in dbhosts.split()]

        threads = [threading.currentThread()]
        if usethreads:
            threads.extend(self.threads)

        self.register_threads(threads)
Beispiel #2
0
    def __init__(self, config, usethreads=False, writeback=False):
        "Initialize the datastore."

        self.conndb = {}

        DatastoreBase.__init__(self, config, usethreads, writeback)

        dbhosts = config.get(C.MEMBASE, C.DBHOST)
        dbport = config.get(C.MEMBASE, C.DBPORT)

        self.membasehosts = [h + ':' + dbport for h in dbhosts.split()]

        threads = [threading.currentThread()]
        if usethreads:
            threads.extend(self.threads)

        self.register_threads(threads)
    def __init__(self, config, usethreads=False, writeback=False):
        "Initialize the datastore."

        self.conndb = {}

        DatastoreBase.__init__(self, config, usethreads, writeback)

        dbhosts = config.get(C.MEMBASE, C.DBHOST)
        dbport = config.get(C.MEMBASE, C.DBPORT)

        self.membasehosts = [h + ':' + dbport for h in dbhosts.split()]

        threads = [threading.currentThread()]
        if usethreads:
            threads.extend(self.threads)

        self.register_threads(threads)

        if writeback:
            # Store slab configuration information for subsequent
            # retrieval by the front end.
            slabconfig = new_osm_element(C.DATASTORE_CONFIG, C.CFGSLAB)
            for k in DatastoreMembase.SLAB_CONFIGURATION_KEYS:
                slabconfig[k] = config.get(C.DATASTORE, k)
            slabconfig[C.CONFIGURATION_SCHEMA_VERSION] = C.CFGVERSION
            self.slabconfig = slabconfig
        else:
            # Read slab configuration information from the data store.
            self.slabconfig = slabconfig = \
                self.retrieve_element(C.DATASTORE_CONFIG, C.CFGSLAB)
            if slabconfig is not None:
                schema_version = slabconfig.get(C.CONFIGURATION_SCHEMA_VERSION)
                if schema_version != C.CFGVERSION:
                    raise ValueError, \
                        "Datastore schema version mismatch: expected %s, " \
                        "actual %s." % \
                        (str(C.CFGVERSION), str(schema_version))
                for (k,v) in slabconfig.items():
                    if k in DatastoreMembase.SLAB_CONFIGURATION_KEYS:
                        config.set(C.DATASTORE, k, v)
            else:
                raise ValueError, \
                    "Datastore is missing configuration information."
Beispiel #4
0
    def __init__(self, config, usethreads=False, writeback=False):
        "Initialize the datastore."

        self.conndb = {}

        DatastoreBase.__init__(self, config, usethreads, writeback)

        dbhosts = config.get(C.MEMBASE, C.DBHOST)
        dbport = config.get(C.MEMBASE, C.DBPORT)

        self.membasehosts = [h + ':' + dbport for h in dbhosts.split()]

        threads = [threading.currentThread()]
        if usethreads:
            threads.extend(self.threads)

        self.register_threads(threads)

        if writeback:
            # Store slab configuration information for subsequent
            # retrieval by the front end.
            slabconfig = new_osm_element(C.DATASTORE_CONFIG, C.CFGSLAB)
            for k in DatastoreMembase.SLAB_CONFIGURATION_KEYS:
                slabconfig[k] = config.get(C.DATASTORE, k)
            slabconfig[C.CONFIGURATION_SCHEMA_VERSION] = C.CFGVERSION
            self.slabconfig = slabconfig
        else:
            # Read slab configuration information from the data store.
            self.slabconfig = slabconfig = \
                self.retrieve_element(C.DATASTORE_CONFIG, C.CFGSLAB)
            if slabconfig is not None:
                schema_version = slabconfig.get(C.CONFIGURATION_SCHEMA_VERSION)
                if schema_version != C.CFGVERSION:
                    raise ValueError, \
                        "Datastore schema version mismatch: expected %s, " \
                        "actual %s." % \
                        (str(C.CFGVERSION), str(schema_version))
                for (k, v) in slabconfig.items():
                    if k in DatastoreMembase.SLAB_CONFIGURATION_KEYS:
                        config.set(C.DATASTORE, k, v)
            else:
                raise ValueError, \
                    "Datastore is missing configuration information."