'Create new database broker or update timestamps for existing database.
:param req: the swob request object
:param broker: the broker instance for the container
:param timestamp: internalized timestamp
:param new_container_policy: the storage policy index to use
when creating the container
:param requested_policy_index: the storage policy index sent in the
request, may be None
:returns: created, a bool, if database did not previously exist'

def _update_or_create(self, req, broker, timestamp, new_container_policy, requested_policy_index):

    if (not os.path.exists(broker.db_file)):
        try:
            broker.initialize(timestamp, new_container_policy)
        except DatabaseAlreadyExists:
            pass
        else:
            return True
    recreated = broker.is_deleted()
    if recreated:
        broker.set_storage_policy_index(new_container_policy, timestamp=timestamp)
    elif (requested_policy_index is not None):
        if (requested_policy_index != broker.storage_policy_index):
            raise HTTPConflict(request=req, headers={'x-backend-storage-policy-index': broker.storage_policy_index})
    broker.update_put_timestamp(timestamp)
    if broker.is_deleted():
        raise HTTPConflict(request=req)
    if recreated:
        broker.update_status_changed_at(timestamp)
    return recreated
