Module adcp.reporting.production.store
The store contract the production composition depends on.
:class:~adcp.reporting.production.service.ReportingProductionSupport composes
a materializer, a status projection and notification workers over one store.
It used to recognize the two shipped stores by class. The in-memory store now
lives in adcp and the PostgreSQL store in adcp-reporting-storage, so
the composition asks the store instead: which projection and queues belong to
it, whether its schema is installed, what maintenance it needs. Both shipped
stores keep the exact-class checks inside their own answers, so an adopter
subclass is still refused where it was refused before.
Global variables
var MaintenanceOperation-
A named, bounded, resumable retention pass the production worker schedules.
var SavedDeliveryWindow-
(queue, body_sha256, started_at, expires_at)of a recorded first attempt.
Classes
class ReportingProductionProjection (*args, **kwargs)-
Expand source code
@runtime_checkable class ReportingProductionProjection(Protocol): """The v2 status projection a production store builds over itself.""" ledger: Any outbox: Any escalation: ReportingDeliveryEscalation | None consumer_status_enabled: bool @property def policy(self) -> dict[str, Any]: ... async def rebuild_one(self) -> StatusTurn: ... async def sweep_one(self) -> StatusTurn: ... async def activate(self, *, account_id: str) -> bool: ...The v2 status projection a production store builds over itself.
Ancestors
- typing.Protocol
- typing.Generic
Class variables
var consumer_status_enabled : boolvar escalation : ReportingDeliveryEscalation | Nonevar ledger : Anyvar outbox : Any
Instance variables
prop policy : dict[str, Any]-
Expand source code
@property def policy(self) -> dict[str, Any]: ...
Methods
async def activate(self, *, account_id: str) ‑> bool-
Expand source code
async def activate(self, *, account_id: str) -> bool: ... async def rebuild_one(self) ‑> StatusTurn-
Expand source code
async def rebuild_one(self) -> StatusTurn: ... async def sweep_one(self) ‑> StatusTurn-
Expand source code
async def sweep_one(self) -> StatusTurn: ...
class ReportingProductionStore (*args, **kwargs)-
Expand source code
@runtime_checkable class ReportingProductionStore( ReportingLedgerStore, ReportingReconciliationStore, ReportingMaterializerStore, ReportingReceiptBatchStore, ReportingFeedStore, Protocol, ): """A ledger that can carry the production composition. It is a Core ledger, a reconciliation store, a materializer store, a receipt-batch store and a frozen feed store at once, plus the composition hooks below. """ #: Set by :class:`ReportingProductionSupport` when it takes ownership of the store. production_support: weakref.ReferenceType[ReportingProductionSupport] | None #: Set by the status projection; the composition checks it matches its policy. projection_read_policy: dict[str, Any] @property def durable(self) -> bool: """Whether storage survives the process. Only durable stores advertise production.""" ... @property def clock(self) -> Callable[[], datetime] | None: """The explicit clock override, or ``None`` for the store's own time source.""" ... @property def storage_identity(self) -> object: """The resource shared by every participant (a pool, or the store itself).""" ... @property def storage_open(self) -> bool: """Whether that resource still accepts work.""" ... def is_sdk_production_store(self) -> bool: """Exactly a shipped production store, not a subclass.""" ... def status_projection( self, *, consumer_status_enabled: bool, escalation: ReportingDeliveryEscalation | None, revision_ownership: bool, ) -> ReportingProductionProjection: ... def is_sdk_status_projection(self, projection: object) -> bool: """Exactly the shipped projection class for this store.""" ... def projection_linked(self, projection: ReportingProductionProjection) -> bool: """Whether the projection's queue shares this store's storage.""" ... def production_outboxes( self, projection: ReportingProductionProjection ) -> tuple[Any, Any, Any]: """The core, status and readiness queues, in that order.""" ... def notification_workers_linked(self, workers: Sequence[ReportingNotificationWorker]) -> bool: """Whether every worker drives this store's exact queue classes over its storage.""" ... async def validate_production_schema( self, *, notifications: bool, service_context: bool ) -> None: """Raise ``reporting_production_schema_unready`` unless the catalog is installed.""" ... async def read_delivery_window( self, key: tuple[str, str], *, now: datetime ) -> tuple[SavedDeliveryWindow | None, datetime]: """The recorded window for ``(account_id, idempotency_key)`` and the store's instant.""" ... async def reserve_delivery_attempt( self, activity: ReportingActivityStore, lease: DeliveryLease, *, request: ActivityRequest, now: datetime, queue: str, expected: tuple[str, str], horizon_seconds: int, ) -> tuple[WebhookAttempt | None, datetime | None, bool]: """Reserve one HTTP attempt and its immutable first-attempt deadline atomically.""" ... def maintenance_operations(self) -> tuple[MaintenanceOperation, ...]: """Retention passes for the features this store opted into, in run order.""" ... async def activate_production(self, *, account_id: str) -> bool: ... async def admit_production_configuration( self, configuration: ReportingConfiguration, binding: ReportingDestinationBinding, *, offering_id: str, service_context: ReportingProductionSourceContext | None = None, ) -> None: ...A ledger that can carry the production composition.
It is a Core ledger, a reconciliation store, a materializer store, a receipt-batch store and a frozen feed store at once, plus the composition hooks below.
Ancestors
- ReportingLedgerStore
- ReportingReconciliationStore
- ReportingDestinationStore
- ReportingMaterializationStore
- ReportingReceiptStore
- ReportingMaterializerStore
- ReportingRevisionRowReader
- ReportingReceiptBatchStore
- ReportingFeedStore
- typing.Protocol
- typing.Generic
Class variables
var production_support : weakref.ReferenceType[ReportingProductionSupport] | None-
Set by :class:
ReportingProductionSupportwhen it takes ownership of the store. var projection_read_policy : dict[str, Any]-
Set by the status projection; the composition checks it matches its policy.
Instance variables
prop clock : Callable[[], datetime] | None-
Expand source code
@property def clock(self) -> Callable[[], datetime] | None: """The explicit clock override, or ``None`` for the store's own time source.""" ...The explicit clock override, or
Nonefor the store's own time source. prop durable : bool-
Expand source code
@property def durable(self) -> bool: """Whether storage survives the process. Only durable stores advertise production.""" ...Whether storage survives the process. Only durable stores advertise production.
prop storage_identity : object-
Expand source code
@property def storage_identity(self) -> object: """The resource shared by every participant (a pool, or the store itself).""" ...The resource shared by every participant (a pool, or the store itself).
prop storage_open : bool-
Expand source code
@property def storage_open(self) -> bool: """Whether that resource still accepts work.""" ...Whether that resource still accepts work.
Methods
async def activate_production(self, *, account_id: str) ‑> bool-
Expand source code
async def activate_production(self, *, account_id: str) -> bool: ... async def admit_production_configuration(self,
configuration: ReportingConfiguration,
binding: ReportingDestinationBinding,
*,
offering_id: str,
service_context: ReportingProductionSourceContext | None = None) ‑> None-
Expand source code
async def admit_production_configuration( self, configuration: ReportingConfiguration, binding: ReportingDestinationBinding, *, offering_id: str, service_context: ReportingProductionSourceContext | None = None, ) -> None: ... def is_sdk_production_store(self) ‑> bool-
Expand source code
def is_sdk_production_store(self) -> bool: """Exactly a shipped production store, not a subclass.""" ...Exactly a shipped production store, not a subclass.
def is_sdk_status_projection(self, projection: object) ‑> bool-
Expand source code
def is_sdk_status_projection(self, projection: object) -> bool: """Exactly the shipped projection class for this store.""" ...Exactly the shipped projection class for this store.
def maintenance_operations(self) ‑> tuple[tuple[str, Callable[[], Awaitable[typing.Any]]], ...]-
Expand source code
def maintenance_operations(self) -> tuple[MaintenanceOperation, ...]: """Retention passes for the features this store opted into, in run order.""" ...Retention passes for the features this store opted into, in run order.
def notification_workers_linked(self, workers: Sequence[ReportingNotificationWorker]) ‑> bool-
Expand source code
def notification_workers_linked(self, workers: Sequence[ReportingNotificationWorker]) -> bool: """Whether every worker drives this store's exact queue classes over its storage.""" ...Whether every worker drives this store's exact queue classes over its storage.
def production_outboxes(self,
projection: ReportingProductionProjection) ‑> tuple[typing.Any, typing.Any, typing.Any]-
Expand source code
def production_outboxes( self, projection: ReportingProductionProjection ) -> tuple[Any, Any, Any]: """The core, status and readiness queues, in that order.""" ...The core, status and readiness queues, in that order.
def projection_linked(self,
projection: ReportingProductionProjection) ‑> bool-
Expand source code
def projection_linked(self, projection: ReportingProductionProjection) -> bool: """Whether the projection's queue shares this store's storage.""" ...Whether the projection's queue shares this store's storage.
async def read_delivery_window(self, key: tuple[str, str], *, now: datetime) ‑> tuple[tuple[str, str, datetime.datetime, datetime.datetime] | None, datetime.datetime]-
Expand source code
async def read_delivery_window( self, key: tuple[str, str], *, now: datetime ) -> tuple[SavedDeliveryWindow | None, datetime]: """The recorded window for ``(account_id, idempotency_key)`` and the store's instant.""" ...The recorded window for
(account_id, idempotency_key)and the store's instant. async def reserve_delivery_attempt(self,
activity: ReportingActivityStore,
lease: DeliveryLease,
*,
request: ActivityRequest,
now: datetime,
queue: str,
expected: tuple[str, str],
horizon_seconds: int) ‑> tuple[WebhookAttempt | None, datetime | None, bool]-
Expand source code
async def reserve_delivery_attempt( self, activity: ReportingActivityStore, lease: DeliveryLease, *, request: ActivityRequest, now: datetime, queue: str, expected: tuple[str, str], horizon_seconds: int, ) -> tuple[WebhookAttempt | None, datetime | None, bool]: """Reserve one HTTP attempt and its immutable first-attempt deadline atomically.""" ...Reserve one HTTP attempt and its immutable first-attempt deadline atomically.
def status_projection(self,
*,
consumer_status_enabled: bool,
escalation: ReportingDeliveryEscalation | None,
revision_ownership: bool) ‑> ReportingProductionProjection-
Expand source code
def status_projection( self, *, consumer_status_enabled: bool, escalation: ReportingDeliveryEscalation | None, revision_ownership: bool, ) -> ReportingProductionProjection: ... async def validate_production_schema(self, *, notifications: bool, service_context: bool) ‑> None-
Expand source code
async def validate_production_schema( self, *, notifications: bool, service_context: bool ) -> None: """Raise ``reporting_production_schema_unready`` unless the catalog is installed.""" ...Raise
reporting_production_schema_unreadyunless the catalog is installed.
Inherited members