from __future__ import annotations

from collections.abc import AsyncIterator, Coroutine, Iterable
from typing import Any

class IPCRingBufferConfig:
    path: str
    backlog: int
    num_producers: int
    num_consumers: int

    def __init__(
        self, path: str, backlog: int, num_producers: int, num_consumers: int
    ) -> None: ...
    @classmethod
    def default(cls) -> IPCRingBufferConfig: ...
    def should_producer_bind(self) -> bool: ...

class IPCRingBufferProducer:
    def __init__(self, config: IPCRingBufferConfig) -> None: ...
    def insert(self, item: bytes, copy: bool = True) -> None: ...
    def insert_batch(self, items: Iterable[bytes], copy: bool = True) -> None: ...
    def insert_packed(self, batch: Iterable[bytes], copy: bool = True) -> None: ...
    def stop(self) -> None: ...

class IPCRingBufferConsumer:
    def __init__(self, config: IPCRingBufferConfig) -> None: ...
    def consume(self) -> bytes: ...
    def consume_all(self) -> list[bytes]: ...
    def consume_packed(self) -> list[bytes]: ...
    def aconsume(self) -> Coroutine[Any, Any, bytes]: ...
    def aconsume_packed(self) -> Coroutine[Any, Any, list[bytes]]: ...
    def stop(self) -> None: ...
    def __aiter__(self) -> AsyncIterator[bytes]: ...
    async def __anext__(self) -> bytes: ...
