primus.optimization.persistence module

Durable storage for optimization decision packets.

The decision service remains transport and storage agnostic. This adapter is the only optional persistence path: it delegates to the established Task -> Report -> ReportBlock implementation, which uploads the full payload as a ReportBlock attachment and keeps only a compact pointer envelope inline.

class primus.optimization.persistence.PersistedDecisionPacket(report_id: str)

Bases: object

Reference to a durable copy of a decision packet.

__init__(report_id: str) → None
report_id: str
primus.optimization.persistence.persist_decision_packet(packet: Mapping[str, Any], *, client: Any, account_id: str | None = None, persist: bool = False, report_name: str = 'Optimization decision packet') → PersistedDecisionPacket | None

Optionally persist an unchanged decision packet through artifact persistence.

With persist=False this function deliberately performs no imports of report services and no external writes. With persist=True every storage failure is allowed to propagate; callers must not reinterpret a failed persistence request as an ephemeral success.