def sync_update(self, numsync: int, sync: CaseInsensitiveSet) -> Iterator[Transition]:
        """Updates :attr:`numsync` and :attr:`sync` fields.

        :param numsync: the new value for :attr:`numsync`.
        :param sync: the new value for :attr:`sync`:

        :yields: the new state of ``synchronous_standby_names`` as a :class:`Transition` object.

        :raises:
            :exc:`QuorumError` in case of invalid data or if invariant after transition could not be satisfied
        """
        if numsync < 0:
            raise QuorumError(f'Sync {numsync} < 0 of ({sync})')
        if numsync > len(sync):
            raise QuorumError(f'Sync {numsync} > N of ({sync})')

        self.numsync = numsync
        self.sync = sync
        self.check_invariants()
        logger.debug('sync %s %s %s', self.leader, self.numsync, self.sync)
        yield Transition('sync', self.leader, self.numsync, self.sync)
Updates :attr:`numsync` and :attr:`sync` fields.

        :param numsync: the new value for :attr:`numsync`.
        :param sync: the new value for :attr:`sync`:

        :yields: the new state of ``synchronous_standby_names`` as a :class:`Transition` object.

        :raises:
            :exc:`QuorumError` in case of invalid data or if invariant after transition could not be satisfied
        
patroni/quorum.py