@transactional_session
def get_and_lock_file_replicas(scope, name, nowait=False, restrict_rses=None, session=None):
    '\n    Get file replicas for a specific scope:name.\n\n    :param scope:          The scope of the did.\n    :param name:           The name of the did.\n    :param nowait:         Nowait parameter for the FOR UPDATE statement\n    :param restrict_rses:  Possible RSE_ids to filter on.\n    :param session:        The db session in use.\n    :returns:              List of SQLAlchemy Replica Objects\n    '
    query = session.query(models.RSEFileAssociation).filter_by(scope=scope, name=name).filter((models.RSEFileAssociation.state != ReplicaState.BEING_DELETED))
    if (restrict_rses is not None):
        if (len(restrict_rses) < 10):
            rse_clause = []
            for rse_id in restrict_rses:
                rse_clause.append((models.RSEFileAssociation.rse_id == rse_id))
            if rse_clause:
                query = query.filter(or_(*rse_clause))
    return query.with_for_update(nowait=nowait).all()
Get file replicas for a specific scope:name.

:param scope:          The scope of the did.
:param name:           The name of the did.
:param nowait:         Nowait parameter for the FOR UPDATE statement
:param restrict_rses:  Possible RSE_ids to filter on.
:param session:        The db session in use.
:returns:              List of SQLAlchemy Replica Objects
@transactional_session
def get_and_lock_file_replicas(scope, name, nowait=False, restrict_rses=None, session=None):
    '\n    Get file replicas for a specific scope:name.\n\n    :param scope:          The scope of the did.\n    :param name:           The name of the did.\n    :param nowait:         Nowait parameter for the FOR UPDATE statement\n    :param restrict_rses:  Possible RSE_ids to filter on.\n    :param session:        The db session in use.\n    :returns:              List of SQLAlchemy Replica Objects\n    '
    query = session.query(models.RSEFileAssociation).filter_by(scope=scope, name=name).filter((models.RSEFileAssociation.state != ReplicaState.BEING_DELETED))
    if (restrict_rses is not None):
        if (len(restrict_rses) < 10):
            rse_clause = []
            for rse_id in restrict_rses:
                rse_clause.append((models.RSEFileAssociation.rse_id == rse_id))
            if rse_clause:
                query = query.filter(or_(*rse_clause))
    return query.with_for_update(nowait=nowait).all()