def __permanent_slots(self) -> Dict[str, Union[Dict[str, Any], Any]]:
        """Dictionary of permanent replication slots with their known LSN."""
        ret: Dict[str, Union[Dict[str, Any], Any]] = global_config.permanent_slots

        members: Dict[str, int] = {slot_name_from_member_name(m.name): m.lsn or 0
                                   for m in self.members if m.replicatefrom}
        slots: Dict[str, int] = self.slots
        for name, value in list(ret.items()):
            if not value:
                value = ret[name] = {}
            if isinstance(value, dict):
                # For permanent physical slots we want to get MAX LSN from the `Cluster.slots` and from the
                # member that does cascading replication with the matching name (see `replicatefrom` tag).
                # It is necessary because we may have the permanent replication slot on the primary for this node.
                lsn = max(members.get(name, 0) if self.is_physical_slot(value) else 0, slots.get(name, 0))
                if lsn:
                    value['lsn'] = lsn
                else:
                    # Don't let anyone set 'lsn' in the global configuration :)
                    value.pop('lsn', None)  # pyright: ignore [reportUnknownMemberType]
        return ret
Dictionary of permanent replication slots with their known LSN.
patroni/dcs/__init__.py