Skip to content

cayu.storage.product_operations_sqlite

Public Cayu API. Definitions are grouped by their public source module, and definitions from private implementation modules appear on their package’s page; adding a symbol does not move existing links. The import shown at each entry is a supported public namespace. Read the Python API overview and install the required extra.

from cayu.storage import SQLiteProductOperationStore

Tenant/resource authority for a maintained product service on SQLite.

This store, not Cayu labels, metadata, or runtime identifiers, is the product authorization boundary. Product reads are tenant-qualified by public id; the private session-id lookup exists only for trusted continuation hooks.

Every mutation runs in one BEGIN IMMEDIATE transaction. Execution claims use store-owned lease time, terminal updates are conditional on the current claim, and a completed result requires the content-bound publication receipt written before Cayu session completion. SQLite serializes writers on one host; use PostgresProductOperationStore for service processes that do not share one filesystem.

The table joins Cayu’s shared schema revision history. schema_mode follows the other SQLite stores: CREATE initializes an empty database and otherwise validates; an existing older database requires cayu storage migrate. clock replaces the lease clock for tests.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
category ServiceIdentityStoreKind ServiceIdentityStoreKind.DURABLE
SQLiteProductOperationStore.__init__(path: str | Path, *, schema_mode: schema.SchemaMode=schema.SchemaMode.CREATE, clock: Callable[[], datetime] | None=None) -> None
async SQLiteProductOperationStore.close() -> None
async SQLiteProductOperationStore.reserve(*, tenant_id: str, subject_id: str, idempotency_key: str, request_fingerprint: str, public_id: str, work_id: str, session_id: str, task_id: str, request_text: str) -> ProductOperationReservation
async SQLiteProductOperationStore.find(*, tenant_id: str, public_id: str) -> ProductOperation | None
async SQLiteProductOperationStore.find_by_session_id(*, session_id: str) -> ProductOperation | None
async SQLiteProductOperationStore.claim_execution(*, work_id: str, claim_id: str, lease_seconds: int) -> ProductOperationExecutionClaim | None
async SQLiteProductOperationStore.heartbeat_execution(*, work_id: str, claim_id: str, lease_seconds: int) -> bool
async SQLiteProductOperationStore.release_execution(*, work_id: str, claim_id: str) -> bool
async SQLiteProductOperationStore.record_result_receipt(*, work_id: str, claim_id: str, receipt: ProductResultReceipt) -> ProductResultReceipt
async SQLiteProductOperationStore.record_recovery_status(*, work_id: str, claim_id: str, recovery_status: ProductRecoveryStatus) -> ProductOperation
async SQLiteProductOperationStore.finish(*, work_id: str, claim_id: str, status: Literal['completed', 'failed'], result: str | None) -> ProductOperation

Release source · Runtime guarantees · Capability guides