anyio
etrack.providers.adapters.bus.anyio
providers/adapters/bus/anyio: AnyioAdapter — one bounded stream and one worker per sink, publish never waits.
publish is synchronous and returns at once: on the loop's thread it queues the event on every sink that takes its
phase; from any other thread it hops onto the loop first. A full stream drops the event for that sink alone and counts
it — unless the subscription is GUARANTEED, whose stream is unbounded and never drops. Each worker masks the event with the subscription's Redact, applies its Select, narrows the event onto the sink's view and awaits send; a
select or a sink that raises is logged and skipped, never the producer's problem nor another sink's. Leaving the bus
closes every stream, lets each worker deliver what is still queued, then stops.
A supervisor task owns the task group for the bus's whole life, so the bus is entered and left by any task: anyio cancel scopes are task-bound, and a host (pytest-asyncio fixtures, a lifespan split across tasks) need not be one.
AnyioAdapter
AnyioAdapter(**given: Unpack[AnyioConfig])
The in-process fan-out: sinks subscribe before or after it opens; events reach each sink in publish order.
Keyword arguments as AnyioConfig names them; what is not given, ETRACK_BUS_* fills (infra/defaults).
dropped
property
Events lost per sink because its stream was full or closed.
publish
publish(event: RunEvent) -> None
Queue the event for every sink that takes its phase; from a foreign thread, hop onto the loop first.
subscribe
subscribe(
sink: SinkPort,
select: Select | None = None,
*,
redact: Redact | None = None,
delivery: Delivery = BEST_EFFORT,
) -> None
A sink served from now on, masked by redact and through select when given, its queue bounded unless
delivery is guaranteed; named by its spec, numbered when repeated.