'Replicate the db, choosing method based on whether or not it
already exists on peers.
:param partition: partition to be replicated to
:param object_file: DB file name to be replicated
:param node_id: node id of the node to be replicated to'

def _replicate_object(self, partition, object_file, node_id):

    start_time = now = time.time()
    self.logger.debug('Replicating    db    %s', object_file)
    self.stats['attempted'] += 1
    self.logger.increment('attempts')
    shouldbehere = True
    try:
        broker = self.brokerclass(object_file, pending_timeout=30)
        broker.reclaim((now - self.reclaim_age), (now - (self.reclaim_age * 2)))
        info = broker.get_replication_info()
        bpart = self.ring.get_part(info['account'], info.get('container'))
        if (bpart != int(partition)):
            partition = bpart
            shouldbehere = False
            name = ('/' + quote(info['account']))
            if ('container' in info):
                name += ('/' + quote(info['container']))
            self.logger.error(('Found    %s    for    %s    when    it    should    be    on    partition    %s;    will    replicate    out    and    remove.' % (object_file, name, bpart)))
    except (Exception, Timeout) as e:
        if ('no    such    table' in str(e)):
            self.logger.error(_('Quarantining    DB    %s'), object_file)
            quarantine_db(broker.db_file, broker.db_type)
        else:
            self.logger.exception(_('ERROR    reading    db    %s'), object_file)
        nodes = self.ring.get_part_nodes(int(partition))
        self._add_failure_stats([(failure_dev['replication_ip'], failure_dev['device']) for failure_dev in nodes])
        self.logger.increment('failures')
        return
    delete_timestamp = Timestamp((info.get('delete_timestamp') or 0))
    put_timestamp = Timestamp((info.get('put_timestamp') or 0))
    if (((now - self.reclaim_age) > delete_timestamp > put_timestamp) and (info['count'] in (None, '', 0, '0'))):
        if self.report_up_to_date(info):
            self.delete_db(broker)
        self.logger.timing_since('timing', start_time)
        return
    responses = []
    failure_devs_info = set()
    nodes = self.ring.get_part_nodes(int(partition))
    local_dev = None
    for node in nodes:
        if (node['id'] == node_id):
            local_dev = node
            break
    if shouldbehere:
        shouldbehere = bool([n for n in nodes if (n['id'] == node_id)])
    if (len(nodes) > 1):
        i = 0
        while ((i < len(nodes)) and (nodes[i]['id'] != node_id)):
            i += 1
        repl_nodes = (nodes[(i + 1):] + nodes[:i])
    else:
        repl_nodes = nodes
    more_nodes = self.ring.get_more_nodes(int(partition))
    if (not local_dev):
        for node in self.ring.get_more_nodes(int(partition)):
            if (node['id'] == node_id):
                local_dev = node
                break
    for node in repl_nodes:
        different_region = False
        if (local_dev and (local_dev['region'] != node['region'])):
            different_region = True
        success = False
        try:
            success = self._repl_to_node(node, broker, partition, info, different_region)
        except DriveNotMounted:
            try:
                repl_nodes.append(next(more_nodes))
            except StopIteration:
                self.logger.error(_('ERROR    There    are    not    enough    handoff    nodes    to    reach    replica    count    for    partition    %s'), partition)
            self.logger.error(_('ERROR    Remote    drive    not    mounted    %s'), node)
        except (Exception, Timeout):
            self.logger.exception(_('ERROR    syncing    %(file)s    with    node    %(node)s'), {'file': object_file, 'node': node})
        if (not success):
            failure_devs_info.add((node['replication_ip'], node['device']))
        self.logger.increment(('successes' if success else 'failures'))
        responses.append(success)
    try:
        self._post_replicate_hook(broker, info, responses)
    except (Exception, Timeout):
        self.logger.exception('UNHANDLED    EXCEPTION:    in    post    replicate    hook    for    %s', broker.db_file)
    if ((not shouldbehere) and responses and all(responses)):
        if (not self.delete_db(broker)):
            failure_devs_info.update([(failure_dev['replication_ip'], failure_dev['device']) for failure_dev in repl_nodes])
    target_devs_info = set([(target_dev['replication_ip'], target_dev['device']) for target_dev in repl_nodes])
    self.stats['success'] += len((target_devs_info - failure_devs_info))
    self._add_failure_stats(failure_devs_info)
    self.logger.timing_since('timing', start_time)
