Ejemplo n.º 1
0
def migrate(app, from_store, to_store):
    """migrate <from> <to>: copies your source/event storage from one backend to another."""

    bad_store = None

    if not to_store in store_map:
        bad_store = to_store

    if not from_store in store_map:
        bad_store = from_store

    if bad_store:
        print "Invalid storage engine '{store}' specified. Must be one of:".format(store=bad_store)
        for store in store_map:
            print "  " + store
        sys.exit(1)

    from_store = create_store(from_store)
    to_store = create_store(to_store)

    class MigratingSource(object):
        def __init__(self, id, config):
            self.source_id = id
            self.config = config
            self.kind = self.config['kind']

    sources = from_store.get_sources()
    for source_id, source_data in sources.iteritems():
        to_store.store_source(MigratingSource(source_id, source_data))

    to_store.store_events(list(from_store.events(count=sys.maxint)))
Ejemplo n.º 2
0
def migrate(app, from_store, to_store):
    """migrate <from> <to>: copies your source/event storage from one backend to another."""

    bad_store = None

    if not to_store in store_map:
        bad_store = to_store

    if not from_store in store_map:
        bad_store = from_store

    if bad_store:
        print "Invalid storage engine '{store}' specified. Must be one of:".format(
            store=bad_store)
        for store in store_map:
            print "  " + store
        sys.exit(1)

    from_store = create_store(from_store)
    to_store = create_store(to_store)

    class MigratingSource(object):
        def __init__(self, id, config):
            self.source_id = id
            self.config = config
            self.kind = self.config['kind']

    sources = from_store.get_sources()
    for source_id, source_data in sources.iteritems():
        to_store.store_source(MigratingSource(source_id, source_data))

    to_store.store_events(list(from_store.events(count=sys.maxint)))
Ejemplo n.º 3
0
    def __init__(self):
        self.sources = {}

        engine = os.environ.get('BEEN_STORE', 'couch')
        self.store = create_store(engine)

        for source_id, source_data in self.store.get_sources().iteritems():
            self.sources[source_id] = create_source(source_data)
Ejemplo n.º 4
0
    def __init__(self):
        self.sources = {}

        engine = os.environ.get('BEEN_STORE', 'couch')
        self.store = create_store(engine)

        for source_id, source_data in self.store.get_sources().iteritems():
            self.sources[source_id] = create_source(source_data)