def maybe_filter_permanent_slots(self, postgresql: 'Postgresql', slots: Dict[str, int]) -> Dict[str, int]:
        """Filter out all non-permanent slots from provided *slots* dict.

        .. note::
             In case if retention of replication slots for members is enabled we will not do
             any filtering, because we need to publish LSN values for members replication slots,
             so that other nodes can use them to advance LSN, like they do it for permanent slots.

        :param postgresql: reference to :class:`Postgresql` object.
        :param slots: slot names with LSN values.
        :returns: a :class:`dict` object that contains only slots that are known to be permanent.
        """
        from ..postgresql.misc import PostgresqlRole

        if global_config.member_slots_ttl > 0:
            return slots

        permanent_slots: Dict[str, Any] = self._get_permanent_slots(postgresql, RemoteMember('', {}),
                                                                    PostgresqlRole.REPLICA)
        members_slots = {slot_name_from_member_name(m.name) for m in self.members}

        return {name: value for name, value in slots.items() if name in permanent_slots
                and (self.is_physical_slot(permanent_slots[name])
                     or self.is_logical_slot(permanent_slots[name]) and name not in members_slots)}
Filter out all non-permanent slots from provided *slots* dict.

        .. note::
             In case if retention of replication slots for members is enabled we will not do
             any filtering, because we need to publish LSN values for members replication slots,
             so that other nodes can use them to advance LSN, like they do it for permanent slots.

        :param postgresql: reference to :class:`Postgresql` object.
        :param slots: slot names with LSN values.
        :returns: a :class:`dict` object that contains only slots that are known to be permanent.
        
patroni/dcs/__init__.py