Exemple #1
1
def sync(devices=[]):
    '''
    Run continuous synchronization between CouchDB instances.
    '''
    if len(devices) == 0:
        devices = local_config.get_default_devices()

    for name in devices:
        (url, path) = local_config.get_config(name)
        (device_id, device_password) = local_config.get_device_config(name)
        (db_login, db_password) = local_config.get_db_credentials(name)

        print 'Start continuous replication from Cozy to device.'
        replication.replicate(name, url, name, device_password, device_id,
                              db_login, db_password, to_local=True)
        print 'Start continuous replication from device to Cozy.'
        replication.replicate(name, url, name, device_password, device_id,
                              db_login, db_password)

        print 'Continuous replications started.'
        print 'Running daemon for binary synchronization...'
        try:
            context = local_config.get_daemon_context(name, 'sync')
            with context:
                replication.BinaryReplication(name)
        except KeyboardInterrupt:
            print ' Binary Synchronization interrupted.'
Exemple #2
0
def init_replication(name):
    '''
    Run initial replications then start continutous replication.
    Write device information in database.
    '''
    (url, path) = local_config.get_config(name)
    (device_id, password) = local_config.get_device_config(name)
    (db_login, db_password) = local_config.get_db_credentials(name)

    print 'Replication from remote to local...'
    replication.replicate(
        name, url, name, password, device_id, db_login, db_password,
        to_local=True, continuous=False, deleted=False)
    print 'Init device...'
    dbutils.init_device(name, url, path, password, device_id)
    print 'Replication from local to remote...'
    replication.replicate(
        name, url, name, password, device_id, db_login, db_password,
        to_local=False, continuous=False)

    print 'Continuous replication from remote to local setting...'
    replication.replicate(name, url, name, password, device_id,
                          db_login, db_password, to_local=True)

    print 'Continuous replication from local to remote setting...'
    replication.replicate(name, url, name, password, device_id,
                          db_login, db_password)
    print 'Metadata replications are done.'
def sync(name):
    '''
    Run continuous synchronization between CouchDB instances.
    '''
    (url, path) = local_config.get_config(name)
    (device_id, device_password) = local_config.get_device_config(name)
    (db_login, db_password) = local_config.get_db_credentials(name)

    replication.replicate(name, url, name, device_password, device_id,
                          db_login, db_password, to_local=True)
    replication.replicate(name, url, name, device_password, device_id,
                          db_login, db_password)

    print 'Continuous replications started.'
    print 'Running daemon for binary synchronization...'
    try:
        replication.BinaryReplication(name)
    except local_config.DaemonAlreadyRunning, e:
        print e
Exemple #4
0
def sync(name):
    '''
    Run continuous synchronization between CouchDB instances.
    '''
    (url, path) = local_config.get_config(name)
    (device_id, device_password) = local_config.get_device_config(name)
    (db_login, db_password) = local_config.get_db_credentials(name)

    replication.replicate(name, url, name, device_password, device_id,
                          db_login, db_password, to_local=True)
    replication.replicate(name, url, name, device_password, device_id,
                          db_login, db_password)

    print 'Continuous replications started.'
    print 'Running daemon for binary synchronization...'
    try:
        context = local_config.get_daemon_context(name, 'sync')
        with context:
            replication.BinaryReplication(name)
    except KeyboardInterrupt:
        print ' Binary Synchronization interrupted.'