Skip to content

cayu.storage.PostgresEventWatcherStore

Part of cayu.storage.postgres. Read the Python API overview and install the required extra.

from cayu.storage import PostgresEventWatcherStore

Postgres-backed durable watcher state for hosted multi-worker apps.

Bases: _PostgresStoreBase, EventWatcherStore.

PostgresEventWatcherStore.__init__(conninfo: str | None=None, *, pool: AsyncConnectionPool | None=None, min_size: int=1, max_size: int=8, schema_mode: schema.SchemaMode=schema.SchemaMode.VALIDATE, read_only: bool=False, migration_reset_empty_recall_state: bool=False, migration_expected_input_state: schema.SchemaState | None=None, migration_operation_sha256: str | None=None, migration_receipt_json: str | None=None) -> None
async PostgresEventWatcherStore.ensure_schema() -> None

Open the pool and reconcile the schema now (per schema_mode).

Normally reconciliation happens lazily on first use; the cayu storage CLI calls this to run a migrate (or validate) as an explicit step.

async PostgresEventWatcherStore.close() -> None
async PostgresEventWatcherStore.load_state(watcher_name: str) -> EventWatcherState
async PostgresEventWatcherStore.claim_event(*, watcher_name: str, record: EventRecord, lease_seconds: float, max_attempts: int=3) -> EventWatcherClaim | EventWatcherDelivery | None
async PostgresEventWatcherStore.renew_claim(claim: EventWatcherClaim, *, lease_seconds: float) -> EventWatcherClaim
async PostgresEventWatcherStore.mark_success(claim: EventWatcherClaim) -> EventWatcherDelivery
async PostgresEventWatcherStore.mark_failure(claim: EventWatcherClaim, *, error: str, max_attempts: int) -> EventWatcherDelivery
async PostgresEventWatcherStore.list_dead_letters(watcher_name: str, *, include_resolved: bool=False, limit: int=100) -> list[EventWatcherDeadLetter]
async PostgresEventWatcherStore.resolve_dead_letter(watcher_name: str, event_sequence: int) -> EventWatcherDeadLetter

Release source · Runtime guarantees · Capability guides