Source code for edri.dataclass.topology

from dataclasses import dataclass
from datetime import datetime

__all__ = ["ComponentNode", "ConnectorNode", "UnroutedEvent"]


[docs] @dataclass class ComponentNode: """One connected component in the Router's live routing graph. ``requests`` / ``responses`` are the event-type names it is subscribed to. ``health`` is the health checker's status name (``None`` when the component has no record yet). ``queue_depth`` / ``slow`` / ``failed`` come from its outbound worker; ``oldest_pending_seconds`` is how long the in-flight send has been stuck once it passes ``ROUTER_OUTBOUND_STALL_SECONDS``, ``None`` while delivery is healthy. """ name: str requests: list[str] responses: list[str] health: str | None ready: bool queue_depth: int slow: bool failed: bool oldest_pending_seconds: float | None
[docs] @dataclass class ConnectorNode: """The connector edge - which shareable types cross to the Switch. ``oldest_pending_seconds`` follows the same stalled-send rule as :class:`ComponentNode`. """ requests: list[str] responses: list[str] queue_depth: int slow: bool failed: bool oldest_pending_seconds: float | None
[docs] @dataclass class UnroutedEvent: """An event type the Router dropped because nothing was subscribed. ``direction`` is ``"request"`` or ``"response"``. ``count`` and ``last_seen`` tally the drops since the Router started. ``known`` is ``True`` when the subscription map still holds a key for this type - a handler existed and went away - and ``False`` when it was never subscribed at all. """ name: str direction: str count: int last_seen: datetime known: bool