'Sync a whole db using rsync.
:param broker: DB broker object of DB to be synced
:param device: device to sync to
:param http: ReplConnection object
:param local_id: unique ID of the local database replica
:param replicate_method: remote operation to perform after rsync
:param replicate_timeout: timeout to wait in seconds
:param different_region: if True, the destination node is in a
different region'

def _rsync_db(self, broker, device, http, local_id, replicate_method='complete_rsync', replicate_timeout=None, different_region=False):

    rsync_module = rsync_module_interpolation(self.rsync_module, device)
    rsync_path = ('%s/tmp/%s' % (device['device'], local_id))
    remote_file = ('%s/%s' % (rsync_module, rsync_path))
    mtime = os.path.getmtime(broker.db_file)
    if (not self._rsync_file(broker.db_file, remote_file, different_region=different_region)):
        return False
    if (os.path.exists((broker.db_file + '-journal')) or (os.path.getmtime(broker.db_file) > mtime)):
        with broker.lock():
            if (not self._rsync_file(broker.db_file, remote_file, whole_file=False, different_region=different_region)):
                return False
    with Timeout((replicate_timeout or self.node_timeout)):
        response = http.replicate(replicate_method, local_id)
    return (response and (200 <= response.status < 300))
