slipstream.core =============== .. py:module:: slipstream.core .. autoapi-nested-parse:: Core module. Attributes ---------- .. autoapisummary:: slipstream.core.READ_FROM_START slipstream.core.READ_FROM_END Classes ------- .. autoapisummary:: slipstream.core.PausableStream Module Contents --------------- .. py:data:: READ_FROM_START :value: -2 .. py:data:: READ_FROM_END :value: -1 .. py:class:: PausableStream(it: collections.abc.AsyncIterable[Any]) Can signal source stream to pause. If `it` is of type `AsyncGenerator`, it will receive the signal through the yield send syntax in order to handle the state change appropriately. Alternatively, the `signal` property can be used directly. For example, the Topic class uses the signal to pause the Consumer. Only ``Signal.PAUSE`` pauses consumption; ``Signal.RESUME`` resumes it when no other pause reasons remain. Pause and resume are tracked per ``reason`` so independent callers compose (checkpoint downtime vs produce retry). Use ``counted=True`` when overlapping pauses share a reason, such as concurrent produces. .. py:property:: iterable :type: collections.abc.AsyncIterable[Any] Get iterable. .. py:attribute:: signal :type: slipstream.utils.Signal | Any :value: None .. py:attribute:: running :type: asyncio.Event .. py:method:: send_signal(signal: slipstream.utils.Signal | Any, reason: str = '', *, counted: bool = False) -> None Send signal to stream. ``PAUSE``/``RESUME`` compose by ``reason``. A counted reason increments on pause and decrements on resume; an uncounted reason latches until resumed. Resume is applied only when no reasons remain.