corvix.pipeline.provider ======================== .. py:module:: corvix.pipeline.provider .. autoapi-nested-parse:: Unified provider interfaces and shared context for the pipeline. Classes ------- .. autoapisummary:: corvix.pipeline.provider.PipelineContext corvix.pipeline.provider.FieldProvider corvix.pipeline.provider.ContextProvider Module Contents --------------- .. py:class:: PipelineContext Bases: :py:obj:`corvix.pipeline.base.RequestContext` Per-cycle request budget and URL cache shared across all pipeline providers. A single :class:`PipelineContext` is created per :meth:`PipelineEngine.run` call and passed to every provider, so that URL responses cached by a field-completion provider are visible to subsequent context providers in the same cycle. .. py:method:: get_json(client: corvix.pipeline.base.JsonFetchClient, url: str, timeout_seconds: float) -> corvix.types.JsonValue Fetch and cache a JSON payload; raises if the request budget is exhausted. .. py:class:: FieldProvider Bases: :py:obj:`Protocol` Provider that completes missing canonical fields on a :class:`~corvix.domain.Notification`. Field providers mutate the notification in-place by returning a (possibly replaced) :class:`~corvix.domain.Notification` with missing required fields filled in (e.g. ``subject_url``, ``web_url``). .. py:attribute:: name :type: str .. py:method:: hydrate(_notification: corvix.domain.Notification, _client: corvix.pipeline.base.JsonFetchClient, _ctx: PipelineContext, /) -> corvix.domain.Notification Return a notification with any missing required fields filled in. .. py:class:: ContextProvider Bases: :py:obj:`Protocol` Provider that attaches optional contextual data to a :class:`~corvix.domain.Notification`. Context providers return a mapping that is merged under the provider's ``name`` namespace in :attr:`~corvix.domain.NotificationRecord.context`. .. py:attribute:: name :type: str .. py:method:: enrich(_notification: corvix.domain.Notification, _client: corvix.pipeline.base.JsonFetchClient, _ctx: PipelineContext, /) -> dict[str, object] Return a mapping of context data to attach under this provider's namespace.