async def iter_all(
        self,
        direction: msg.StreamDirection = msg.StreamDirection.Forward,
        from_position: Optional[Union[msg.Position, msg._PositionSentinel]] = None,
        batch_size: int = 100,
        resolve_links: bool = True,
        require_master: bool = False,
        correlation_id: Optional[uuid.UUID] = None,
    ):
        """
        Read through all the events in the database.

        Args:
            direction (optional): Controls whether to read forward or backward
              through the events. Defaults to  StreamDirection.Forward
            from_position (optional): The position to start reading from.
              Defaults to photonpump.Beginning when direction is Forward,
              photonpump.End when direction is Backward.
            batch_size (optional): The maximum number of events to read at a time.
            resolve_links (optional): True if eventstore should
                automatically resolve Link Events, otherwise False.
            required_master (optional): True if this command must be
                sent direct to the master node, otherwise False.
            correlation_id (optional): A unique identifer for this
                command.

        Examples:

            Print every event from the database.

            >>> with async.connect() as conn:
            >>>     async for event in conn.iter_all()
            >>>         print(event)

            Print every event from the database in reverse order

            >>> with async.connect() as conn:
            >>>     async for event in conn.iter_all(direction=StreamDirection.Backward):
            >>>         print(event)

            Start reading from a known commit position

            >>> with async.connect() as conn:
            >>>     async for event in conn.iter_all(from_position=Position(12345))
            >>>         print(event)

        """
        correlation_id = correlation_id

        cmd = convo.IterAllEvents(
            msg.Position.for_direction(direction, from_position),
            batch_size,
            resolve_links,
            require_master,
            direction,
            self.credential,
            correlation_id,
        )
        result = await self.dispatcher.start_conversation(cmd)
        iterator = await result
        async for event in iterator:
            yield event
Read through all the events in the database.

        Args:
            direction (optional): Controls whether to read forward or backward
              through the events. Defaults to  StreamDirection.Forward
            from_position (optional): The position to start reading from.
              Defaults to photonpump.Beginning when direction is Forward,
              photonpump.End when direction is Backward.
            batch_size (optional): The maximum number of events to read at a time.
            resolve_links (optional): True if eventstore should
                automatically resolve Link Events, otherwise False.
            required_master (optional): True if this command must be
                sent direct to the master node, otherwise False.
            correlation_id (optional): A unique identifer for this
                command.

        Examples:

            Print every event from the database.

            >>> with async.connect() as conn:
            >>>     async for event in conn.iter_all()
            >>>         print(event)

            Print every event from the database in reverse order

            >>> with async.connect() as conn:
            >>>     async for event in conn.iter_all(direction=StreamDirection.Backward):
            >>>         print(event)

            Start reading from a known commit position

            >>> with async.connect() as conn:
            >>>     async for event in conn.iter_all(from_position=Position(12345))
            >>>         print(event)